Friday, May 13, 2005

Oh say can you C?

Many, many years ago, I learned programming. I started with Fortran, went on to Basic, Cobol, and then to 8-bit assembler (VC20, ZX Spectrum). When I started with 16-bit assembler (Amiga), I got a PC and pretty much stopped programming for about 10 years. 10 years later, when I wanted to program something more complicated than BAT script, I found out that the whole world has gone to hell and everyone is using C. I tried to learn it and I hated it. Because I wanted to program my own projects, for free and for fun, C was not an option. I had to find something better.

Oh yeah, and it had to be free (both as in "beer" and as in "speech").

I tried literally dozens of languages including exotic things like Rebol, Euphoria, Erlang or Clean (incidentally, it seems my mind simply refuses to accept the concept of functional languages). However, I found out that it's almost impossible to learn "bold" and "daring" languages (i.e. anything other than C and Perl [I hate Perl somehow less than C because its absolute ugliness looks almost like an art]). I tried everything from PHP to Forth.

In fact, the only large-scale software project I created in last 10 years (for money) was done in Smalltalk, a wonderfully simple and elegant purely (and I mean PURELY) object-oriented language from 70s, whose core ideas seem bold and genial (oops!) even today. Unfortunately, it seems the less conventional and C-like any language is, the less people use it and the worse documentation it has.

The case in point: For example, documentation for Seaside, very interesting web framework for Smalltalk. Yes, that is the whole official documentation. Even if you know Smalltalk, you are hopelessly lost, without any idea how to actually do something. The problem is (and now I am not talking about Seaside or Smalltalk in particular) that while the community works on improving the software, nobody has time to write (or update!) the documentation (which is much less exciting task). When the default installation requires default admin password and you have to dig deep inside the code to find this password, you know something is amiss. Fortunately, Smalltalk is pretty much based on an idea of digging deep inside code, which should give you a lot of info even when the classes are not documented very well (and they are not, believe me).

The other case in point: The D programming language offers to be "The new C", really object oriented, including design by contract, etc... Unfortunately, while the authors tout how much better than C their language is, the documentation cannot be understood unless you already know C. :) (Something very similar is true for Objective-C.)

The idea of "Design by contract" (basically meaning that the language itself FORCES YOU to write documentation and tests during the programming whether you want it or not) seemed rather appealing to me. It means (or at least should mean) that you can return to your project after some time and still have basic understanding which method does what (which is what I do, because most of my programming happens when I have time to spare, which is not often). It was invented (I think) by the authors of Eiffel, which was elegant, simple (and FAST) language. Why the past tense? I am afraid Eiffel has lost much of its original simplicity and recent additions (which are becoming incompatible between the various Eiffel implementations) make it cumbersome. Eiffel also provides a simple way to integrate existing C libraries. Or, more precisely "aims to provide", because - again - you have to understand C constructs and C preprocessor pretty well to actually hook the libraries to your code.

If you want to do anything in any of these languages, you basically have to beg in the mailing lists and forums and feel very stupid afterwards for asking questions which are insulting for language gurus.

The answer probably is "Learn C, idiot". The "problem" is, I really, really don't want to. Currently, I am looking at Ruby.

And this is Albert, my other dog:

He was supposed to be a chihuahua when we bought him. Now he weighs 6 kg. I could probably make up some parallels about Albert and C but that would be unfair to Albert.

(Thanks to "Wittgenstein" for pointing out that the English word "genial" is not derived from "genius" as I originally thought. :) "Ingenious" is.)


Anonymous said...

Ruby is quite appealing... ever considered Python ?? Maybe this comparision could be of interest for you ;)

Anonymous said...

Try Java.

BTW: I always thought that object oriented languages combine object programming and functional programming, while in object languages, everything is object (even constants, strings etc.) So IMHO Smalltalk either isn't object oriented language or it's not that pure.

Anonymous said...

The documentation for Seaside is definitely lacking, but that page doesn't really represent the sum of it. It sounds, for example, like you didn't go through the tutorial: . The default admin password is mentioned on the download page: . And there's more "unofficial" documentation than official:

Anonymous said...

use Pascal or Delphi. It is very great programig language for beginners. Also there is a Baltazar.

Anonymous said...

zkus brainfuck!

Anonymous said...

There is a slight difference between words "genial" (= jovial)and "ingenious" (=highly intelligent). The first one is quite a common faux-ami in your language... so, beware of those false friends :-)

Anonymous said...

When I see your post, LISP comes to my mind (Lots of Incredibly Stupid Parenthesis) :-) (just joking) (really)

Anonymous said...

As someone who also hasn't learnt C, I feel your pain. (Followed a similar path to you, programming and hardware-wise.)

I have learnt REBOL though - and the poor documentation for REBOL/View is another reason I feel your pain... :-)

I've no experience of any other "modern" languages though, so can't really suggest one. I've a feeling the curse of languages these days in the OSs they have to run on...

Anonymous said...

Well, it's not so hard to learn C++. I had to learn it at school. I still hate it though. I much more like Pascal. I think, that C++ is unnecessarily complicated.