Categories: ABAP, Development/Programming, Ideas/Insights, Workplace

Classy headings in your code with ASCII art

Sometimes source code modules get very big. You can argue that this should never be the case, if you modularize your code properly, but the fact is that they do. And when they do, they sometimes become difficult to read.To make the code more readable, we add headings. There are numerous conventions to add comments to code so that you can easily see where a new section begins. In ABAP, it is common to use a line of dashes or asterisks, and sometimes a block of comments will be surrounded by such lines so they are easily spotted. (In fact, if you type “*–” or “***” in an ABAP editor at the beginning of a line, the keyword completion will offer to complete the line with such comments).

However, sometimes pieces of code get very long so that you end up having sections and subsections, all of which can be difficult to tell apart, especially once you end up lining your comments with rows of asterisks or dashes.

Here though, is a very nice way, if you have enormous blocks of code, to make them really stand out. You can generate a piece of ASCII art using an extremely handy site that lets you input a piece of text and select a font (really a style), amongst other settings, and then spits out your words in ASCII art. The site is hosted here:

The following code, for example, is adorned with the “ogre” font from the given site:

Using this technique, you can separate long sections of code with such attractive comment headings that are easy to find.

Article info

Leave a Reply

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