DEV Community

Discussion on: Avoid getters and setters whenever possible

Collapse
 
aminmansuri profile image
hidden_dude • Edited

There are some solutions to the getter/setter problem but they aren't great. Like using a visitor pattern to feed data into a view, or using "renderer objects". Part of the reason for getters and setters is the more pressing desire to separate model's and views.

But I agree that from a purist point of view, getters/setters are not really OO and they violate encapsulation.