The C++ bashing season is back

October 17th, 2009 at 5:28 pm

It seems there is a lot of dislike and hate for C++ out there. This isn’t new – it has always been like this. But lately this issue comes more into focus in the programming community, and I don’t even understand why. After all, C++ is certainly a less important language now than it has been a few years ago, since more applications are being written in dynamic languages like Python, and new languages like C# gained some popularity and market share on the expense of C++.

Proggit fame

Proggit, the programming section of reddit.com is probably the most popular place for general programming discussion these days. Dozens of topics are raised every day and the more popular can easily generate hundreds of comments in just a few hours.

Traditionally, Proggit was considered by many to be a snub place where language zealots reside and advice everyone to learn Haskell and Lisp. IMHO this isn’t the right impression. Perhaps these languages get more Proggit share than their actual use, but this is far from saying that "real" issues are not being discussed there. Like bashing C++.

Here’s a short collection of recent discussions, with the original articles that started them:

A redditor asked two months ago whether he’s crazy for liking C++. Here’s a very nice quote from one of the answers:

You like C++ because you’re only using 20% of it. And that’s fine, everyone only uses 20% of C++, the problem is that everyone uses a different 20% :)

Peter Seibel, the author of Coders at Work asked most of the star programmers he interviewed about C++, got many negative opinions and very few positive ones (and even those, quite reserved). Proggit discussion.

And of course, there’s the famous post made by Linus Torvalds in the Git mailing list, meanly bashing C++. Proggit had many threads on the topic, but this behemoth of almost 1000 comments is probably the most notable. It was discussed again a few weeks ago, with the same general spirits.

So why is C++ so bad?

A fellow Israeli named Yossi Kreinin compiled a whole website dedicated to the deficiencies of C++: the C++ FQA – "Frequently Questioned Answers". A word of warning – if you have to write a large amount of C++ code soon, don’t read the FQA – you may get really bummed.

The FQA has also been discussed quite a few times, and although at times it is a bit too harsh, overall the observations made there are correct. Very few corrections have been made over the years it exists. C++ does have many flaws.

My personal contribution: the worst thing about C++, IMHO, it’s that it’s extremely hard to understand code written by others. Here, I said it. Not the templates, not the exceptions, not memory management and not diamond inheritance. Yes, all these features aren’t perfect and could have been designed in a better way, but they’re manageable. Reading the code of others is the biggest problem. And since C++ applications are rarely a one-man-job (much less than in the more dynamic and hence productive languages), reading code is an important part of a C++ programmer’s job, and reading C++ code is darn hard. Wanna read C++ code written by great programmers? Try to read the source of boost, or Andei Alexandrescu’s code – good luck! Wanna read C++ code written by poor programmers? Don’t even bother.

Linus Torvalds, in his tirade against C++ explicitly says that he uses C to avoid C++ code contributions from other people (well, he used stronger words…)

Code readability is one of the major reasons I prefer Python over Perl. Perl is a mostly a good language, but Perl code written by others tends to be unreadable. Luckily, there are great alternatives to Perl – Python and Ruby for example.

With C++ the problem is deeper. Yes, it’s complex and it allows to write unreadable code, but this by itself doesn’t make it a bad language. Contrary to Perl, however, there is no real alternative to C++.

But what’s the alternative, C?

And herein lies the great dilemma. Yes, C++ is needed less these days. Many applications (oh, lucky souls!) can get by using Python, Ruby or something of the sort. Many applications (especially for Windows) get written in C#. But for some kinds of applications it seems that the only viable options are still C and C++. There are many examples, really, but take something popular – µTorrent – an amazing amount of functionality, useful GUI, fast and slim, comes as a standalone .exe weighing less thank 300 KB. µTorrent is written in C++, and you could never, ever, make it so fast and small using any other language. C++ and C are the only options you have here.

Another example is something like Photoshop – can you even imagine writing an application of such size, and yet top-notch performance, that runs on several platforms, in anything other than C or C++? Firefox is yet another example, written in C++. Web servers are usually written in C. When you have to squeeze absolutely the most performance out of an application, C and C++ remain the only really viable choices. No matter how much optimization IQ goes into the JVM, C and C++ allow you to write code that is "close to the metal" and hence for the critical, hand-optimized code sections, they will certainly be faster.

