Skip to main content

Timeline for Why do we need private variables?

Current License: CC BY-SA 3.0

3 events
when toggle format what by license comment
Aug 1, 2024 at 1:12 comment added NickJ Everything about this philosophy is wrong. Code should not be seen as a group of programmers keeping each other safe. Each programmer should have absolute control over every part of the application. The issue is that Object Oriented Programming is absolutely fundamentally flawed. If there were no meaningful persistent state in an object there would be no problems with reaching into it to pull out data. The problem only exists because the problem is created by OOP.
Oct 5, 2013 at 7:00 comment added rszalski +1 "While other programmers are not out to get you, they do interact with your code." Programmers using your code are not inherently evil. By using private variables you make sure that they (and you, in the future) don't get hurt using the code. It also helps you to design a better API and document it.
Apr 10, 2012 at 5:48 history answered Frank CC BY-SA 3.0