Sunday, February 17, 2013

The C Programming Language

I suppose it was inevitable, but my path into the world of programming has led to to C. C might be the most famous of all programming languages. I can't actually tell you why that is the case, but in my experience it has been true. Just as well known as Java (by known I mean people recognize the name) and C++, and far ahead of languages like Python or Ruby or ML, C predates them all.

There's a reason C survived all these new languages, but I have yet to find it. As my computer science professor explained, C is like learning to drive a stick-shift car. It's very difficult to learn and people will laugh at you for not using an automatic, but it allows you to do much more with your knowledge and makes you appreciate the car more. The problem with that analogy, for me at least: I learned to drive on a stick shift, and it didn't take me nearly as much time to learn that as it has for me to learn C.

After learning to Program with a very "clean" (my own quotes) language in Haskell, and then a very English-friendly language in Python, learning C has been an adventure. I imagine myself as an explorer in the heart of Africa, paving new paths and meeting new people, always confused and amazed by their customs and constantly pondering how they are able to survive with such "primitive" methods. Just as those people were probably racist, I feel I am language-ist for thinking such thoughts. But I cannot see the need for the jungle of semicolons and curly brackets. My progressive programming languages had no need for such strange and unneeded grammar. But C does.

Harnessing C is difficult, and I am nowhere near where I should be. I spent a good 5 hours today trying to make my program read a file in 1 MB chunks instead of the whole thing at once. But it now works, and I think I'm a better programmer as a result. If learning Python was easy mode and Haskell hard mode, C would be god mode.

The thing I've found with C is that I improve much faster than I have with any other language. I wonder if that's because of the pace of the class (absurdly fast) or because the language just works like that. C is a stressful and complicated language, and I think working for 10-12 hours on "simple" programs trains your brain to deal with it better and faster next time. Somehow, being forced to solve a problem in C is training me to solve problems better and faster than any other language I have experience with. Also C programs run fast. If Haskell and Python were planes, C would be the Starship Enterprise. Not only are the file sizes smaller, but they just run faster. Significantly faster. And I can definitely appreciate that.

Lastly, I need to rant here for a bit. The big problem with teaching C in the modern day is Google. Google is the place to go for programming help. Need to know how to parse something in Haskell. Quick google search gets you the function you need. Need to know how to work with URLs in Python? Google that shit. Need to know how to do anything in C? Nope. Because of languages like C++ and C#, searching for any C code on the internet is a giant pain in the butt. Everybody tries to give you C++ code, and while the languages are similar they are different enough that the code will not work. Conversations I've had with some people all seem to lead to the same conclusion: C is used by programmers who do not need help from the internet, so they don't put anything on the internet. It may be true that C is at a level beyond that of the average programmer (if such a being exists), but I'd really appreciate it if Google could give me some answers every now and then (yes, I know about Stack Overflow).

No comments:

Post a Comment