And the big problem, the greatest dilemma comes when you have to choose between the two.

C is much less reviled than C++, and rightly so. The language is much simpler, and hence has much less itches to scratch. And reading C code is surely easier than reading C++ code.

But who will start a new project in C these days, unless it’s an OS kernel, has to run on an embedded device, or Linus Torvalds is in the team?

After all, you can take C++ and write it as a better C. Isn’t it a shame to reimplement all those conveniences of C++ with plain C? OK, let’s just use those nice string and vector classes instead of writing our own. And, oh, this ADT we have here is better written as a class. Et cetera, and very quickly you start hacking partial template specializations and pondering the dynamic casts of your multiple inheritance ridden class hierarchies.

Where do you stop? Which subset of C++ do you pick and stick to it to really make it a "better C"? Let me paste that quote once more:

You like C++ because you’re only using 20% of it. And that’s fine, everyone only uses 20% of C++, the problem is that everyone uses a different 20% :)

For someone the good parts of C++ are exceptions and RAII. For another it’s templates and STL containers. Each one is picking his own subset, and no one seems to agree whose subset is better/safer/more comprehensible.

This is how all religious wars start.

Personal experience

A few years ago my day job was C++ coding. I found myself in the same dilemma as the one described above, and have actually re-implemented a couple of C applications in C++. I was satisfied with the process overall, but started experiencing the fangs of fear from the language. This came to a culmination when I perused Modern C++ Design by Andrei Alexandrescu – I realized I’ll probably never be smart enough to really understand C++ with all its quirks and dark corners.

Somewhat later I had the pleasant experience of writing C++ code with Qt. Based on hearsay, Qt is quite complicated and hackish inside, but what it presents to the outside is pure delight in terms of API design. Writing C++ code with Qt was fun and very productive.

Since then I didn’t get to write C++ much. I wrote C for embedded devices where C was the only choice, so I didn’t have the dilemma. I wrote a simple Windows GUI application using C++ and the Win32 API. Since the applications was small, my code didn’t get bloated and I enjoyed being able to just create a map of string to vector when I needed it – coding it in C would be much more painful. But mostly I’ve been using Perl and Python, the latter quite successfully for non-trivial Windows applications with GUIs and networking,

As for the future, I hope not to have to choose. Frankly, I hope not having to use C++ or C for any non-embedded applications. Wherever I’ll be able to get by with higher-level languages like Python, I’ll take the opportunity with both hands. But if I do face the dilemma, I’ll probably pick C++ and will again try to stick to the smallest subset required to complete the job without getting stuck in the complexity quagmire.

Related posts:

  1. Book review: “Perl Medic” by Peter J. Scott
  2. Book review: “Thinking strategically” by A. Dixit and B. Nalebuff
  3. MIX in Perl
  4. My current programming language arsenal
  5. Some quotes from Paul Graham’s latest article

