Reputation: 61
In Functional Programming, the good rule of thumb for composition is to create a function for each operation and compose them together to achieve the desired functionality. In contrast, in Object-oriented Programming, should each method be self-contained with the use of less helper methods or same as Functional Programming? What is a good practice?
Upvotes: 1
Views: 75
Reputation: 22191
The good rule of thumb, no matter the paradigm is OOP or FP, is that a function should do one thing.
It does not mean that a function should not internally compose with others.
If helpers method contribute to participate to achieve the sole function/method responsibility, that's pretty fine to use them.
Upvotes: 1