5 Ways to Improve the Readability of Your ABAP Code Part II. - Avoid Magic Numbers

Overview

After showing you the real benefits of using meaningful names, I want to share you another useful tip that can help you to improve the readability of your code. Usually, it's not advisable to use many hard-coded values in your source code, but there are cases when you need them. For example, you want to calculate the total working hours of a month, based on the working days, using the following formula:

total_working_hours = working_days * 8.

5 Ways to Improve the Readability of Your ABAP Code Part I. - Using Meaningful Names

Overview

Today, I'm going to start a new series of posts about improving the readability of your code. In this post series, I will share you my top 5 approaches that can help to make your and your colleagues' life easier.

In the past, I have seen many-many ABAP source codes with the lack of readability. These coders usually choose poor names for their programs, classes, methods, subroutines, function modules, variables, and so on, which makes their own and our business more complicated.

I know that in ABAP, we are a bit limited in the length of the identifiers, but usually we have enough characters to express our thoughts (depending on the type of the indentifiers). I don't think it belongs only to these length limitations, I think it's more about your exactitude. Don't be afraid using meaningful names!