2007 Sep 18 12:51 PM
Hi!
What policy do you have regarding creating local or global classes in your company? We have decided to mostly use local classes since there is a risk of reusing global classes (when changing something in the global class after it has been used by several programs etc.) . But on the other side it is much easier to use transaction SE24 than creating all the includes by hand. Have anyone else made thoughts about this issue?
Regards, Tine
Hi!
What policy do you have regarding creating local or global classes in your company? We have decided to mostly use local classes since there is a risk of reusing global classes (when changing something in the global class after it has been used by several programs etc.) . But on the other side it is much easier to use transaction SE24 than creating all the includes by hand. Have anyone else made thoughts about this issue?
Regards, Tine
2007 Sep 18 12:55 PM
Hi,
The policy is
<b>Create global class</b> if you want the class to be <b>reused</b>.
And<b> to avoid problems</b> when you change the class, make sure you change class in such a way that it does not effect the existing user's of the class.
Like <b>use OPTIONAL parameters</b> when you change method signature, <b>avoid changing method names</b>, <b>instead add new methods</b>.
You should use local classes only when you are sure that the code there is needed only by your program and nobody else.
If you keep creating local class's and <b>if two programs need the same class it is redundant to create local class's</b> and if you want a change in the class you have to change in all the places.
I hope it is clear.
Regards,
Sesh
2007 Sep 18 1:05 PM
Thanks! I think we will include your suggestions in our new Guidelines for ABAP OO. But I do not set it answered yet in case there are other opinions on this. I'm just curious to know.
Regards, Tine
2011 Oct 14 12:28 PM