Skip to Content

Code Smells can help to find code problems early.

For basic Information you can look here:

http://en.wikipedia.org/wiki/Code_smell or http://www.codinghorror.com/blog/2006/05/code-smells.html.

The idea is to identify typical ABAP Code Smells. The aim is of course to find bad code as soon as possible.

!I invite all ABAP Developers that figured out smelling to code to add your Code Smell to the following list!

List of ABAP Code Smells

Aliases

The possibility to create aliases is an ABAP speciality. The APAB construct with the ‘~’ (CLASSNAME~INTERFACECOMPONENT) does only exist in ABAP.

In Java e. g., if a class implements an interface it inherits the interface members directly with the origin name.

Indications

Often this smell indicates the problem that the caller of the class uses the object typed too concrete.

Problems

Renaming of an Interface Method or attribute Name mostly causes the need of renaming the aliases, too.

Wasting time while maintainig the aliases.

Solution

Use the object in reduced interface sight! This step leads to the worthwhile approach of loose coupling of classes by using objects as generic as possible.

Then any aliases get pointless.

Example

ABAP Code Smell Example.jpg

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply