Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP and OOPS

former_member197870
Participant
4,624

Dear Experts,

I have now almost 8-9 years of sap abap and have been using core abap and also OOPS many at times.I understand Abap OOPS particularly plays an exemplary role when it comes to code reusability,inheritence,polymorphism,overriding.

But frankly,when it comes to understanding a code of another developer who has used OOPS ,i would not say it is next to impossible but it is impossible.

And with this drawback,i find OOPs a total letdown to technology.I need your opinions on same.

1 ACCEPTED SOLUTION
Read only

pokrakam
Active Contributor
3,981

You can write bad code in any language. So the statement "OOPs a total letdown to technology" is not valid.

Or perhaps you are struggling to understand reasonably OK code. But without telling us what is impossible to understand, or why it should be so, we can't really provide any information.

If you want code that's impossible to understand, try Malbogle. I don't agree with your assertion that ABAP belongs in the same category. I can understand most ABAP code. In fact, I find good OO ABAP far easier to understand than legacy code. OO is a mature concept that's been around for a very long time - since the 1960's to be precise. I don't think it would still be around if it's impossible to understand.

16 REPLIES 16
Read only

ilachaudhary297
Product and Topic Expert
Product and Topic Expert
3,981

Hi,

Here are few benefits of OOPS ABAP which I have personally come across.

1. Test automation using test double framework : Now we are delivering more robust code as we are able to automate testing by use of unit test class. Unit test class is more efficient with OOP concepts. Though we can have it for classical ABAP also but coverage will be very less.

2. When it comes to achieving patterns OOPS comes very handy. Singleton and factory patterns are widely used in front-end development.

3. Many frameworks are now these days getting developed in OOPS because of its properties like polymorphic, inheritance and abstraction. Use of interfaces you can find in BADI framework and as well as in ODATA framework.

There many such advantages which I cannot see in classical ABAP.

Thanks

Ila Chaudhary

Read only

pokrakam
Active Contributor
3,982

You can write bad code in any language. So the statement "OOPs a total letdown to technology" is not valid.

Or perhaps you are struggling to understand reasonably OK code. But without telling us what is impossible to understand, or why it should be so, we can't really provide any information.

If you want code that's impossible to understand, try Malbogle. I don't agree with your assertion that ABAP belongs in the same category. I can understand most ABAP code. In fact, I find good OO ABAP far easier to understand than legacy code. OO is a mature concept that's been around for a very long time - since the 1960's to be precise. I don't think it would still be around if it's impossible to understand.

Read only

matt
Active Contributor
3,981

Two possibilities:

1. The specific code your are looking at is good, but you just lack the skills to understand it

2. The specific code you are looking at is bad.

Vast amount of ABAP code developed by SAP is OO. Do you really think they'd do it if it wasn't worth it? Do you really think that Java would be widely used if there was a fundemental issue with OO?

The logic of your statement is akin to "I looked at an apple and found it had gone bad, therefore apples are poisonous fruit and to be avoided".

Read only

keremkoseoglu
Contributor
3,981

Me and my teams work exclusively with OO-ABAP since many years, and don't really have problems understanding each others code. Here are some factors which might increase the readability of object oriented code:

  • Standardization of conventions and/or configurations
  • Using design patterns
  • Where used list for interfaces & abstract classes can help
  • SE24 has a decent tool to outline UML diagrams of given classes, interfaces, etc.
  • Having an experienced architect in the team to design class structures before coding

I feel your pain though. I have seen some less experienced developers do functional programming disguised as OO-ABAP, and those can be hard to understand. Or; lack of design pattern experience or ignorance of architectural principles can lead to unnecessarily complicated code structures.

Like any tool; OO ABAP is useful in experienced hands, and can be harmful in inexperienced hands.

Read only

former_member197870
Participant
3,981

I will not go here and there.Simple example reveals main program shows only multiple includes.

So code is not visible at first glance what is its objective.

Every include is dealing with which part of overall program functionality is not clear unless developer documents.

Suppose you look for a functionality to find what is logic behind display of delivery schedule date in ME23N.

You look program,screen.When you check one of module of pai field,It further gives you a include ,then an include will have a class having 9 methods to obtain delivery schedule data.

When you will go to the required one you see,there will be an enhancement spot.Further that enhancement spot will have another include.

Also enhancement spot will have standard implementations.

Again include will have one function module and that function module will branch to still a new class.By the time you traverse to this hefty extent,you will even forget from where you started ,what was your objective ?.Now think how will one understand without debugger.There were no debuggers long time back when approach was procedural and still developers managed to understand and contribute.

You design UML ,you design patterns,and then finally handover all this to an entirely new person.See his comprehension and judge on your own.

If people at sap labs only understand such codes and others do not,thats still an issue to be worked upon.Last but not the least, the sequence of execution of methods of badi implementations are also not known.

Read only

3,981

