Thursday, May 03, 2007

Cutting and Pasting -- Part 1

When I first started developing applications, back in the days of COBOL and green screen monitors, one of the things that we did quite often was use other applications as templates. COBOL, in case you didn't know, is one of those older languages responsible for the Y2K rush in the late 20th century. By templates, I mean that we cut and pasted chunks of other applications into our own so that we wouldn't have to type it all over again. Does this seem familiar?

Cutting and pasting is as old as developing applications itself. Even farther back I remember reusing punch cards from other applications so I wouldn't have to wait in line at the card punch machine for my turn. ( I gambled by not putting sequence numbers on my cards, allowing them to be reused at a later date. Boy, I lived on the edge in those days.)

There is a problem with this sort of programming, however, as it has a tendency of hiding many of the complexities that programmers need to understand in order to create better applications.

For instance, what would happen if you copied some code from another application, but the code was poorly designed or performed poorly. You would be propagating that "bad code". If people copied your application they would be doing future programmers the same disservice by arbitrarily inserting code, which they do not understand and which is fundamentally not the right code to copy, into their applications for future generations to debug.

Now, I'm not saying that you need to write every line of code over and over again, but I am saying you need to understand what you are cutting and pasting. Just because it works, doesn't mean you should necessarily copy it. You need to understand what you are doing. Blindly following someone else's lead without truly understanding is one of the reasons why Sanjaya Malakar got as far as he did.

No comments: