Skip to end of metadata
Go to start of metadata

Object Oriented


Rules of this WIKI section

  • Feel Free to edit this page and all related pages
  • Keep the page organized following the current layout
  • Only Content entirely related to the Object Oriented can be inserted here
  • Always add the reference link for your text
  • Any copyrights violation will not be allowed

 
Related Links:

Object Orientation Overview

Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. Programming techniques may include features such as encapsulation, modularity, polymorphism, and inheritance. It was not commonly used in mainstream software application development until the early 1990s. Many modern programming languages now support OOP.

Font: Wikipedia

Object Orientation Main Features

  • Class

Defines the abstract characteristics of a thing (object), including the thing's characteristics (its attributes, fields or properties) and the thing's behaviors (the things it can do, or methods, operations or features).

  • Object

A pattern (exemplar) of a class.

  • Instance

One can have an instance of a class or a particular object. The instance is the actual object created at runtime.

  • Inheritance

'Subclasses' are more specialized versions of a class, which inherit attributes and behaviors from their parent classes, and can introduce their own.

  • Encapsulation

Encapsulation conceals the functional details of a class from objects that send messages to it.

  • Abstraction

Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.

  • Polymorphism

Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations.

  • Overriding

Overriding allows to change the functionality of the inherited methods. This is also known as the redefinition. Follow this blog - ABAP Objects: Overriding(Redefinition) for more information (Note: outside SDN link).

Check out these articles on how to use Class Editor for Refactoring:
Class Editor – Refactoring Assistant – I
Class Editor – Refactoring Assistant – II

Overriding is not possible for STATIC methods. Read more on Redefine Static Methods? for possible reasoning and solution.

  • Overloading
    Overloading allows to change the signature of the inherited methods in the subclasses. ABAP doesn't support Overloading. Only exception is the CONSTRUCTOR method. Since we can create CONSTRUCTOR method in each subclass, we can change the signature of this method.

Become a JAVAPER – is overloading possible in ABAP? shows a possibility to achieve Overloading alongwith similarities with Java.

  • Friends
    In any Object Oriented programming language, the access to private or protected components – both methods and attributes – would be prohibited. If someone try to access them, compiler would generate syntax error.

Sometimes, it would be advantageous to give the access to these protected and private attributes to other classes. This can be achieved using the FRIENDS addition.

Check these articles:
ABAP Objects Concepts – Friends
Forum Post: Friends classes

Object Orientation Advanced Features

  •  Narrowing Cast (Upcasting)

When we assign the instance of the Subclass back to the instance of the Superclass, than it is called the "Narrow Casting", because we are switching from a "More Specific view of an object" to "less specific view". Visit this blog - ABAP Objects: Narrowing Cast (Upcasting) for more information (Note: outside SDN link)

  • Widening Cast (Downcasting)

When we assign the instance of the Superclass to the Subclass, than it is called the Widening Cast, because we are moving to the "More Specific View" from the "Less specific view". Due to this reason it is also called the "Down Casting". Visit this blog - ABAP Objects: Widening Cast (Downcasting) for more information (Note: outside SDN link). 

Font: Wikipedia

Back to Top

Examples

...

Back to Top

Moderators of this WIKI section

Free Rice meals

  • Provide English vocabulary to everyone for free.
  • Help end world hunger by providing rice to hungry people for free.

For each word you get right, Free Rice donate 20 grains of rice through the UN World Food Program to help end hunger
 
Free RICE

Bibliography

Wikipedia

ABAP Objects: Narrowing Cast (Upcasting)
ABAP Objects: Widening Cast (Downcasting)
...

Object Orientation Book's
  • Scott Ambler, The Object Primer, SIGS Books & Multimedia (1996), ISBN: 1884842178
  • Grady Booch, Object Solutions: Managing the Object-Oriented Project, Addison-Wesley Pub Co (1995), ISBN: 0805305947
  • Martin Fowler, UML Distilled: Applying the Standard Object Modeling Language, Addison-Wesley Pub Co (1997), ISBN: 0201325632
  • Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Design Patterns. Elements of Reusable Object-Oriented Software, Addison-Wesley Pub Co (1998), ISBN: 0201634988
  • James Rumbaugh, OMT Insights: Perspectives on Modeling from the Journal of Object-Oriented Programming, Prentice Hall (1996), ISBN: 0138469652

2 Comments

  1. Unknown User (ephu2hg)

    Be aware that SAP have changed the Casting terminology in SAP 6.40>.

    See this hyperlink ">Version 7.0 ABAP Modification 6

    They have swapped around the terms Narrowing and Widening.

    This seems to make more sense  - looking UP the view gets Wider and looking DOWN the view gets Narrower.  (Well that is how I remember it).

    SAP now prefer you to use the unambiguous terms of UP and DOWN

    Here is the SAP HELP in a ECC6 system.Up Cast
    Also referred to as widening cast. Assignment between reference variables, where the static type of the target variables is similar or identical to the static type of the source variables

    Down cast
    Also called a narrowing cast, a down cast is an assignment between reference variables in which the type static type of the target variable more specific than the static type of the source variable. A down cast is only possible in assignments with the casting operator (?=) or MOVE ... ?TO. Compare with up cast

  2. Former Member

    Peter is Correct. Please modify the document to reflect this change. Else it will confuse the developers.