Refactoring RPG on the Power i
What is Refactoring and Why Do It?
Referring to something as a “dinosaur” is a pejorative adjective meant to characterize as obsolete, or inflexible to the point of extinction. Paleontologists claim that dinosaurs roamed the earth for over 160 million years and their extinction was caused by an asteroid hitting the earth. A reign of 160 million years is hardly inflexible; in fact it is an astounding success. I would say that the asteroid hitting the earth was a fortuitous event for us mammals. In post-cataclysmic earth, mammals were better suited for survival than the dinosaurs. The real trick is to survive the disaster.
Here is the point where you are supposed to ask “what do you mean by refactor?”
In the java world you will hear the term “code refactoring” frequently. With the quick pace of technology changes that plague the java world, a way had to be found for abandoning last years solution (deprecated) and embracing this years newer, better way of solving the same problem. The practice of code refactoring is an established software engineering approach for keeping source code up-to-date. Never heard of code refactoring? OK. Stop reading this article and google “code refactoring”. You got over 2 million hits, right? Now look up “code refactoring” in wikipedia and read the first couple paragraphs that describe it. STOP! Now come back to this article.
How is refactored code any better? For one thing, you don’t have to remember all those antiquated RPG III coding techniques, you just have to keep up with the new stuff. The refactored code will start to look like all the other [modern] programming languages out there. Continually refactoring code provides an opportunity to implement coding standards. Once you get rid of the MOVE’s, Z-ADD’s, and other highly proprietary opcodes the code may even begin to look “portable.” The result is more people will be able to read the code (understandability) making it more maintainable. It will be easier to take advantage of newer opcodes and programming techniques.
OK, that was the Refactoring RPG sales pitch. Now let’s get into the practical application.