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…
ABAP Objects Concepts – 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…
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…
Class-based Exceptions I – Basics
Class based exceptions are realized based on the instances of the exception class. Lets explore them.
Class-based Exceptions II – Design Time consideration
In the series of the Class-Based exception raising & handling exceptions, today we’ll see design time considerations. Checkout all post related to Exception Raising & handling: Main classes All Exception classes are inherited from the global exception class’s CX_ROOT these subclasses: CX_STATIC_CHECK – If the exception is defined as a subclass of CX_STATIC_CHECK, it has…
Class based Exceptions III – Runtime flow
Lets continue exploring more about Class based exceptions by checking out the runtime flow when an exception is being raised. Checkout all post related to Exception Raising & handling: Flow .. with code lines To understand it better we’ll use the demo example of Class-based Exceptions I – Basics. I have given the related code…
Class based Exceptions IV – CLEANUP
In the series of Class based Exceptions, lets check out the addition CLEANUP within the TRY..ENDTRY block. Checkout all post related to Exception Raising & handling: TRY .. ENDTRY block also should have a CLEANUP block. This code block should contain cleaning up activity before leaving the TRY .. ENDTRY block. This block would gets…
Become a JAVAPER – is overloading possible in ABAP?
We all know it is a lie, but I will try to prove there are huge similarities b/w both languages in this matter, which eventually can form opinion that overloading in ABAP is possible. What Java says In Java overloading is very common and useful. Within one class you can have same named methods…
Override (Redefine) Static Method?
We all know that we can’t redefine Static Method. We’ll try to explore the reasoning and alternatives to achieve the similar behavior.
Abstract Class vs Interface – Which to use when?
Abstract Class and Interface – both has there own usages. Lets explore when to use which in ABAP while developing an application in SAP.
When to use Local Class and when not to!
In SAP ABAP, we can create Local Class as well as Global Classes in class builder. We can create them in the class builder as well. Lets see when it is OK to use Local Class and when we should refrain using it. What is Local Class Local classes are defined within an ABAP program….
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….
Become a JAVAPER – “overriding” an attribute
Recently I have discovered very interesting feature in Java. Below I will try to compare this with what ABAP can do about it. Quick jump in Overriding a method in ABAP and Java is simple. In the former we use REDEFINITION keyword in a subclass, in the latter we rewrite method with the same signature…
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…