DEV Community

Discussion on: Clean Architecture on Frontend

Collapse
 
bespoyasov profile image
Alex Bespoyasov • Edited

That’s correct!

In this post, I tried to bind “clean architecture principles” and “functional core in imperative shell” with pure transformations because I think it takes the best from different paradigms.

I use objects for services here just because it’s easier for me to think of a service as a “package” with a couple of functions inside, and easier to check if the service implements the interface. (I try not to use classes if there is no need to keep some state in the entity.) So, basically, it is just a function, but in a box 😃

I also think that DI via constructors is a convenient way to compose objects, although for composing functions there are other technics like boxes and mapping :–)

In general, I try not to be an advocate for a single particular programming paradigm. For example, immutability, pure functions and functional composition are ideal for describing data transformations. But for working with state I prefer objects instead of monadic state changes from pure FP 😅