When looking at global classes, methods are viewed in their own context. This is normal, but if you prefer a greater overview, you can go from form based to text based. Or use Eclipse.

For a program using local classes, there's no reason at all why it can't all be visible at once. You're not forced to use Includes. I seldom do, as it's a bit of a pain within Eclipse.

It seems when you say OO technology is a let down, you're only complaining about SAP standard code that uses OOps. It's certainly true that not all SAP code (whether procedural or object oriented) is well written.

I've been developing in ABAP since 1997. SAP code was often a pain to understand there when it was all procedural. All I can say is that overall, it's improved - object orientation notwithstanding. For good examples, look at how in BI/BW InfoObjects, DTPs, Transformations, InfoProviders etc. are implemented. It's all OO and it's so easy to understand and reuse.

Read only

3,981

ME23N is purchasing, one of the oldest parts of SAP that has been hacked to death. It doesn’t matter what coding paradigm you use, it’s bound to be complex. I challenge you to come up with a procedural based concept that retains compatibility with 20+ year old functionality (including thousands of user exit implementations) and still delivers all the new functionality and enhanceability to all SAP customers the world over.

Read only

BaerbelWinkler
SAP Champion
SAP Champion
0 Likes
3,981

I feel your pain, Aditya! Perhaps my blog-post "Having a hard time wrapping my head around anything ABAP-OO" from a while back and especially the many helpful comments and discussions it generated will help. I'm still not "there" yet but I at least try to use ABAP-OO sometimes.

Read only

matt
Active Contributor
0 Likes
3,981

Judging from his most recent comment, he doesn't seem to be talking about ABAP-OO, but rather the function modules that provide access to the EnjoySAP controls.

Read only

0 Likes
3,981

matthew.billingham

Hi Matt - yes, it's a bit tricky to tell what Aditya is actually talking about. Some of this may be due to English not being his native language which can make it a challenge to express this technical stuff clearly.

Read only

former_member197870
Participant
0 Likes
3,981

Other problem that i realize with OOPS paradigm ,though i am not totally against it.But it must lie in a centered domain example assembly language is used primarily for OS based handling, similarily purpose of OOPS must be confined for designing early prototypes or for RAD tools.

A developer when use OOPS is also not in a total control of his coding.

Example: i need to display an alv report using set_alv_for_first_display. What i do mainly is to provide requisite parameter to call this FM giving some obligatory and some of my preferred attributes to bring some customized effect. But my control is restricted to interface provided on this FM. I do not know how the floodfill is happening in each and every cell displayed or can i make something in alv start blinking..Many things you do and u know that it is done by calling a method. But this abstraction layer of the way intricacies are handled never makes a developer feels to his best.

We just use REUSE_ALV_HIERSEQ_LIST_DISPLAY and feel happy about it.

But how that tree node comes into picture what are graphics behind it ,what logic whether linked list or queue is involved is totally not in our scope.

Read only

0 Likes
3,981

You appear to be a bit confused and labouring under a misapprehension.

If you're using the function modules, you are NOT writing ABAP Objects

Yes, these function modules have restricted functionality, but they were designed to give people with no OOPs knowledge access to the enjoySAP controls. (CL_GUI...). But using them is absolutely nothing to do with OO programming. Unless you're writing in assembler, you're never in total control of your program.

Try using CL_GUI_ALV_GRID, or CL_SALV_TABLE or such like directly. You get far more control over what you are doing. There are plenty of blogs, examples and documentation on how to use them.

While you're looking at them, also read up on the programming principle of abstraction and why it's a good idea. (Abstraction = not needing to know the internals of the class or whatever you are using).

Finally, your statement "similarily purpose of OOPS must be confined for designing early prototypes or for RAD tools." is complete nonsense. Look at this wikipedia article: https://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites The Amazon website is certainly not an RAD tool, nor is it a prototype, and it is written in Java, C++ and Perl. Java and C++ are definitely object oriented, and Perl 5 and above has an OO version.

As far as ABAP is concerned, much functionality in standard SAP and added on by customers is written in ABAP Objects.

Read only

0 Likes
3,981

Hope it's ok, but I've edited your post to make it more readable. I guess you were typing it on a mobile phone or something!

Read only

0 Likes
3,981

A developer when use OOPS is also not in a total control of his coding.

Do you know what happen in detail when you turn your steerwheel in your car?
No, you know that given an input (turn the steerwheel to the left), you got a certain output (the car's wheels turn to the left).

Read only

former_member197870
Participant
0 Likes
3,981

To be very precise, i mean abstraction principle from a developer perspective steals his knowledge.

He simply call method and get his job done.

But core API complexities are handled by other different developers who made that API.

Developer himself has no clue about that.

Read only

0 Likes
3,981

I copy here this too

Do you know what happen in detail when you turn your steerwheel in your car?

No, you know that given an input (turn the steerwheel to the left), you got a certain output (the car's wheels turn to the left).