5 Ways to Improve the Readability of Your ABAP Code Part V. - The Proper Use of Comments


In the last few posts we have talked about why to use meaningful identifier names, why to avoid magic numbers, the benefits of organizing our code with functions, and the role of formatting

Now, I want to talk about the last part of my readability puzzle, the comments.

Comments serve as annotations in our source code, usually we leave these kind of notes to make ourselves and the others remember what the given portion code is actually doing.

However there are cases when these notes creates misunderstandings, for example when it's not up to date with the associated code.

5 Ways to Improve the Readability of Your ABAP Code Part IV. - Formatting Does Matter


First of all Happy and Successful New Year to my dear readers! I hope you all had a great holiday with your family, could relax a bit, and you are ready to improve further our ABAP coding style.

I skipped two weeks of writting posts, because I didn't want to bother you with boring ABAP codes during the holidays, but today we are going to continue our work. Let me refresh what we learn until now!

In the previous posts we talked about using meaningful identifier names, why to avoid magic numbers, and the benefits of organizing our code with functions. As you have experienced, these methods require more time to invest (choosing the best identifier name, how to structure the code with functions, and so on), but at the end it pays off multiple times.

5 Ways to Improve the Readability of Your ABAP Code Part III. - Organizing with Functions


In the last two blog posts, I have showed you the benefits of using meaningful names and avoiding magic numbers. As I told you, it really does matter how readable your code is.

In the last few days, I was thinking a lot about the WHYs, why many-many developers write their source code with poor readability and transparency:

  • faster development => okay, it can be faster in the first few iterations, but then the development time increases largely, when the lines of the source code hits a certain numbers,
  • hiding information => it's my program! I don't want anybody to understand it! I want to keep that information! It's ok, but you are going to hide that info from yourself also, since a year later you won't understand neither,
  • laziness => I have no explanation :)

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


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


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!