Why C/C++ Is My One True Love

At least within the category programming languages…


I love to program…

I love to create something, out of typing text…

I love to make physical things do stuff, just by typing text…


TL;DR; It makes me feel like an old man, when I hack away in node.js or try any of the new languages… And just wish I had chosen good ol' trusty and speedy C/C++…


I am not particularly picky, when it comes to programming languages. If I know the language and I can do what I need to do, with a reasonable result, I’m pretty happy.

There are programming languages I don’t know and programming languages I wish I didn’t knew… But mostly, I just enjoy being able to create by writing.

One (actually two) language(s) has always fascinated me though… And that is C and C++.

I don’t really differentiate the two too much - maybe it’s because I don’t know enough C++. But I use C++ as the easier version of C, which will let me do C stuff, just a bit faster and easier…

The fascination…

It started very early on, when I got Linux up and running on an old 486.

I started compiling code to set up a dialup router and quickly realized I could “command” my Nokia 3210 through Gnokii… If I could just…

So I started altering lines that I partly understood, compiled and tested what had happened. It was amazing!

Then I started reading about C/C++, Makefile, compile optimisation, etc., etc…

Then the fascination left… Just as quickly as it had appeared…

Too many lovers

I had already been typing a lot of BASIC on my ZX Spectrum and Amstrad. But the powers and beauty of C/C++ had left with a hunger for more!

So after my fling with C/C++, I have met and had smaller og bigger love/hate relationships with Bash, Perl, Java, JSP, VB, VBS, ASP, PHP, Python, Lua, JavaScript and of course the markup stuff: CSS, HTML, DHTML, xHTML, XML, JSON, Whatever…

But I always kept coming back for more of that sweet, juicy compiled C/C++ love…

~7.847.153 lines of PHP later…

At some point I started a cozy relationship with PHP and kinda got stuck there… Too comfortable to leave I guess…

Lucky for me, this would turn out to be what connected me with C/C++ again…

I started playing around with compiled versions of some PHP functions and that was the start of a beautiful longterm relationship with C/C++!

Write once, run anywhere

The cruel joke from SUN, had left me wanting a language that could deliver what SUN had promised, but failed to deliver.

I even tried several Python tricks to create Windows native-like programs with QT - not fun!..

What C/C++ gave me though, was the ability to develop on my laptop, compile and copy to any of the servers I had access to!!! No problems - no bugs because of missing libraries, wrong VM versions or lengthy install procedures!

To me it felt like the closest I would ever get to writing once and running anywhere… If the binary didn’t actually work on one platform, I could just compile for that platform, maybe with a couple of extra lines in my code… Awesome!

I know this is very much, because I usually write *NIX/BSD server software and try to forget that broken window OS, I can hardly remember the name of… ;)

More power to me

As a lot of software and libraries has been written in C/C++ over the years, the lack of abstraction and need to keep your head on straight is compensated by the vast amounts of available code, libraries and open source code bases - of course ranging from extremely well though out to WTF!?!?!

I haven’t even mentioned one of my biggest passions: SPEED!!! C is the benchmark for all other languages (except machine code and assembly) - you can do fancy tricks and stuff to make other languages a bit faster on some point, but in general you won’t be able to compete with C…

The language has roots way back in 1969!.. It has had ~45 years to mature!

But even more interesting is the stability of the language, which has also made it a fine choice for embedded computers!

Go get an Arduino or the likes and you can “easily” port your small helper and utility functions, if somebody hasn’t written a JSON parser or whatever you need.

Which other language can do all of that?

I won’t say I don’t hate bugs caused by pointer mistakes… And I really dislike slow compilation times, when projects becomes large…

But then again… I REALLY dislike writing the same code in several languages! I REALLY dislike finding bugs in code I cannot fix or replace, like node.js, VB, VB.Net, Java, PHP, Python, etc…

Also… Slow compilation times can be eliminated something like 90% of the time, just by writing and testing the code as a separate project…

It makes me feel like an old man, when I hack away in node.js or try any of the new languages… And just wish I had chosen good ol' trusty and speedy C/C++…


This was just my thoughts - not an attempt at starting a language flame war… But feel free to share your own language love or other thoughts here:

Discuss @ HN

 
152
Kudos
 
152
Kudos

Read this next

Programming made easy - not just for kids

We need to make a bigger effort, making programming easier. There is a lot of effort going into making development easier for kids… Well… How about making it easier for everybody? I see myself as a seasoned developer, but I... Continue →