Personal Opinion: Why C++?

There’s been some discussion more recently about a pervasive question: “why C++?” People have argued over the merits of the language itself, and its key differentiating qualities. In brief, as I view them, those qualities are:

  • Control
  • Speed
  • (Some degree of) portability

Other considerations are, in my opinion, missing the mark. Through the lingua franca of C almost any piece of code can be coupled up to almost any other piece of code. “There’s already a world of things written in C++” doesn’t fly in my book. I use C libraries from Ruby all the time. I use C++ runtimes from Ruby all the time.

So then why would I stand up to defend C++?

I like C++.

I like the control, the speed, the syntax. In my day job I am usually slave to a half-dozen languages. Ruby, JavaScript, Java, Objective-C, Python, plus a small cloud of satellite languages such as Haml, CoffeeScript, and so on.

But if I had infinite time to develop software, if there were no deadlines, I’d pick C++. To me, eking more performance out of the same chip is exciting. To me, having an iron-fisted control over the execution and type system is fun.

And I say these things as a reasonably accomplished Rubyist. I grok duck-typing. I say these things as a reasonably accomplished Objective-C programmer. I grok black-box OOP (note: if you don’t know what I mean by that, ask me – it’s a fun topic I could talk about if you want, 314).

Is it wrong that some days there’s just a pure joy in coding up something in C++? No. In some cases the very weaknesses of C++ become inherent strengths. When you need the speed without compromising on the additional eloquence of object-oriented programming, when you need the little extra metal, C++ can be a very powerful tool.

I’ll always like C++. Despite the pain and frustration it sometimes gives me, there’s still that simple addictive quality to it. I don’t program because it’s easy, I program because it’s hard. And C++ is harder, and as many know, that makes it more fun.

I like C++ because it’s fun.

The Case of the Leaky Pool

It always has to happen right before your system administrator leaves on vacation. The game is set, the stakes are high, and nobody is willing to fold. It was at a time like this that the Java Virtual Machine (JVM) on our second production server was discovered to be leaking memory like a gangster leaking blood in the Valentine’s Day Massacre. Unlike the mafiosos in Chicago, we couldn’t figure out why our JVM was bleeding.

Continue reading

SSH Through an Intermediate Host

Today I learned how to SSH to a host through an intermediate host. This is highly useful because the two production application servers I deploy to are chilling behind a crazy private-cloud jail. We have to SSH to a machine which acts as a bridge between the corporate cloud and the developer’s machine. (For those curious, this bridge host is restricted to only be accessible via the corporate network as well).

Continue reading

Git Out of Branching

I was happily coding along. I had a feature branch, I had been banging my head on the desk for what seems eons because of D3JS. It’s different from anything else I’ve ever used, so of course it was difficult. But then something of a mistake happened, and the page showed exactly what I wanted in the first place. A fait accompli, the feature complete, my job was done. Or rather it was just getting started. Or perhaps it was half-way over? You never can tell with these things. But it was time for that branch, epic-unicorn-farts, to be merged back into master. The mind cannot comprehend the beauty of the moment. I put on Samuel Barber’s Adagio for Strings — Angus Dei, just for the occasion.

Continue reading

Git Into Branching

Why has it taken me so long to realize this, 314? I have been languishing in the doldrums of change-phobic coding for a decade now, and then to see the breathtaking vista of a Better Way now? But there is only use in crying over spilled milk if you think that the government will recompense you – and nobody can give my lost time back to me! Therefore, 314, don’t make the same mistakes I made! Don’t! Learn to (ab)use branching now.

Continue reading

Templating Language Benchmarks on JRuby 1.7.0

Being performance nerd that I am, I have spent the time to use an off-the-shelf Rails app to benchmark three template languages against JRuby 1.7.0. I was particularly interested in this because I had heard rumor that my existing templating solution (Haml) was experiencing some issues on JRuby. Something about Array thrashing, it and the JVM Garbage Collector getting into a fistfight over the correct pronunciation of “generational memory semantics,” and various other obscenities that don’t really deserve much treatment. Rest assured, to the barely-coherent state of mind I was in at the time, it made sense. So I must verify! (tl;dr: there isn’t any problem with Haml on JRuby).

Continue reading

NSOutlineView Pitfall

Recently I’ve been poking around a fun little toy in Cocoa called NSOutlineView. You can get some really fancy stuff going on in there. I spent essentially two weeks learning to do drag and drop properly, but something always came up and bit the experience in the rear. My cells would re-arrange themselves during disclosure and selection events.

Continue reading