Every now and again I get the desire to learn C++, but I rarely follow up on it consistently. I usually get the bug when some small, simple program isn’t working correctly or has a tiny bug or something and I just *know* that if I knew a bit more and could get in there and tinker around, I could probably figure it out. That’s actually what happened with my little mythvideo patches which I’m so proud of, even though they’re all about 5 lines each.
This time around, the bug that hit me was in vobcopy. The program itself is excellent, and works 99% of the time. The fault is really that about 1% of DVDs that I try to rip will just scream and screech at anything that tries to touch them, and I’m awfully curious why.
Being a programmer myself, I have a theory. My guess is that there’s just some small variable that is overlooked, or some sanitization that is assumed and just throws the whole thing for a loop. I’m obsessive about a lot of stuff, but programming is one of my extremes — I have a style of checking and verifying all possible external input and strictly checking it to make sure it fits exactly what I’m asking for. Basically, make no assumptions.
That’s kind of why I think I would like C++ so much, in that it’s incredibly strict. I love writing hard core code, in the sense that it cannot possibly break because you’ve accounted for every variable. C++ has stuff like that built in, so I think we’d be a good match.
I just wish I could follow through on the desire and commit myself to learning it.
Although the static typing system of C++ does give some help in strictly enforcing rules, it is far from being a language that makes bug-free code easy. It inherits from C the ability to circumvent the type system, and adds to it several layers of optional and leaky abstractions that can interact poorly if you don’t know very well how they’re implemented.
In the hands of an experienced and knowledgeable developer, C++ can be a sharp and efficient tool to create powerful, fast, and reasonably safe programs. Those who are less experienced are more likely to cut themselves on its sharp edges.
If you want a tool that is really committed to help you reason about your programs and enforce type rules, you should look at a language with a more modern type system. Haskell and OCaml are mature examples, and OCaml in particular is nearly as efficient in execution as C++.
C++ is not that different from plain C. Just google around and you will find some nice simple tutorials. Of course object orientated languages require a little different approach but it is not that hard.
I hope you can find some time to follow some of the tutorials and learn C++.
You might want to look at Mercury also. I don’t know about the efficiency of OCaml, but Prolog and Camllight, the ones I’m familiar with, are supposed to be not very efficient. Mercury is a mixture of Prolog with Caml, compiled to C, which is supposed to be an efficient strong-typed language.