32 Responses to “The C++ bashing season is back”

  1. wejNo Gravatar Says:

    There’s only one good word for these people: anti-C++ites.

  2. Eduardo FelipeNo Gravatar Says:

    Well, while I do agree with some parts of your post, I came to question one particular issue:

    The one that you are not really going to write a new boost or a vector class, but rather use it. So it’s the API that matters, not the black magic that goes inside.

    If I were to put the blame on what severely diminishes the readability of boost it would be on the fact that they have to work with broken legacy compilers, with bizarre OS that have a even scarier API, which is also completely non-standard.

    When you have to support 40 different targets the code ends up a mess. You can see that in boost, Qt or any other multiplatform code.

    But like you said in the end: Qt is hackish inside but the API is beautiful. And my point here is that the same is true for boost.

    Cheers!

    PS: Yes, I have found a bug in boost::filesystem under a new platform, but that was fixed within the day. So even though I had to read boost’s C++, it is far from being an impossible task.

  3. Jonathan AllenNo Gravatar Says:

    > Another example is something like Photoshop – can you even imagine writing an application of such size, and yet top-notch performance, that runs on several platforms, in anything other than C or C++?

    Expression Suite.

    It isn’t cross platform (yet) and I can’t make an honest comparison with Photoshop as I rarely use either, but it does prove that .NET is at least an option for high-performance applications.

  4. Tim MenschNo Gravatar Says:

    Expression Suite looks like a perfect example of something that can be written in C# or Java or what-have-you. Completely not in the same league as Photoshop as far as how much processor it needs; it just helps you create web pages.

    Web pages are text. Unless it has functionality I didn’t see in a quick review of its website, it’s a glorified text editor/generator at its heart (I exaggerate, but not by much–really what it’s manipulating is symbols that create text, i.e., HTML, JavaScript, and CSS). Photoshop can be asked to manipulate 100s of MB of data in a single image. Show me a 100MB web page and I’ll show you a site that will never get a user…

    I’m an atypical C++ user in that I use 80%+ of the language, not 20%. What DON’T I use? Exceptions (well, I guess I even occasionally use exceptions, but not often) and full multiple inheritance (except for pure interfaces). And no, I don’t push templates as far as Alexandrescu, but that’s because I don’t want to risk breaking various compilers, since my code tends to need to be cross-platform. And the error messages hardcore metatemplate programming produces are hideous for end users. I did borrow a few techniques from Modern C++ Design, though. :)

    Given that, though, I have to read a LOT of other people’s C++ code, and I don’t really ever have trouble reading it.

    And yet, I still hate the language, and wish I could be using something more elegant. But when it comes down to it, nothing else is close in its combination of speed, availability on relevant platforms, support of every relevant library I’d need to use, robust compile-time checking (90% of the time when I’m writing code, once it compiles it just works), and the one most important feature–the best programmers in my industry (video games), who I need to be able to work with, almost all know it and use it. Even if they also hate it. :/

    So yes, to paraphrase the famous quote, “It’s the worst language out there, except for all the others…” I hold out some hope that “D” might someday mature to the point of being a viable alternative. Even Alexandrescu likes it. :)

  5. BasuNo Gravatar Says:

    I think the problem is that the whole stack is too complicated. C and C++ were born in a simpler time when machines were weaker and getting down to the metal was pretty much the only option you had (unless you were a Lisp hacker). With the fast machines we have today, there’s no reason why we shouldn’t be running in a fully managed environment. However, the JVM for all it’s great features still isn’t quite fast enough (like you said) for short lived day-to-day programs (or powerhouses like PhotoShop).
    If there was a way to marry a managed environment like the JVM or CLR to a really fast OS kernel core, i think we could get a fast enough setup to leave C/C++ behind except for really critical cases. Unfortunately the modern crop of OS’s probably won’t be able to do something like this out of sheer inertia. Though Objective-C with Cocoa isn’t all that bad. Microsoft’s Singularity project is also a step in the right direction.

  6. James LongstreetNo Gravatar Says:

    I work in games, so I’m obviously a bit biased.

    C++ is without a doubt the best language for providing high-level abstractions without sacrificing performance. In C++ a class is just a bunch of variables, functions, and syntax, until you add virtuals, at which point it’s a decision you made to sacrifice slight memory and function-call performance for multiple dispatch. With templates you sacrifice code size and some readability for beautifully abstracted generic programming. RAII allows you to stop thinking about it and do it, already. We don’t use exceptions in my line of work (except on the tools side), but again — you sacrifice performance for intuitive error handling. MI gets you exactly as much shared interface, mixin, etc functionality as you want, and hopefully nothing more.

    C++ makes it easy to shoot yourself in the foot, but any language that doesn’t let you shoot yourself in the foot is not worth learning.

    The arguments against C++ come from two sides: “I can do that in C and don’t have to deal with all the C++ shit” or “In [perl|python|ruby|haskell|lisp|java] that’s one line instead of 10″. I answer both of those with their opposite problems. For the “I can do that in C” argument: of course you can. Nothing in C++ is horribly innovative. But in C you end up reinventing the constructor, destructor, method function, template class, inheritance, etc., even basic shit like the string class, variable sized arrays, like Greenspan’s tenth law. In fact, call this Longstreet’s Tenth Law:
    “In every sufficiently complex C program, there exists and ad-hoc, buggy, slow implementation of about half of C++.”

    The other side: “In $LANGUAGE that’s 1 line instead of 10 in C++”. For lots of applications this is a completely valid argument. Personal projects get written in Python unless there’s a reason otherwise — so I don’t have to deal with all the bullshit. But I have a friend who writes Java, and sings the praises of not having to deal with memory management, while in the same breath complaining about how their server with 32 gig of memory keeps having to get rebooted once a week. Abstractions leak, and the most dangerous part of garbage collection is getting lulled into a false sense of security about your memory. Then, since you’re not bothering to keep track of your objects, it makes sense that you won’t have to keep track of database connections, files, mutexes, etc. Then your whole company complains that they can’t get a motherboard that supports enough memory for your app — when it only uses 100 meg at startup.

    C++ forces you to manage your resources. You can abstract that — but you have to understand the abstraction and where its weak points are. False security is no security at all.

  7. AlexanderNo Gravatar Says:

    First of all, I like C++. It is like the toolbox you should have in your garage – for everything that can break in your house you have a designated tool. But this is also where the problem starts.

    I think the problem of complexity is something inevitable if you dive into a “matured” environment. Few of us grew up and did C++ see maturing (maybe I’m lucky), a lot more did see Java maturing. Think back to the times when assembler was en vogue …

    Python and Ruby may be simpler, have less constructs that make your heads shake twice before getting it, and take tedious tasks away from you. But well, would you able to add a bigger feature tomorrow in Zope, Django or RoR if I ask you to get today started on the toolkit? C is simpler, so come on, write me a new filesystem for the Linux kernel tomorrow!

    Also, from my standpoint, programming should never be about languages. It is about concepts. You can apply any concept in any matured language, but if the language was not originally meant to act like it, it may look strange for the eye. You can do object oriented programming in C (gtk+/gnome), functional programming in C++ (template metaprogramming) and Java (create your own closure objects …) but object oriented programming will still look nicer in Java, and functional programming constructs will only look nice in languages designed for it (Scala, Groovy, OCaml …).

  8. Jeff DickeyNo Gravatar Says:

    I’ve been programming in C since 1979 and C++ since 1985 or ’86. I feel your pain acutely. I’ve been teaching myself an average of two new languages a year since the mid-80s and have yet to discover any that are both a) as FUBAHORed as C++ with b) any sort of reasonably-large user base.

    I’ve been telling people for about 3-4 years that C++ is a nice 12-kg sledgehammer; it feels SO good when you stop hitting yourself over the head with it. For me, the ‘stop hitting myself’ moment came when I got roped into my first Objective C project. This doesn’t have the theory overhead of C++, nor the problems that have spawned sites like the C++ FQA (not a typo) and “Defective C++” – not to mention providing endless material for thedailywtf. It’s not perfect (what language is?), but it’s now my first choice for desktop-based, “traditional” apps. If you’re a hardcore C coder who gets frustrated with the weirdness, unpredictability and non-portability that IS “Standard” C++, give it a try.

  9. BobNo Gravatar Says:

    Am I the only one who likes to write C++ more than I like writing Python? I love python too, and I mostly use it, but in my eyes nothing beats the beauty of well-written C++ code that uses high-level stuff (std::transform with std::vectors of objects using a mem_fun) that optimize down to an inner loop of like 4 instructions.

    So I mostly use Python, but I really like my C++ projects, and the C++ projects I’ve worked on professionally.

  10. John LindalNo Gravatar Says:

    Good post. I was just thinking along the same lines! http://jafl.my.speedingbits.com/blog/2009/10/17/c/

  11. ShyNo Gravatar Says:

    Have you ever looked at Firefox code? There’s alot of javascript there too and infact the whole GUI is written exclusively in javascript+XUL.

  12. RayNbowNo Gravatar Says:

    > Firefox is yet another example, written in C++.

    So that’s why it manages to segfault every now and then on my Arch netbook? :p

  13. Andreas SchipplockNo Gravatar Says:

    choose the right tool for the job. If one has to write a webserver, he probably wants to do that in c as you already mentioned. Someone who wants to do web development probably doesn’t want to put his hands on assembler.

  14. SJSNo Gravatar Says:

    C isn’t the only alternative to C++, and it’s a bit misleading to imply that it is. Objective-C is compatible with C (and does a better job of it than C++), provides object-oriented features, and is a lot less insane than C++.

    The problems small enough to be manageable in C++ are problems small enough to be managed in vanilla C; problems too big for C are going to be too big for C++ — but that won’t become apparent for quite awhile. Up until that point, it will make it easier, which is nice if you’re not the one on the tail end of the development cycle.

    (As you might have guessed, I’ve been in that position. I’d rather maintain Ada than C++.)

  15. Lachlan StuartNo Gravatar Says:

    While I agree with your arguments against C++, I disagree with your statement:

    "...and you could never, ever, make it so fast and small
    using any other language. C++ and C are the only
    options you have here."

    While factually this is true(ignoring ASM), I believe you’re arguing for the wrong thing. What if you could have 50% more ease of programming for 10% more size? After all, a similar sacrifice was made moving from ASM to C++, you really need to look at this as a ease vs size spectrum and stop using C++ as the baseline for size, because it’s not!
    Take D Programming Language for instance. Its based loosely on C++, but has many new features and a significantly tidied syntax. It has slightly larger output than C++ but provides a MUCH more enjoyable coding experience. In my opinion, D is a much better sweet spot on the ease vs speed scale.

    There are actually quite a few tragically unappreciated compile-to-native-code languages out there, such as D Programming Language, Haskell, Objective-C, OCaml, Modula-2, etc…
    I really wish people would stop using C++ because at least one of these will always be an alternative. Sure you may have to transcribe header files to import symbols from a DLL, but the benefits far outweigh this initial cost.

  16. GuyNo Gravatar Says:

    “µTorrent is written in C++, and you could never, ever, make it so fast and small using any other language. C++ and C are the only options you have here.”

    What is required is the program be compiled to optimal native code. C/C++ is just one of a several ways to do that. It is the most popular at present.

  17. José HérnandezNo Gravatar Says:

    I don’t think one can make a strong argument can be made for C++ anymore. The fundamental problem with its complexity is that it tries to be high and low level at the same time. The intelligent programmer would write most code in a high level language like Python and write the core, fundamental parts in C. It’s dumb to waste one’s time writing a complete GUI in C, but it’s smart to write a matrix multiplying algorithm in C. If one resorts to this tactic of mixing languages, the arguments for C++ give way to the simplicity and efficiency of C. One ought to do the high level abstraction stuff in a high level language, not a language like C++.

  18. blankthemuffinNo Gravatar Says:

    The best alternative to C++ I reckon is D ( http://www.digitalmars.com/d/ ), it has some rather large flaws ( two standard libraries, a buggy compiler, lack of tools, lack of documentation ), but it’s under development, and it looks to be well designed. If more people adopt it, I can see it becoming a nice language to use, what I believe C++ should have been.

  19. notwithstandingNo Gravatar Says:

    I’ll add my chips to the pile of people supporting D as a strong alternative to C++. I got into the language when I read the feature list and I realized it was a list of fixes for everything I don’t like about C++. Everything I don’t like about C too: just two features, an actual module system (that isn’t the total sludge that #include turns a program into), and arrays/strings that know how big they are, are sufficient for me to prefer D over C for any program I can get away with doing in it. With C++ the reasons for preferring it are even greater: no manual memory management (except when you really want it), no pointers (except when you really want them), exceptions that work properly, *parsable syntax* (hugely important if you want to write tools), templates that don’t make your eyes bleed, compile-time evaluation of code (this is how you get to be faster than C: have the compiler do work in advance).

    The language needs to settle some and the standard library needs to settle some. When that happens I will actively advocate D over C++ for even commercial code. I already prefer it for any systems programming I need to do.

  20. notwithstandingNo Gravatar Says:

    If you have to write C++ I strongly agree that Qt is the library to use. It’s the only C++ library that’s (a) featureful enough to give Java a run for its money in terms of features out of the box [i.e. why is there STILL no standard C++ socket library???], (b) portable to the major platforms and (c) highly readable. Other libraries don’t come close in mixing these three. In particular portability and feature set tend to pull in opposite directions, and readability is a place where C++ can be particularly hard to deal with.

  21. WheatiesNo Gravatar Says:

    “…and you could never, ever, make it so fast and small
    using any other language. C++ and C are the only
    options you have here.”

    Also honing in on that I have to disagree. Look at OCaml which provides in many cases the same performance as C++. All it lacks is true multi-threading. Then again so does Python. What about Tcl which was designed for embedded systems? There’s just too many languages for everyone to keep track but to say C++ is the only option…

  22. Praki prakashNo Gravatar Says:

    I like your post. However, I don’t agree with many of the points you are making. It’s certainly possible to build high performance web servers in other languages (check out the one built in Erlang, yaws). Apache has had a number of optimizations to its advantage, yet the Erlang implementation comes quite close. Along the same lines, as others have commented, quite a bit of Firefox is written in Javascript. It would be quite reasonable to guess that, less than 20% of the code accounts for 80% of the execution cost which makes the mixed implementation models work quite well.

    A lot of real world programs require CPU and IO. As soon as IO is in the picture, performance of the code execution is less of an issue and managing IO well trumps everything else. Unless you are working with highly CPU centric code or interfacing with hardware at a very fine granularity, Java or any other decent VM implementation gets you there. To squeeze out that last ounce of performance, you do need to break through the VM layer. When you start to worry about memory layout, L1/L2 cache misses, pipeline stalls, is when things get really interesting and you need a language closer to the bare metal. C is a fine language to do it as long as it is written carefully. I would wager that, in most cases, efficiency is affected more by the implementation design rather the vehicle of implementation.

    The problem with C++ is its complexity. There is much to like it when you use it in disciplined manner. It is also a treasure trove of clever doodads and serves very well for the mavens of complexity. One can use C++ successfully and many do. You have to take it seriously when the designers of STL claim that there is no other language in which they could have implemented STL.

    One is also prone to strongly argue for for their hard won C++ skills :)

  23. Chilla SridharNo Gravatar Says:

    C++ is evolved because C based large projects were becoming too unmanageble and were missing the time lines. If your requirements are ever-changing, then C++ is the best choice. I blame it on the designers of the C++ project with inadequate understanding of OOAD and which forces the C++ coders to use the dark concepts to overcome the design the flaws.

  24. Michael VaganekNo Gravatar Says:

    C++ rocks. Yes, there are problems, especially templates run amok. STL, on the other hand, is quite useful, and not all that hard to learn (just don’t look at the source without an unlimited supply of caffeine).

    The main complaints mostly seem to fall into the “it’s too hard” category, which I don’t empathize with; programming nontrivial new stuff is hard, and C++, if understood and used well, actually does help organize one’s thought and design.

    It’s not always the best fit for all problems. There are certainly situations where Perl, PHP, Javascript, Java, VB, C#, etc fit the bill. But for a complex application from scratch, C++ should certainly be evaluated.

    All that being said, there are some advantages to good ol’ C itself. It is more portable, and the binary/link interface is more portable. The point about “other people’s code” in C++ is well taken: C++ can allow one to create a quirky idiom and overly bloated style, but actually that can be done in any language.

    Some good comments above, especially James Longstreet’s.

  25. ripper234No Gravatar Says:

    “But for a complex application from scratch, C++ should certainly be evaluated.”

    Challenge – find 3 such applications where C++ is better suited than C# or Java/Scala. Or 1 such application that doesn’t involve the words “realtime” or “device driver”.

  26. elibenNo Gravatar Says:

    ripper,

    How about compilers? And web browsers – AFAIK all the mainstream ones are written in C++. You just have to squeeze the last bit of speed for both JS execution and page rendering, and for this purpose C++ is still going to be faster than Java/C#. The same goes for other compute-intensive applications, such as Photoshop.

    Not to mention games. You don’t think Starcraft II was implemented in C#, I hope ;-) Yes, it could have, but you’d get probably 30% the FPS on the same hardware.

  27. ripper234No Gravatar Says:

    touché – although 3D games do fall under some definition or realtime, and enjoy a rich legacy of 3D engines written in C/C++, so there wouldn’t be a real point to develop such an engine from the ground in in C#/Java.

    I guess I’m used to projects that aren’t CPU bound, performance wise.

    Also, short-lived programs that are invoked a lot (e.g. git command line) is a good example. Java/C# might get good performance after just-in-time compilation, but if the entire program lifetime is 100 milliseconds, then compiled languages sure have an advantage.

    (This advantage might be theoretically mitigated by a smart cache on the compiled/optimized binary that lasts over different executions … I don’t know if this technique is used in practice)

    Of course, here’s the obligatory reference to Stack Overflow: http://stackoverflow.com/questions/145110/c-performance-vs-java-c#

  28. elibenNo Gravatar Says:

    Ron,

    Regarding short-lived programs such as git, there’s actually an interesting point to consider. Since these programs are interactive, some delay is allowed (the user doesn’t notice). Proof-of-concept is Mercurial, written in pure Python, and as fast as git, at least in its interactive work (both generally as well, since source control is a largely storage-speed-bound problem).

  29. ripper234No Gravatar Says:

    From the Mercurial chapter of Open Source Architecture: http://www.aosabook.org/

    (I just happened to read this a few days ago … going through the book slowly but surely)

    On the other hand, Python is slow compared to many other (compiled) languages; in particular, interpreter startup is relatively slow, which is particularly bad for tools that have many shorter invocations (such as a VCS) rather than longer running processes.

  30. elibenNo Gravatar Says:

    Ron,

    Hmm… well, anyway it is written in Python after all, and I personally never felt its impact on load time. In general, start up time of Python applications are relatively good, unless they load many heavy DLLs (such as PyQt, matplotlib and other large libraries).

  31. Nick PNo Gravatar Says:

    Anyone considered using Ada for this stuff? It lacks the extreme amount of supporting libraries C/C++ has, although it can bind to many of them. Ada was designed for both performance and safety. There are excellent compilers for it, even free GNAT. There is a version (SPARK) that can prove code properties automatically and interactively. Ada is extremely cross-platform. It also runs on most popular small, highly reliable, fast, real-time OS’s. There are also profiles for real-time.

    Defense and aerospace industries heavily use Ada. Plenty of tools and support available if needed. If not that low-level, Ocaml is an excellent language that’s inspired others like F# and Scala. If their libraries aren’t needed, I recommend Ocaml b/c it’s run-time is reliable, fast & doesn’t have a huge stream of security issues (*cough* java *cough*). One team is also making a runtime for it that runs directly on Xen w/out OS. I also second one comment’s statements that little used languages like Pascal, Modula-family, Oberon (even an OS based on it), etc. can be used and expanded.

    Anyone saying C++ is the only choice in general hasn’t been doing research. However, it may be the only choice for a given person or project. That’s almost never due to language benefits.

  32. Nick PNo Gravatar Says:

    Supporting my claim for Ada, here’s an excellent summary of the many benefits of Ada 95. By itself, all of this makes Ada kick C++’s arse as a language. (I read my first Ada examples as easily as my BASIC code, or easier.)

    http://www.sigada.org/ada_95/what_is_ada.html

    Ada 2005 is the most recent standard. It offers numerous improvements for safety-critical, real-time and embedded uses. Other developers might like integration with C++ and Java. (C++ wasn’t standardized when the previous Ada was made, so only C compatibility. Note that there are commercial C++ to C compilers. It’s a hack but it can work.)

    http://www.cotsjournalonline.com/articles/view/100424

Leave a Reply

To post code with preserved formatting, enclose it in `backticks` (even multiple lines)