Tag Archives | computer programming

The programmer’s victory dance

One of my specialties is taking ancient Clipper DOS-based database programs and drag them kicking and screaming into Windows. One way of doing this is by using open source xHarbour, which converts Clipper into a console app. It looks like the DOS app but is Windows. This is all that some clients want or need.

xHarbour is 99.999% compatiable with Clipper. I just solved a truly arcane problem dealing with that other 0.001%. Who knew that CTRL-W is generally CHR(23) but can also be CHR(535) and that they act differently in xHarbour than in Clipper? I sure didn’t. Or that I’d need to use the obscure READKILL function to make a particular module work.

This was the type of programming where you look at the code for several hours then change two lines of code and it works.

And now I do the programmer’s victory dance!

Continue Reading

Varieties of bad computer programming code I’ve encountered

"Spaghetti Code". Sculpture by George W Hart

I convert dinosaur DOS database applications to Windows and thus get to look at far too much bad code. Here are examples from ancient Clipper and FoxDOS but they apply to other languages too.

Too clever by far.
Hey, lets grab data from multiple tables and stuff it into 3-D arrays. I mean, aCustomer[12,3,4] = aSales[2,9,16] is just a freaking model of clarity, isn’t it? This is also known as job security, except maybe even you won’t be able to understand your own code 6 months later.

Everything should be a method or a function.
@ 5, 5 say Hello()+World(). It’s important to scatter the functions through various source code files, making them hard to find and thus requiring the use of a text editor that can search multiple files at once.

Bonus points for using macros so the name of the function being called isn’t obvious and requires detective work to discover, like defining it using a PUBLIC variable eight levels up. As in dosomething = “Hello(), then 1500 lines of code later, @ 5, 5 &dosomething.

Straight line coding.
Screw methods and functions. Put everything in one source code file. This lends itself to having insane programming constructs like IF-THEN statements embedded ten levels deep with an assortment of embedded CASE statements tossed in too.

Needs to find another profession.
Open multiple data files. Refer to them by work area number not name. Call a function which closes all the data files then opens them using different work area numbers. Repeat as needed until the code is incomprehensible.

Continue Reading

Powered by WordPress. Designed by WooThemes