DEV Community

Discussion on: Avoid getters and setters whenever possible

Collapse
 
jodydott profile image
Jody Dott

the computations should happen inside your object (in a OO world) you shouldn't be asking other objects for their internals (unless they are simple value objects).

Collapse
 
xowap profile image
Rémy 🤖

Yup but sometimes you start without needing the computation and then later realize that you need it for a new feature. In that case, it's hard to come back on your decision.

Thread Thread
 
jodydott profile image
Jody Dott

That's why you should program with an OO style and encapsulate. All requires computation.