Saturday, October 28, 2006

Why Maintaining Code Sucks

At my job, one of the things that I have to do is some RPG (some 3, some ILE, some a mixture of both) since I actually know some RPG. The program that I'm working on right now was created back in 2002. Yes, they still coded in RPG in 2002. And in 2006. *sigh*.

Anyway, looking over this code reminds me why I hated RPG in school. RPG is already confusing in the first place with it's many restrictions as a fixed-field programming language (everything has a specific column it must appear in, and can only be X characters long depending on the column), but it gets worse when you start mixing syntax from one generation of RPG to another.

As an example, FOR Loops appear in two different styles:

Style 1
VARA ORNE 'OtherStuff'

Style 2
IF VARA <> 'Stuff'
or VARA <> 'OtherStuff'

Let's pick a standard and stick with it people! You're updating sections of code already, why not fix the FOR loops?

Variable Naming/Comments
The other thing that stinks about RPG is that your variable names can only be a certain length. Therefore you end up with very heavily abbreviated code names (and the dreaded 'A' as an counter variable). You are then forced to rely on comments. I love commented code, even if the code itself is nice and to the point with proper variable names. I hate when someone puts in comments, something gets updated, and the comments don't reflect the change. A confusing language's readability hinges on good commenting, and it really wastes time when the comments are wrong.

I also am programming currently in the Source Entry Utility on the iSeries. It's like being in DOS in respect to the screen resolution for the terminal. I have learned that there is an IDE that we can use, and I will be asking for it. I'm a modern programmer, give me at least Notepad. At least it supports more than 80x25 resolution.

No comments: