A little perspective

I just dove into a small project that I decided could best be done using a set of C++ classes, and I’m beginning to think that I’m an idiot for trusting the language again. After several years of vanilla C and C#, and not much else in between except the occasional Perl hack, I’d forgotten what it was like to tread water in Bjarne’s fits-all boots.

Writing in C++ again is like making biscuits. But the simple baking procedure is preceded by growing the wheat, which entails clearing the farmland, digging a well, defending it against the native hordes, establishing irrigation and a working agrarian economy, buying a bunch of fertilizer, plowing the field behind a great big smelly ox, planting the seeds, waiting all winter while the wolves howl outside your cabin, THEN (buried amongst all the templatified, exception-safe and const-driven madness) writing a kernel of meaningful code. Wait, what was I doing? Building a tectonically secure infrastructure for feeding billions of people, or just making biscuits for breakfast?  It’s hard to remember after all that epic bullshit.

God, it almost makes me want to write in Java again.

I looked at Erlang for a while. I think that Armstrong’s book on it is one of the best language tutorials since K-and-R, but unfortunately I had no real /need/ for Erlang.  As soon as I find a worthy project I’ll probably use it.

I’m having fun with Python. I wish I’d listened to my friend Munch, who years ago said it was all he could stand. It has a charm to it, the same charm I had while hacking on some Windows Phone apps, when it was 1979 again and I was banging away on some BASIC that drew games on the screen. There’s a lot to be said for instant turnaround. My rule of thumb is that a build time over about ten minutes means that you’re dying by inches. Three seconds is about right.

We shouldn’t forget that this stuff is supposed to be fun.

This entry was posted in Uncategorized. Bookmark the permalink.

17 Responses to A little perspective

  1. Ville Vainio says:

    You should have tried Qt w/ that C++

  2. Karcaw says:

    Have you given Objective C a try for projects like this? Would it work out better or worse?

  3. Grout says:

    For apps, as opposed to writing libraries (which is just as you say), C++11 is much better. What was the project?

  4. landon says:

    @Grout: Agreed, C++11 makes things a lot nicer. I was writing the framework for an editor and decided to chug a bunch of the Koolaid. Blegghwhgll.

    • Grout says:

      You fell victim to one of the classic blunders. The most famous is: “The error message! Read the error message!!” But only slightly less well-known is: “Inside every small problem is a big problem trying to get out.”

      Seriously, though, the temptation to make C++ code more and more and more parameterized and generic and efficient in every corner case is an attractive nuisance. It’s like the History Eraser Button. They tell you not to push it, but of COURSE you do it….

  5. Barton says:

    C++ : an octopus made by nailing extra legs onto a dog. (from smalltalk.org by way of http://users.cms.caltech.edu/~mvanier/hacking/rants/scalable_computer_programming_languages.html).

  6. norse says:

    And to think that we manage to pay the folks who write GUI on top of Windows in C++ the same as he folks who write C# adsense logic.

  7. Karl Beecher says:

    Ville has a point. Qt makes dealing with C++ easier… and even a little fun.

  8. Alex says:

    You definetly need C++11

  9. DM says:

    How about F# or OCaml?

  10. Rik Hemsley says:

    Another vote for Qt. As you so beautifully described, it’s not really a good plan to try to use C++ to do anything without a large framework to build upon. This is just the same, of course, as if you wanted to use C# without .NET.

  11. Tomsci says:

    Lua: for when the only things you have are a C compiler and a need not to write in C.

    (Been using it recently and I think it’s the most sensibly-designed language I’ve encountered – it’s akin to Python but with simpler syntax and without the enormous library that makes building & embedding it a complete pain. Not good for every situation but great for embedding).

  12. Have you tried Go? I was all Python for ~2 years, but for the last 2 years I’ve used Python and Go quite extensively. Go is now my favorite programming language.

    Go borrows some of the best parts of Python, like its slice notation (items[:5]) and multiple assignment (a, b = b, a), but it also has _brilliantly_ simple concurrency primitives. For example, `go f()` runs function f asynchronously/non-blockingly — that’s it!

    I got my friend, whose background is in PHP and Python, excited about Go. He asked if it was possible to, say, do 3 things at the same time in the background, then have them pass their results to a 4th backgrounded functioned, which then combined the results and passed them back to main/the original calling function. I told him that what he described is TRIVIAL in Go, and I wrote this ~15-SLOC program demonstrating just how easy and elegant this is: https://gist.github.com/4442820#file-goroutines2-go

    Go is amazing, and compiles extremely quickly (by design). Static typing, but with type inference everywhere so it feels way more like Python than Java… It’s awesome, seriously.

  13. Thanks for the excellent reminder of Why I Almost Quit Programming.

    Fun, yeah. I’ve switched to Python; I wish I’d listened 15+ years ago when I’d been given exposure to it but didn’t “get” it (and the indentation stuff turned me off.)

    I’ve been back to banging on Python for a few years now and I don’t regret it at all. Yeah, there are annoyances. Overall, fewer than any other language I’ve used. (That said, I’ve never really learned Ruby or RoR.)

  14. Oh, and just to be clear: I’m not a “real” software engineer. I’m a simulation at best.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>