Jeff Schwab
10/20/2008 4:40:00 PM
Achim Schneider wrote:
> I recently (6 months ago, that is) started to learn C++ because it's
> needed in a significant number of job ads, now find my way around but
> utterly lack routine. Besides doing boring exercises like "implement
> that and that data structure clean and efficient", I feel that what I
> really need to do is some sort of full-fledged (however small) program,
> not something abstract. I do know C quite in-depth, though.
>
> However, I can't think of a thing to do where I wouldn't choose Haskell
> or Scheme before even considering C++, which may very well be because
> my greater expertise in the former ones makes me blind for C++'s
> strengths.
>
> So, here's my question: What kind of program/project is C++'s home
> turf, where you just can't get around using it on a big scale (that
> is, excluding library interfaces and small amounts of generated code)?
>
>
> PS: No, I'm not trying to start a flame war. I really don't know.
C++ scales better than most (all?) other languages, it allows control
over arbitrarily low-level details, it runs blazingly fast, and it
supports the sort of semantic checks that other languages just can't
(because they don't have such powerful static type systems). The "home
turf" is when you want a single project to include many different levels
of abstraction, from compile-time metaprogramming to run-time bit
tweaking, all in the same language.
You can probably write most smallish programs much faster in more
dynamic languages than you can in C++, especially if you need features
that are provided by the libraries that ship with those languages. For
example, you can throw together a little GUI-driven text-processing
application with Python or Java in a matter of minutes. However, once
you get into the habit of writing even your small programs in C++ (and
following certain technical guidelines), you quickly find yourself with
a library of re-usable code that makes development easier and easier
over time. Whenever I try some other language (I had a Ruby kick a
couple of years ago), it seems simple and fun, right up to the point
where it gets too slow, or the abstraction mechanisms begin to break
down... Then I go back to C++, and wonder why I didn't just start with
it in the first place.