Skip to Content

Round peg – square hole.  So how will I fit?  I’ve been working on it for awhile.  And yes, I do program using objects.  That’s a start.  So what really do I think about?  It’s the start of a different way of thinking.  Or is it really?  Don’t we already think that way?  A house is an object.  An Office is an object.  A car is an object.

Delete, backspace, bold, underline.  Wait.  Delete is an object – I umh think.  Backspace, maybe.  But bold and underline wouldn’t  those be attributes of an object?  The object would be format. 

WOW!  My mind is in a twitter.  (Get it twitter)  OK so I’m working on lack of sleep here.   I am / is / was a structural programmer.  I worked on one of the most structured language there was – RPG.

Here’s a typical program.

Parameter: xyz like abc.

Start-of-selection.

Get_data.

Display_data.

End-of-selection.

 Look familiar?  Feel familiar.  I bet it feels comfortable and easy to follow.  It’s kind of like putting on an old pair of jeans or a coat you that you have had for a while or that blanket just out of the dryer.  

SCRATCH. 

The nails are going across the board.  OK – Enough already!  Are you serious?  Familiar – really you like familiar?  What fun is familiar?   And this is SAP – ripping that blanket out from under you is the normal way of doing things.

Only they didn’t.   Not this time.  When it came to the ABAP programming they didn’t MAKE you change the way you are doing things.   They couldn’t rip the blanket out from under us.  There is just too much of the legacy code.  Yes, I said it structured programming is legacy programming.  Now you may hit me over the head with something.

And so… 

I’ve been reading these blogs.  This is a better way of doing xyz.  No this is a better way of doing it.  No actually 123 is the best way!   Are you kidding?  They all are good ways.  If you want to program structurally your whole life on SAP, you probably could.  Old code just doesn’t die that quickly.  And moving forward – ah what’s the incentive for programming using objects?    Let me just say that you’ll have a fun time trying to convince your boss that you need them.  It’s much easier now these new fangled things have come along.  You know like Web Dynpro.  Smile!  That one is my favorite.

OK – your boss is behind you.  You aren’t arguing with a dead horse – you are not a diehard structural programmer.   And so you are ready to embark on this journey of learning objects.  

 But…  But.. BUTTTTT…

How you sputter?   That’s kind of what I was and still am doing.  I’m slowly learning about objects, and then will apply what I learn.  I am reading this blog and doing my homework.  So how can I start?   Well pretend I’m in front of you ticking off points on my fingers.  There are SAP classes.  There is SAP e-learning.  There are SAP books.  There are SCN forums.   There is more information on just objects on the internet. 

 WAIT.  STOP.  Slam on those brakes.  

Silence – oh wonderful silence.  Here’s an idea: What about just doing it?

Can you look back at the first bit of ABAP code you wrote?  Was it completely right?  Did anyone care as long as it did what it needed to?  I cringe just thinking about it.

Go back even further.  How about the first time you road a bike?  I’m sure you being perfect didn’t fall?  Me, I fell many times.  I still have a scar from stitches.  MMmmm… Bikes don’t fly so well…

So here it goes.  I’m not perfect, I’m not the best, I’m just someone who wants to learn, use, and continue to learn about objects.  (AND PROGRAMMING, and many, many, other things.)  My true Object type friends may say I’m not doing it right.  And Hey, yes, they may be right.   BUT I am giving it a try.  In the end my program (+objects) does what it needs to do.  It will get you the correct answer.  I’ll learn from it, and hopefully my next project will be better.

So what am I doing with this strange blog?  There are other more technical ones out there.  Me – I like the KISS theory.   I’m introducing you to a group of blogs that I’m going to write.  I’ll focus on moving from structured programs to object programs by taking Michelle sized steps.  My little steps.    My ideas may be a little wild.  And I’m sure there will be comments.  But I’d love for you to take this journey with me.  Try to avoid thinking it’s too hard, or why should I use it, and just do it.   Do it when it makes sense.  The more you write in objects, the more things will start to make sense to do them that way.

Also I’m looking forward to learning from your comments at the bottom of the blogs!  It should be fun.  And I bet I learn a LOT.

To report this post you need to login first.

30 Comments

