DEV Community

Discussion on: Designing a better architecture for a Node.js API

Collapse
 
nahidmbstu profile image
Nahid Hasan

Why do i need this structure ? i use normal functional approach.

Collapse
 
pacheco profile image
Thiago Pacheco

Yes, I've being using a normal function approach for a long time too, but applying design patterns using class is really helpful and easy to replicate/add functionalities across your app, this will make your life easier especially on a big project.
For example, if you need to create a new endpoints with the same common functionalities as a CRUD like we did there you won't need to copy and paste code (respecting CLEAN code), you can just inherit all the functionality you have already created somewhere.

Collapse
 
lechip profile image
Oscar Barrios

neither functional nor OO are normal. Those paradigms merely tools. The author chose to go OO but doesn't mean that a lot of the concepts can be used in the functional way.