by Ursego » 21 Feb 2013, 15:32
Avoid public instance (object member) variables.
Create them only private (or protected if you are planning the class to be extended and the descendants can have a need to access the variable directly). The purpose of instance/static variables is to keep internal information of the object/class, so the outer world (other classes) should access this information only using public properties (or public methods, if your programming language doesn't have properties), i.e. in a controllable way.
You can say: it's super obvious, why did you create this topic? Unfortunately, I have seen many-many violations of this rule in the applications I worked with, especially ones written in PowerBuilder. ![Crying or Very Sad :cry:](./images/smilies/icon_cry.gif)