Hello,
I would like to share my latest thoughts about the set up of Objects in ABAP Objects.
To do good design we will put all the attributes of a class as private.
If we have a let's say standard object with those private attributes we can not do
the following:
li_object->my_method( if_id = li_object2->get_id() ). At the current point in time (will be possible in ABAP from NW7.20 I learned) we can not use a method call as parameter for an other call. We have to use a help variable lf_id in this case:
lf_id = li_object2->get_id(). li_object->my_method( if_id = lf_id ). We CAN avoid that temp variable using attributes that are public but read only.
(Do NOT make them public, you will hurt the principal of information hiding (http://en.wikipedia.org/wiki/Information_hiding) )
Using these public but read only attributes the following is enabled:
li_object->my_method( if_id = li_object2->gf_id ). This will save one variable in DATA statements, one assignment command and some little piece of memory on the application server.
Tags:
ABAP-OO, Classes, Attributes,