You must be Logged on to comment or reply to a post.

  1. Naimesh Patel
    Hello Michelle,

    Today is an OO ABAP day for me as well. Some new thoughts and some new angles. I published a blog Override (Redefine) Static Method? yesterday and getting a feedback from my readers.

    If I would have an choice to choose from OO vs Procedural, I would definitely go for OO. We all start as beginner, but over the time we would realize what mistakes we had done when some program gives us hard time – keeps coming back with new break fixes.

    To help out the community, I already have written some articles on OO Concepts, OO Design Patterns & OO Design Principles.. I would definitely try to help you along you way to OO, as far as I can.

    Regards,
    Naimesh Patel

    (0) 
    1. Former Member Post author
      Naimesh,

      Actually so do I.  As you can tell from my blog.  My journey continues daily.

      Aha!  I loved your article on Override (Redefine) Static Methods – BUT what about the beginner – that person in structural programming land who hasn’t had time, resources, etc. to start OOP?   When I think about the issue, I think simple, easy, baby steps.   This article is excellent, and I am saving it in my favorites.

      In fact all the links there are excellent!  They are however, when I look with structural eyes – well – hard.  OOP concepts, friends, redefine…  Hard to understand.  But it gets easier.  That’s my point.  Start small with easy to understand examples for the structural programmers.  

      I think you have volunteered to help me write / draft / review some blogs!!!!  Excellent.  My understanding coming from a structural approach will be different than lean things via a normal object approach.  It should be interesting.

      Love your blogs, and will reference them!

      Michelle

      Feel free to send me contact information or I will track you down.  My e-mail is in my profile.

      I’d love to make this a collaborative effort.

      BTW – I tried with an article in the Mentor’s Quarterly, but then when I read the article, I couldn’t understand it.  Or what I really wanted to say.

      (0) 
      1. Naimesh Patel
        Hello Michelle,

        Yes I know, you care and you want others to care too – thats the reason, you started this effort.

        I agree that if we throw the terms Redefition, Overriding, Overloading (to heavy), Decorator, Open-Closed Principle aka OCP (contradicting name?) to a procedural programmer, it will go above the head.. It create more confusions… But once you know, even little bit about that, these terms start making more sense.

        Even when I started experimenting OCP, I was stumbled many time to realize that in real-time.

        My contact info is in my business card as well – I’ll save you some effort, so you can focus on the main purpose.

        We should have at least these sections. I would strongly suggest to use near real time business case scenarios.
        * Procedural Code
        * Issues with Procedural Code – there may not be any for some cases
        * OOP Code
        * Benefits of OOP Code
        * Learning

        I wrote one Case Study on Observer, which is basically tells you how life can be made easier with implementing Design Pattern. We should have similar stories, but from Procedural to OOP …

        Regards,
        Naimesh Patel

        (0) 
        1. Former Member
          Hi,

          Having worked with structural programing for years,i must say, i could manage/understand to work with ABAP Objects whenever required(mostly when unavoidable like WD4A,etc),thanks to lots of theoretical OOPs concepts.

          Recently,i decide to move to OOPs,started using ABAP objects in all my developments but puzzled and  not sure if my program would leverage any advantages OOPS offers(mainly in the way the program is written using ABAP Object).

          Thanks for this wonderful initiative from all of you.Looking forward to learn more on using the power of OOPS from this initiative.

          Thanks
          Kumar.

          (0) 
      1. Naimesh Patel
        Hello Kumud,

        As I mentioned in reply to Michelle, in the Wiki, We should have at least these sections. I would strongly suggest to use near real time business case scenarios.
        * Procedural Code
        * Issues with Procedural Code – there may not be any for some cases
        * OOP Code
        * Benefits of OOP Code
        * Learning

        This will help people to understand better on what they can achieve by using OOP.

        Let me know, if you think otherwise.

        Regards,
        Naimesh Patel

        (0) 
  2. nabheet madan
    Michelle keep them coming don’t stop..have been doing structural programming for sometime i guess after those encouraging comments on my blogs have initiated my journey to the World of OOPS. ABAP:):):

    So here is the first question may be the most silliest one but it is why oops abap…it is the first question always a structural programmer like me has…have read about you can use multiple instances of same clas sbut not in case FM..real time mapping but could not find them convinving…may be thought of asking you..as you are also a structural programmer why are you den moving to oops abap…?

    Nabheet

    (0) 
    1. Former Member Post author
      Nabheet,

      Trust me you are not alone.  A journey into OOP is just what it is. 

      And so – I took the time to track down your blogs.  Excellent!

      Create/Edit/Delete Attachments using GOS –  Create/Edit/Delete Attachments using GOS

      Sadly I couldn’t get to some as the links were broke in SCN.  I’m looking forward to some more from you.  (Workflow one’s too.  I like those.)

      BTW – you’ve just volunteered to help too!  And I CAN find your e-mail address.  (Smile)

      Thank you for your comment – I really want to start this easy and move slowly to “real” object training such as what Thomas Jung has given in e-learning, some SAP books, etc…  What I’m thinking is what about before?   Let’s make this as painless as possible.

      Looking forward to your comments!

      Michelle

      BTW – I didn’t ignore your question.  What is an object?  Michelle’s crazy answer will differ from the experts.  And it boggles the mind.  In its truest sense an object is a grain of sand.  Another object is the grass, yet another tree, yet another wind, yet another the world as a whole.   Twist it – an object is nature and methods are wind, rain, eruption, earth quake…  The attributes are forests, cities, and more… 

      Crazy huh?  An object to me can be just about anything.

      The well known definition:

      Object-oriented programming (OOP) is a programming paradigm using “objects” – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance. Many modern programming languages now support OOP, at least as an option. Object-oriented programming (OOP) represents an attempt to make programs more closely model the way people think about and deal with the world. In the older styles of programming, a programmer who is faced with some problem must identify a computing task that needs to be performed in order to solve the problem. Programming then consists of finding a sequence of instructions that will accomplish that task. But at the heart of object-oriented programming, instead of tasks, we find objects – entities that have behaviors, which hold information and that, can interact with one another. Programming consists of designing a set of objects that model the problem at hand. Software objects in the program can represent real or abstract entities in the problem domain. This is supposed to make the design of the program more natural and hence easier to get right and easier to understand. An object-oriented programming language such as Java includes a number of features that make it very different from a procedural language.

      (0) 
      1. nabheet madan
        Thanks Michelle for replying:):)Now i am really happy..:):) Last few days have been lot of criticizm but liked it as it has pushed me to do what i was not able to for so long…OOPS ABAP–i like structural programming a lot..but yeah you know its very difficult to change..but those blogs feedback which i have got have paved the way for me to change:)..

        I am very much interested in anyway i can help for the same.

        I really like the way you perceive an object to me it is like more of a way to be…It is the ultimate thing from being nothing to everything:):):)

        I used to read lot of blogs but did not how to try it..but yeah SDN has given a platform to start it and yes journey is amazing plus an honest one:):)…

        When are you writing you next blog..?

        Let me know in case i can be helpful in any way..

        thanks
        Nabheet

        (0) 
        1. Former Member Post author
          I will try to get one out next week.  Then I would like to set something up like Kumud suggested we try.   That would be a great way to get feedback.

          For this next one, I’ll simply try to mail it out before I publish it.  The one’s after that..  Ah…  That’s the fun part.  Someone else could start the blog and we could give our advice.  Then start tying these blogs together.

          It will be fun.  It will be interesting the different perspectives that we get!  We have some people that have been using objects forever, and some that are just starting, and some that have started but are not experts.  (That’s me)

          Michelle

          (0) 
      2. Paul Hardy
        When I am trying to explain about modeling a program using “objects” I find the following example is one most people can relate to. You are on the tenth floor of a 20 storey hotel and have pressed the lift button to go down, and after five minutes you start to wonder why the lift is taking forever to arrive. As a programmer you think there must be some sort of program / algorithm determining where each lift goes, and you think “I could write a better one than that, it could not be worse”. So, you could model the program with the over-riding object being the hotel, which has attributes – twenty floors, three lift shafts. On each floor there are “objects” which are people who have attributes which is what floor they are on and what floor they want to travel to. Each lift shaft contains an object which is a lift which has an attribute saying what floor it is on. On each floor are three objects which are buttons to summon the lift … you get the idea. The aim of the program is to take as input where all the people are and where they want to be, and then design an algorthim to get the people where they want to go in the fastest time given the constraints that you only have three lifts and each can only be on one floor at any given time. You could do exactly the same in procedural programming of course but this (I think) is a good example of linking real world objects with the IT equivalents (i.e. instances of classes). It’s also a good example of loose coupling – I press the down button and “publish” my desire to go down to the hotel bar to get drunk. Any of the lifts can “subscribe” to this request and arrive to come and get me. I don’t care which one. Please let me know if I am talking nonsense.

        Cheersy Cheers

        Paul

        (1) 
  3. Robin Vleeschhouwer
    Hi Michelle,

    I enjoyed reading your blog, because your are describing the most difficult part of OOP. At SDN you can learn how to program with ABAP objects, but the design of the classes depends of your own needs.

    A good tip could be to first create a use-case diagram describing your needs and then create a class-diagram of your application. This way you can visualize the objects that you need for your application. Also after the creation of the application you have a good documentation to start with.

    Regards, Robin Vleeschhouwer

    (0) 
    1. Former Member Post author
      Robin,

      UML!!!!   What’s a UML?  I’m just kidding.  But when you stop to think about a structural programmer.  Do they use UMLs?  Most likely not.

      We are trying to do things at the speed of light to get our software in the hands of our users.  Well tested, quick to write, quick to maintain.  I would agree a UML is VERY helpful.   But I would say that is a ways down the road of OOP.  Also very few programmers like documentation – UML is something like the old flow chart.  I know a lot different but something I can compare it to.

      Maybe not, I’d love to hear your opinion.  I was hoping for some quick hits.  One that all of our structural programmers use is the OOP ALV.  Why?  It’s easy and quick to use.  Perhaps we find more of those.  That would help.

      Then I was thinking about my simple examples.  Examples where I don’t use the power of OOP.  Where I simply move a structural program to a class / method format.  Why?  Does it make more sense to do that?  Not really.  But you get the feel of how the class is laid out.  When it comes down to the basics it’s just ABAP underneath.   I don’t think structural programmers realize that.

      Now a fun one that I just did was having internal tables available in a class.   That meant no moving things back and forth between memory areas.   It’s an easy class.  It is easy to maintain.  It makes sense for the structural programmer.  Using the power of OOP?  No. 

      I’m thinking of how you would get started even before you learn the cool OOP functionality.  UMLs – perfect to keep our projects in control.   So perhaps I’m wrong, you tell me. 

      I’ve got your e-mail address too.  So I think I’ll bounce some ideas off of you too!  If you don’t reply, I know I’m driving you crazy and I’ll leave you alone.

      BR,

      Michelle

      (0) 
    1. Former Member Post author
      Excellent!  Excellent!  Excellent!

      I would love your help too.  Let’s see if we can get the pre-oop information out there.   The people like me who are starting from the beginning and gradually working into the real thing.

      Michelle

      (0) 
  4. Kumud Singh
    Hi Michelle,
    Your blogs invariably represent wider part of community. An abaper moving from Structural to Object oriented programming.
    Although, I assume myself to be dealing with Object Oriented programming for a while now, but ABAP object seems to be much much much more.Moreover, I believe once OOP concept hit the mind,its hard to go back to the previous way.
    Having said this, as you talk about taking baby steps and moving to objects, can we start doing this pragmatically? Do we have a place where we can start a project wherein we can write the same logic in structural and then using ABAP objects and compare the difference and the extra efforts/mindset/research required? The advantages gained. Also not all situations are apt for objects. e.g. there are some tcodes which forces us to use subroutines. e.g. PU12. So, we can even highlight why doing it the Object way is better in that scenario.
    This can require forming a virtual team and taking it forward.If there is something similar already, please let me know?
    However, you may have a better idea/proposal of taking it forward.Do excuse in case my proposal sounds silly.

    Regards,
    Kumud

    (0) 
    1. Former Member Post author
      Your proposal sounds great!  I have just the place.  It’s called sapstreamworks.com.   If I can get everyone interested in this we could plan out what we wanted to present in blogs, WIKIs, whatever to the general public.  It would be much easier than e-mails flying around.

      Sapstreamworks is free to use if you are only doing limited projects, and it’s great for collaboration.  If you are already there, I can invite you to this project.  If not, please sign up.  My e-mail is listed.  Anyone and everyone with an opinion is welcome.  Send me an e-mail.

      I’d love to hear your comments.  I’ll set some dates out there so we can start publishing blogs that may point to some WIKIs.  It would be cool if we could start a code exchange project too!  But that could be later.  Maybe much much later.  I like the rest of you have a real job!  (Smile.)

      Great idea Kumud!

      Michelle

      (0) 
      1. Kumud Singh
        Michelle,
        Thanks for the reply.While asking the question, I had Code Exchange, Wiki in my mind as probable answers and completely forgot Streamworks. Yes I am there but not accessible at work. So will have to get back to send/accept your invitation. I think we will have to finalize the plan / place and then get started. Streamwork can be the place to have the discussion done. However, it will be at its own pace. If you prefer emailing communication, I will send you an email as well.
        Thanks Michelle. Your comments/blogs always get my creative juices flowing.

        P.S . – All those interested to be part of the virtual team can please raise hand.

        Regards,
        Kumud

        (0) 
          1. Kumud Singh
            Hey Nabheet,

            I have already added our names in the virtual team. Please visit the wiki highlighted by Michelle in the comments above. I have added the proposal in comments section of the Wiki.

            Regards,
            Kumud

            (0) 
          1. Kumud Singh
            Michelle,
            I was authorized to add comment in the wiki and have described my idea there. We can probably take it forward based on the involvement. If you like the proposal, we may have to make the community members aware of the idea to get more involvement.

            Thanks much. Kumud

            (0) 
  5. Suhas Saha
    Hello Michelle,
    I’ve lost count how many times i’ve asked my team members to get comfortable in OO-ABAP. Come Release 702, subroutines & function modules are obsolete modularization techniques.(Dear Lord!!) So the best time to learn OO is NOW!

    I think the point about UMLs is well made! OO developers who visualize their designs before actually coding them build the most robust applications.

    I feel Naimesh has already voiced my emotions & i could not have agreed with him more!

    Cheers & good luck in your endeavors,
    Suhas

    (0) 
  6. Joao Sousa
    I would just like to point out that although OOP is the best way to structure a project and make maintenance simpler, it’s not always the best solution.

    Don’t forget that one of the features of OOP is re-usage. You shouldn’t think of your class just for one program, you should think of what makes sense in a more generic way. This is the concept. I won’t program a Customer Class for each program I develop, I will use this class for every single program that I write in a given system (maybe add methods that don’t exist, maybe create a “sub-class”, but never recreate the same class).

    The problem with this approach is that it doesn’t work very well for work intensive program since there is a lot of overhead. SAP is not a C# web application, it is a full fledged ERP that deals with millions of records of information, and sometimes programs needs to be fine tuned, every gram of fat needs to be cut, and this is not always compatible with class re-usage.

    Most large programs I write are OO, but not all.  

    As an advice for a beginner, begin with the theory of OOP. This is critically, one needs to understand the concept before applying it to any given programming language.

    (0) 
    1. Former Member Post author
      And do you know your program will only use the logic once?  Are you sure someone else won’t write a program that could use that class/method?  What about MVC??  Could you have different frontends use your program?

      Just some thoughts.   It’s easy to think your program won’t be reused and then 1 year later you find out it has been reused and then code is in two places.  YUCK.

      Theory of OOP.   For the begineer – don’t you think most of them know the theory?  They’ve read the books, they’ve gone to the classes, they probably know structural programming. (As this is what the blog is geared to.)  They are “ready” to go.  But where to start?  How to start?   If I took a structural program could I just turn it into a class?  Not really.  But how to keep the changes simple and easy to understand as a first step.  Then get into more detail.

      Yes concept is good.  Total understanding of a concept comes to different people in different ways.  For me it is simply doing it. 

      Take a look at the WIKI and add your thoughts.  It sounds like you have some great ideas!

      Michelle

      (0) 
    2. Former Member Post author
      BTW – I’m not debating that OOP is the best for everything or not the best.  I just want a place to start.  Where would a structural programmer start?  How?  Most of the people responding have used OOP.  Did you start from a structural background?  How did you learn it?

      Me – I’m working all my programs that I can into class/methods and using Web Dynpro where ever I can.  So yes, I’ve started.  I believe I have a long ways to go.  I’m always learning.  

      I’m going back to how I started, and trying to give some examples, ways, that people can get started with OOP…  So it isn’t such a big task.  Just the words could stop you..  They are intimidating.

      So that’s why I avoided – sort of – answer when to write OOP.

      Smile!

      Michelle

      (0) 

Leave a Reply