Abap

Readability – In New ABAP context

A program is written may be once and it read multiple times. How often we have read other people’s code and cursed them. With old ABAP, readability was often compromised for performance but with HANA speed, readability should get now the importance it deserves.

In this blog, we are looking improvement in readability using new SAP offerings:

Use of CDS:

Use of CDS can be a powerful tool to improve readability and testing both. Make sure you write CDS only when table select cannot do the job. With CDS, we can push a lot of computation and logic to database and make the code look simpler.

Inline data declaration:

I think it not only improves readability but also helps writing faster code. Win-Win. You may still choose to declare variables in the top include and they are fine. Other exception can be, inline declaration can be avoided if the variable is declared in condition (IF.. ELSE block or within CASE statement). I think in this case, it is better to declare the variable using DATA statement at top of the program or subroutine/method.

Cut the subroutine or method to a manageable length

I am adding this point because in past, without HANA, developers have created mammoth subroutines or function to avoid an additional loop or select. Now, we should really not compromise readability for performance except where program output is time critical.

In next blog, we will talk about Testability.

If you like content of this blog, please do let us know by dropping a comment or following us on our LinkedIn page.

Leave a Reply

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

Follow by Email
Twitter
LinkedIn
LinkedIn
Share