Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

136
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda