ABAP Freak Show – July 1st – ABAP OO Tutorial Part 2


This is part 2 of the 5 part series on ABAP OO. In this part we will expand the lesson by looking at static vs. instance, visibility, exception classes, inheritance, polymorphism and abstract classes. We start with a very basic class with only static methods that works very much like a Function Group/Function Modules. Next we change the methods into instance methods and see how a class instance allows us to model complex data structures and relationships in code. Then we see how exception classes can make our exceptions more meaningful and simplify the surrounding code for dealing with exceptions. Finally we see the real power of object oriented design come to life as we use inheritance and polymorphism to hide the inner complexity of our business logic from calling applications all while ensuring uniform execution of our code. These techniques may feel foreign at first, but in the long run they lead to code that is easier and safer to maintain.

You can also download all the source code from all 5 tutorials. Just be sure to look at the ReadMe.pdf file for important tips on installing the source code.
http://abap-sdn-examples-tpj.googlecode.com/files/AFS_OO_Tutorials_Source_Code.zip

You can download a high resolution version MP4 version of the video here:
http://blip.tv/file/get/Thomas_jung-AFSJuly12009ABAPOOPart2337.mp4

You can download an iPod/iPhone version of the video here:
http://blip.tv/file/get/Thomas_jung-AFSJuly12009ABAPOOPart2447.mp4

Tags: , ,

13 responses to “ABAP Freak Show – July 1st – ABAP OO Tutorial Part 2”

  1. Leonardo De Araujo says :

    Great job guys. (again)
    I’ve been playing this note on and on again: Developers are slow in adopting OO ABAP, what is a very sad thing…

    I believe there are 3 questions that need to be addressed:

    1 – Why do we need OO ABAP? Why is it better? – That question is a very important one since tons of developers still don’t get it. To address that I often recommend checking the following article from Horst Keller and Gerd Kluger:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/37c5db90-0201-0010-3a9b-d0a5288f3c15
    http://www.google.ca/url?sa=t&source=web&ct=res&cd=2&url=http%3A%2F%2Fwww.sappro.com%2Farticle.cfm%3Fid%3D3363&ei=03slSpvMHtfMlQecooDiBw&usg=AFQjCNE011INmwIpDcwECwtJvqNb1SD12g&sig2=8lUJ5yF8PZhFzd9NBJUlnw

    2 – Once we understand the need and the value of OO ABAP, how does it work – In this group is where your series of BLOGs will definitely help. Additionally, I find the new book from SAPPress ABAP OO programming quite helpful;

    3 – Once we believe in OO ABAP (1) and know how it works (2), are there best practices? – it is for this area that my series of BLOGs (and my SAPTechEd session) is oriented. (Best practices in development of Business Classes)

    So, for your info guys, I will be posting BLOGs that in NO WAY compete with your initiative (How could I anyway? 😉 ) These Blogs are just an addition and I find it quite valuable. Here is the list:

    • PART 1: What are Business Classes and why do we need them?
    • PART 2: Naming convention and Class structure (Attributes and methods);
    • PART 3: Instantiation;
    • PART 4: Inheritance;
    • PART 5: Database Access;
    • PART 6: Exceptions (Exception Classes);
    • PART 7: Model Classes
    • PART 8: Others (Package Hierarchy, performance optimization);
    • PART 9: Community content and collaboration;

    Pleae let me know if you have any problem with it or if you would like me to change anything. I will run it by you before hand anyways.

    ADDITIONALLY: There has been some Twitter postings around wizards and code automation… I’ve been working on a Wizard to automate the generation of the business class (generating the class, the associated exception class, message class, DB access, naming convention for Attributes and methods, etc…) I thought it would be a good DEMOJAM presentation, but I just dont see it getting ready in a few weeks… 😉
    Also I don’t think all see the value of a tool like that so I don’t think it would go anywhere…

    Thanks again guys.

    Leonardo De Araujo
    See you soon in Phoenix

  2. Ed Herrmann says :

    @leo – this sounds like a great initiative. Question #1 is definitely a huge barrier for all the old schoolers doing procedural programming only. It still amazes me in the ABAP world how slow the adoption has been of such fundamental concepts that have been around for a long time. Looking forward to reading your blogs…if you want to cross post them here on egeeks, just let me know.

  3. Leonardo De Araujo says :

    Sure will.
    It would be great to cross post them.
    What we need now is to spread the word.

    Leo

  4. Timo John says :

    Hello,
    I just listened to your first two parts of the ABAP Freak Show OO Tutorial, and would like to thank you for doing all that for the community!

    Secondly I was pleased to see that it looks like the way we walked with our current project is from OO perspective the right track.
    I am really looking forward for the next episodes.

    It would be greak if you could find the time to discuss a bit on the topics Assertions, Log / Watchpoints via SAAB, but NOT on how to use them, thats explained quiet well, but WHEN to use what and maybe why… You came across with good examples in your last sessions, due to that I can Imagine that you can explain that very well …

    Thanks again from Germany
    TIMO

    • Thomas Jung says :

      I had not planned to include Assertions, Logpoints, Watchpoints, etc into this original series on OO, but I’m always looking for topics that people would be interested in for the future. I’m sure this is something that could work its way into a future series – maybe one on writing testable code. We could touch on Unit Tests, Code Inspector, Coverage Analyzer, Trace tool; as well as the points you bring up.

  5. Pimsky says :

    Thank you guys!

  6. maxx says :

    You nailed it in this presentation, nice job.

    One of the reasons “procedural people” do not find value in OO is because of time of delivery on real projects. The amount of effort to learn this stuff does not fit to the real world until a project comes along that requires it. At that point the “nebulous” style and lack of documented inline OO code around encourages many to dump OO as too much hassle and the need to get the job done.

    Your tutorials help to explain and follow the actual spaghetti nature of terse OO code. OO is not better and procedural is not better, they are different tools. E.g. one does not use a carpenter’s framing hammer to make fine furniture. I leave it to others to define whether OO or procedural is the fine furniture or framer’s hammer.

  7. Mahendra says :

    Thks for Gr8 post…

  8. Sridhar says :

    Hello Thomas,

    I have gone through OO ABAP Tutorials and found very helpful but I am not able to download the link provided above. When I click on the link it is playing the video.

    Thanks.

  9. Anurag Jain says :

    Hi Thomas, Thanks a tons for a wonderful pain taking effort put up by you. However I seek your help. Due to certain internet access limitations around my schedule I am looking for downloadable versions of your great ABAP OO tutorial videos but I couldn’t find the part 3,4 and 5 that are listed as online on SCN. Could you take some of your precious time out of your hectic schedule and please upload part 3,4 and 5.

    Moving from procedural to OO ABAP is dificult mostly in terms of how to code the program. Your effort has made it easy and I would love to know if you have posted something as well related to this.

    Thanks,
    Anurag

  10. Zafer says :

    Hello Thomas,

    The Tutorials are so great! I can watch them on SCN, also I want to download it to my phone but all the blip.tv links are dead ./ I couldn’t download any part of the tutorials.

    Thanks,
    Zafer

    • Thomas Jung says :

      I’m afraid the blip.tv changed the focus and therefore deleted most of the videos we had posted there. That’s outside our control. SCN remains the primary home of the videos, anyway. I also can’t control that SCN only allows streaming. That’s a choice on the part of SCN management.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: