| When attempting to encapsulate a class that will be inherited you would
normally declare the variables as protected so that they can be accessed be derived
classes but are protected from aggregate and associated relationships. The problem with
this is that it generates a higher level of coupling between the ancestor and the
descendant. The impact of changing the way a particular attribute is managed could
potentially impact all operations on the object.
If a class is badly designed allowing protected attributes to be directly accessed and
modified by derived classes can cause the impact of a change to be very extensive. To
minimize problems, it is better to make all class attributes private and not directly
accessible by external or derived classes.
To summarize all attributes should be private with protected methods for getting and
setting the attributes. In my new framework the get and set methods are named the same as
the attribute with function overloading:
ls_Var = is_SomeVar()
is_SomeVar( "New Value" )
|