Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
How to work with side effects in functional javascript style

I am designing a complex batch core process. The process will call depending on some logic several functions to enquiry the Database and return massive data. This data will be heavily manipulated for this core batch process. These functions are out of my scope so I cannot modify them.

I was thinking to develop this batch process using functional javascript style. Though, I am struggling to see a reasonable design solution in pure functional programming. I have seen 3 options:

1.- Pure functional: Call all the Data impure functions at front and inject the data to the functional core batch process. This looks totally unrealistic as I don't know the data that I will need to get upfront. Part of the batch process is to coordinate which calls to make.

2.- Pragmatic functional: pass the impure data functions as parameter of the Batch core Process. I think this break the strict rules of funcional programming as I am injecting impurity into the pure functions... though I can still unit test the core batch process by mocking the database function parameters.

3.- Using lazy evaluation techniques to postpone side effects outside of the Batch Core functionality: Using ramda and fluture. As an abstraction could make sense though I am not totally bought because it adds complexity. I will need to create a layer to convert promises to lazy flutures... and specially the code doesn't look like javascript and will be more difficult to read by other people in my company.

Am I missing any aha approach in functional programming? Which one you think it is better...

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda