Tuesday, January 08, 2008

How I've learnt programming

The first time I heard of the C language was through my brother's schoolwork he had been given for one of his programming classes. Before which, all I ever knew was BASIC, which was I had a bit of a resentment for, because it could only work in computers that had the interpreter, rather than a fully independent executable program that could run autonomously in an operating environment.

What I wanted something that I could 'write once, and work everywhere' executable, i.e. in compiled binary form, which in those days, meant anything that could execute on DOS natively. Java would have failed my criteria terribly!

You could hardly blame me for having an awfully backwards view about computers in my younger years: I had never even seen an Apple Macintosh, or knew what was a PDP-11, UNIX or any other computer systems. The word 'computer' was unanimously equivalent to the 8086 architecture, and anything outside of it was regarded as a bizarre mistake. That notion got stuck for a long time, even after learning a bit more of UNIX and using more advanced processors like the Motorola 68000 series loaded with HP-UX for my CAD/CAM lessons.

BASIC was fine and dandy itself, but just not a language that an elite 'hacker' would use. I was rather enamored by the idea of becoming one, after getting pwned by a virus for the first time in my life. It was one of those prank 'keypress' viruses, which traps the keyboard interrupt to generate false keyevents of the keys you pressed at random intervals, causing you to believe that a key on your keyboard got stuck.

It was only after a long as 2 years later, after I junked the old Wang IBM-compatible, that I had learnt enough to realise that. My brother and mom never did though, and had always unfairly blamed the guy who sold us the salvaged equipment left over from Wang Corporation's bankruptcy.
Anyway, a big 'Damn You' to the author of 'keypress'! I'm sure with the pervasiveness of the Internet, you'll get to read this message and know that the prank you wrote is not funny!
Computer viruses were the 'in' or 'l33t' (hackerspeak for elite) things to do, and they were mostly written for gaining fame (or notoriety), unlike today where it is more driven towards commercial gain. Either way, viruses are destructive, the only difference being it was just senselessly destructive in the past. The most famous of those era, was probably the 'Stone' virus, which resided on the boot sector of the floppy disk. It had a pretty nasty payload, often overwriting the boot sector with junk past the trigger date. Barring a reformat of the disk, or a restoration of the boot sector (if someone had the knowledge to do so), the computer is rendered useless whenever the virus struck.

By the time my brother got into a polytechnic, he had 'required' a 'real' computer to work on, which I've always maintained that it was just an excuse, because of my observations, whether fairly or not, he's spent most of his time on just playing computer games. Anyway, it was to our good fortune that we've managed to get our second computer for free, from a friend of mom's, whose son had just recently upgraded to a new 16Mhz 386SX from his old 4Mhz 286 machine.

While old, it was a pretty functional machine. And the good news was, the machine had a CGA display, and hence colour capable, which made it well qualified for game playing. So most of the time, I would see the screen of 'Romance of the 3 Kingdoms' whenever my brother was at the computer desk.

The computer also had a copy of Borland's Turbo-C compiler in it, which was the original intent for the gift. But my brother wasn't terribly interested in programming, so it was hardly common to see him fire that bluish-green coloured IDE environment until he was pressed to, like when there the deadline for his assignments were closing. But because he had the 'right excuse' for legitimate access to the computer, I was relegated to only using the it only whenever he was not around.

So between the multiple fights we had over the use for the computer, it was fortunate since secondary school sessions were only half a day, I would get my chance to mess around with it while he was out during the mornings before my classes start.

That was when I got my first chance of getting my hands on a C programming book as well. Problem was, the book belonged to my brother, and he didn't like to share anything with me when we were young, so touching his books were way out of the question. But I kept doing it anyway, in secret. However, because I had really sweaty palms, my 'stealthy' accesses to his book were easily discovered: at the end of the year, his book was just in a rather rotten state, after soaking it with my palm sweat! (I'll take it that he did have a good reason for not letting me touch his books!)

Anyway, I remembered the excitement for compiling my very first C application, which I started out from without knowing any syntax, to peering over my brother's shoulders to learn enough about '#include <stdio.h>', 'if', 'else', 'printf()' and 'gets()'. At around the same time while doing that, I started having those delusions of grandeur, of the idea of writing an 'zork'-like RPG clone of the game, although it soon became obvious that my design wasn't going anywhere, given that writing countless 'if-else' statements for all the possible branches got tiring after a while. I also remembered how unimpressed I was about C, that for a supposedly advanced language, it didn't even have constructs like the 'GOTO statement'! (Edsger Dijkstra, eat your heart out!)

By the time I attended polytechnic myself, I was self-taught enough that I was already proficient at all those rudimentary programming concepts, so those programming assignments and exams were a breeze. Those days, I was able to maintain an illusion of scoring well without making any apparent effort at all, so some friends of mine thought it was just a matter of genius. But of course, the truth was far from it. It was all a matter of interest at play.

So that is why I largely do not believe in innate geniuses, but more in persistence and hard work. Because if you become good at whatever you're doing, you're automatically a 'talent', and that's irregardless of you're a fast or a slow learner, or whether if whatever you're doing is sexy/fun/cool or not, and it's irrespective of whether if others recognize you for whatever you're good at. What matters, is that you enjoy doing it.

Hard work is often less hard when you are sufficiently interested, and it was probably extremely lucky for me that I had found what I've enjoyed much earlier than most people. Knowing myself, I probably would have never been able to keep my motivation up for doing anything that I'm not interested in. So in all sense of the word, I should be considered lazy more than anything else.

Personally, I have met and is impressed by a number of people who have a remarkable ability to persevere, and to be 'successful' at studying or whatever drastically boring things they are doing out of necessity rather than interest, but I'm could have never been one of them. If I had to be forced to study to become a doctor or a lawyer, like all Asian parents aspire their kids to (which is dreadful advice, unless your it's of your own consented, informed choice), I would probably have fared pretty badly, and probably ended up hating my life.

Programming became a profession driven by interest, and because it is a passion, one's more willing to spend 14 hours a day at it, because he/she feels that it's fun, rather than because it is a means of paying your bills. It is just a good bonus if people are willing to pay for what you like to do.

But before anyone start seeing things through rosy-tinted lenses, I should qualify that, even with interest, in reality, most programming jobs will involved in writing code or solving problems that you are inherently not interested in. Which is why I'm always seeking to have financial self-sufficiency, so that you'll ultimately have enough to never have to worry about going hungry while doing something you love.

So what about you? Are you out there doing something you love as well?


LLC Operating Agreement said...

Your story sounds really similar to mine. I had an older brother (who played a lot video games). My first programming was in college though, but it was with the C compiler. I was never really into basic, but I did have a Assembly kick for awhile. Life changes to me away from computers for awhile, but I got right back into them and I enjoy PHP & AJAX now.

Vincent Liu said...

Guess I wasn't alone with the brother who liked games then!

To be honest, I was quite engrossed with games when I was younger myself, in fact probably more than my brother, so in this case it's a matter of the pot calling the kettle black!

My only saving grace is that I'm just more into programming than he is, which I'm still enjoying now.

Ah, assembly, it was something that I was quite into at the time too, with all that 'MOV AX, BX', 'INT 13h' and 'INT 21h' and such, but later moved on to programming 68000 microcontroller instead.

Yeah, those were the good old days!

Post a Comment