things done
July 12th, 2006 by Lawrence David
it’s been a good summer so far. i’ve already done 2 of the 27 things i’ve hoped to do in my life.
the first was #23: backpacking for at least 2 weeks in a foreign country. check.
the second has been #16: learn c. i finally took care of this one last week.
not knowing c has been a real mark of shame for me over the past couple of months. i mean, here i am getting a degree in computation and i don’t even know one of the most famous computer languages in the world. what kind of programmer was i?
i’ve settled on an analogy to explain to non-programmers what it’s like to not know c: it’s like a rap artist not knowing how to freestyle. freestyling, like any improvisational art, isn’t easy. of course, a rapper recording a record doesn’t need to flex any freestyling skills – that’s what his/her crazy-ass lyrics are for. similarly, c, due to its crazy syntax and requirement that programmers think about wacky things like memory allocation, is less than straightforward. most programmers nowadays don’t seem to need c. for example, there are a bunch of other languages which are either much easier to learn (like python), nearly as powerful but less ornery than c (like java), or often just more convenient (like perl). [mind you, i'm certainly not an authority on programming - i just haven't had a hard time coming up with excuses as to why i could avoid writing programs in c.]
to finish my analogy: although a rapper need not be able to freestyle, freestyling’s difficulty makes it a hardcore skill. and isn’t being hardcore what rapping is all about? likewise, i’ve always considered people who can decipher c’s obfuscated code to be hardcore. (apparently, i’m not alone: 1, 2.) and therefore, since i didn’t know c, i wasn’t hardcore. so uncool.
well, last week, that all changed. my putative thesis took a wild new turn and forced me to, instead of writing my own program, modify someone elses. and, (gasp!), that other program was written entirely in c.
as usual, in the case of most dreaded scenarios, it turned out that learning c wasn’t nearly as difficult as i had psyched myself into believing. all it took was 2 good textbooks and about 36 hours of patience.
epilogue: do i feel like a better person for knowing c? sadly enough, i actually do. not so much for being able to add another language to my cv. but more for that general mushy feeling you get when you’ve motivated yourself to do something that you’ve avoided for quite some time.
[so i tried to find a suitable graphic for this post by searching for the string "hardcore" in google images ... good god some girls have humongous boobs. they were like giant tumors!]
Welcome to the first level of hardcore =) The next level requires that you spend several days looking for a memory leak, or figuring out why your program crashes, but only occasionally, only to find out that it’s because, once in a thousand times, you write into memory that’s already been freed, or your string isn’t properly terminated.
[Actually, I hope you're spared that next level of hardcore. It doesn't do much for you except convince you to use languages with built-in memory management whenever possible =)]
what always got me in c, was tying to remeber the proper way to pass pointers, it took me weeks to finally figure it out.
also, dynamic array memory allocation, man what a pain in the ass.
-Andrew