DEV Community

Discussion on: Who of you use getters & setters and when?

Collapse
 
wrongabouteverything profile image
wrong-about-everything

One of the areas where getters and setters are inevitable in I guess every project is ORM. While this is not mandatory at all. So either you use ORM and getters, or you use none of them.

Another area is UI, as Kasey Speakman mentioned. And this is not mandatory as well, check out this post.

But since almost every open source project requires my model to expose its data, I still have no choice most of the time.