Issue #8 - January 2001

Power Coding

By QbProgger <qbprogger@tekscode.com>

Quick Tips

Ever wanted to learn the secrets of a power programmer? Yes of course!

This column is an introduction to power coding, and it covers making your code just a little bit cleaner for everyone to understand and read. After all, the most important thing about a program is that the function is understandable not only to the programmer, but the user as well!

Topic 1 - Simplifying your main module

The only thing you should have in your main module are SUB Declarations, an init call, a simple game loop, and then a deinit call.

For example:

DECLARE SUB blalbhalh
DECLARE SUB blalbhalh
DECLARE SUB blalbhalh
DECLARE SUB blalbhalh
DECLARE SUB blalbhalh


    WAIT &H3da,8
LOOP UNTIL GameQuit = 1



This makes your main module readable and understandable. You should never bloat up your main module with arrays and data filling. Do that in Init fer chrissakes. Also, with this setup, you need not modify the main module, only the subs called from the main module.

Topic 2 - Making common sense SUB's.

Don't make a SUB with a useless function. Make SUBs that explain what they do just by the name.

For example:

Sub ConvertXYToVector

End Sub

You can understand what that SUB does without even looking at it. Don't make a SUB called ConvertZtoTheta and then it just prints out a menu. This is confusing and makes it hard for people to read and understand your code! Make your code readable at all costs!