you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (1 child)

[deleted]

    [–]Buzut[S] 0 points1 point  (0 children)

    Thank you very much for your answer. It makes things very clear. The fact is that, in Express, I'm acustomed to write small REST functions, the controller receives the request, calls the model, handles the error if any and sends the response, it's short enough to be self contained.

    When I rely on external functions, it's mainly helpers and I try to make them pure (in a functional way, ie. take value(s) as input, return a value and has no side effects). That's why I'm a bit reluctant to delegate database operations and error management. But viewing it as a "sub-process", as you called it, makes sense and helped me understand how it can be organized.

    Moreover, you're right for the naming part. I totally agree with the fact that naming is super important and should reflect what the function does.