The license of this stuff / Why use C ?

17 July 2011

.. is the “ 3-clause BSD also known as the New BSD License Which gives you license to do as you please with this stuff, except that you may not sue me for any damage and you have to credit me for using stuff.

Why C

These projects are mostly written in C with classes / Abstract data types. Here are my reasons to prefer C over C++* or Java.

Higher order languages like C++ and Java have a much more expressive syntax. Now with these capabilities comes an abundance of stylistic choices that divert attention from the real goal of writing a program.

  • With C++ one has to make a set of decisions; is it wise to use C++ exceptions / RTTI or not? Will one use the STL library? What about C++ exceptions or not ? What about BOOST, or rather which subset of BOOST? What is your position on template metaprogramming (I strongly dislike this kind of abuse) ? All these choices are normally codified into a style guide, for example the Google C++ style guide is a very thorough document and I largely agree with what it says; however all these decision points taken together tend to restrict you with regards to third party libraries and tools that you can interact with; so they in fact restrict your freedom of choice. Now open source is mainly about freedom of choice, both for users and for developers, so there is some conflict here.
  • In Java you have much less choice in terms of styles and programming paradigms; one should generally stick with how the JDK does it. However with Java you have an abundance of framework for any occasion; Choice of adopted framework has a strong lock in affect (will you use SPRING or OSGI or whatever kind of Beans? Which subset of the Jakarta alphabet soup is in use? All these choices usually come with a lot of internal politics, programmers tend to invest and band around technological choices.
  • With C++ and Java it is very easy to declare classes; now there are infinite ways how one can possible decompose a system into classes; and you can spend an infinite amount of time on that issue alone; All this of course distracts from the task of writing the actual program. With C with classes one is generally limited to object aggregation and polymorphism; interestingly the “Design pattern book”: advocates preference of object aggregation over inheritance. So somehow less choice sometimes results in more freedom.
  • Interesting point is that in recent years there is stated a trend away from OO design processes towards Test driven / Agile methodologies;
  • Also Linus Thorvalds says that with C one usually does not have to wonder what a line of code does; as opposed to higher language features that are of course expressive, but of course they are supposed to ‘hide complexity’ so go figure what the thing does.
  • An obligatory reference to the C+ FQA is hereby made.

The point is that I still do C++ and Java for paid work, as best as I can; but all the fluff and politics around it is; well, really no fun. Also please note that most programs that matter are written in C, the Linux kernel, the gcc toolchain, most scripting language interpreters - all in C;

While C++ may be best suited for companies that build large monolithic applications, it is not the best choice for your garage open source project.

Still C++ is a good language for comercial projects, on condition that one really needs to utilise the computing machine to its maximum. The language creates a common vocabulary for such things as collection classes and object oriented design with patterns, things that are very important when trying to communicate the design of a project to a new programmer, just added to the team.

Still Java may be the best language, on condition that one does not strive to utilize the computing machine to its very maximum, but one still cares for good performance. Its development tools allow for great productivity, automated memory management may still be the best improvement in programmer productivity, maybe even by an order of magnitude. One can build very tall abstractions in java, however one still may need the help of the occasional hackers, those that care for ‘low level details’; one needs them for example when sorting out things like reference leaks, and helpng out if things don’t quite work ;-)

ten years later

actually most server side software runs on the cloud, and they can use the regular GPL as well without a problem. I think that this is a reversal of great importance. as for programming in c, i wouldn’t use that in this day and age. C++ got a bit more sophisticated and nowadays it is much more practical to deal with templates for metaprogramming rather than with C macros.