OO Design Patterns

Naimesh Patel | Last Updated on October 26, 2015

ABAP Object Design Patterns – Singleton

Today we will try to explore the design patterns in the ABAP Objects. We will start with the Singleton design pattern, which is the simplest of its family of design patterns. UPDATE:This blog post has been updated with clear example demo on 12/17/2009. So, there could be some comments which would be obsolete. What is…

ABAP Objects Design Patterns – Model View Controller (MVC) Part 1

Today we will discuss about the Design Pattern: Model-View-Controller, which is also very famous by its abbriviation MVC. By definition, MVC is to isolate the business logic from the User Interface which gives great degree of flexibility to change business logic independently to the user interface and vice versa. Basics of MVC In MVC, User…

ABAP Objects Design Patterns – Model View Controller (MVC) Part 2

In this post, we will see how we can implement the MVC (Model-View-Controller) design pattern in ABAP using the Objects. If you have not read the previous discussion about MVC: , than I strongly recommond to read that before moving forward. Demo Application To implement the MVC, we will create two applications – One will…

ABAP Objects Design Patterns – Model View Controller (MVC) Part 3

In this post, we will see how we can implement the Views which will access the Controller and model which is encapsulated in the controller. This post is in continuation of previous post: First Demo Application – ALV For our first Application view will be ALV output. To get the data for the ALV into…

ABAP Objects Design Patterns – Decorator

Decorator pattern gives us flexibility to extend the behavior of certain objects at runtime.

ABAP Objects Design Patterns – Factory Method

Factory Method design pattern could be most used design pattern in the modern world application. Factory method design pattern hides all the complexity of the instantiating an object from the consumer.

ABAP Objects Design Patterns – Observer

The intent behind the Observer Design Pattern is to define a dependecy between objects so that when main object changes its state, all the dependent objects are notified. Its upto the dependent objects to update themselves or ignore the notification. Design time consideration In the main object, AKA Subject, create a Event. Also add create…

Case Study: Observer Design Pattern Usage

Recently, at one of my client’s place, I have to design a screen with lot of ALVs. When I started designing, I didn’t pay much of the attention to the fact that there could be a dependency between main ALVs and other sub-ALVs. Later in the design phase, I understood that this is a great…

ABAP Objects Design Patterns – Abstract Factory

Abstract Pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes. Inherited subclasses of the abstract super class would know which of the objects are required. Concept Before jumping into the demo, lets see the concept. This will help us to better understand how Abstract Factory can be…

OO Design Pattern Decorator – Why do we need to use helper variable?

Recently, we have seen how we can achieve OO Design Pattern Decorator in ABAP using the inheritance tree. Achieving decorator seems to be little bit complex, but it gets easier as we get used with it. Problem As you can notice, in this example that we had to use the helper variable LO_PRE to retain…

ABAP Objects Design Patterns – Facade

Lets check out one of the simple and most used Design Patterns in Object oriented programming – Facade or Façade (Pronounce as /fəˈsɑːd/) in ABAP.

ABAP Objects Design Patterns – Adapter

Adapter design pattern, another widely used design pattern in the real world as well as the Object Oriented Programming language. Standard SAP developments build in OO ABAP also uses Adapter DP a lot. What is Adapter Adapter converts the objects which are incompatible due to the difference in the “Interface”. By implementing Adapter, we can…

ABAP Objects Design Patterns – Composite

Composite allows clients to access individual object and composition objects in uniform way. What is Composite? Clients needs to work with hierarchical collection of objects – both “Primitive” and “Composite” objects. Primitive (individual) objects processing would be handled differently than the Composition of the objects. So, we will compose a tree structure which would contain…

ABAP Objects Design Patterns – Iterator

Check out the Iterator design pattern implementation in ABAP Objects – another behavioral design pattern. What is an Iterator ? Iterator design pattern is to provide a way to access the underlying object collection without exposing the underlying representations. Iterator decouples the logic to access the collection of objects out of the Collection object itselft….

Iterator Design Pattern to access Linked List in ABAP Objects

In the previous post, you have seen how to implement Iterator design Pattern. It also raised the question about the usefulness in ABAP as in ABAP, you have Internal Tables. The ITAB can handle all type of collection of objects easily. So, lets try to go away from ITAB usage for this post to see…

ABAP Objects Design Patterns – Proxy

Proxy acts on behalf of some other objects. When working with Proxies, as name suggest, you work with another object rather than actual object. Lets checkout Proxy design pattern implementation in ABAP. What is a Proxy? Sometimes, you need to delay the instantiation of the object may be because its too costly to instantiate or…

ABAP Objects Design Patterns – Prototype

Prototype design pattern allows the flexibility to create itself – cloning. Lets check out, how to achieve this in ABAP objects. What is Prototype You have instantiated an object, called some operations. Your object is now in a state from which you wish to copy itself. In other words, you want to clone the object….

ABAP Objects Design Patterns – Singleton Factory

Combining the power of both design patterns: Singleton and Factory Method. Singleton produces the same object again where as Factory instantiates new object every time asked. Lets see how they both come together.. Background Few days back, I read the post on SDN – Factory Design Pattern. The post reminded me that I use the…

ABAP Object Oriented Approach for Reports – Initial Design

Many times, I see incorrect usage of ABAP Objects in custom development. In this two post blog series, I would show few incorrect designs and finally would show OO approach.

ABAP Object Oriented Approach for Reports – Redesign

In this post, I would show you a more flexible design using ABAP Objects. This design is to decouple logic, criteria, data display as much as possible.