The Best Programming Language?

When deciding a best programming language, what you look for is not technical differences, but essential differences—differences in programming paradigms for instance. Now here’s a tech post for you. I assume you understand the technical terms involved and so will only talk of why they are bad or good, without giving any definitions.

So far, each language I have come across, absolutely sucks. (Oh well, ok, I don’t know python yet.) Here is my perspective, most of the ideas are of my own and may be incorrect.

There are mainly two aspects that determine the goodness of a language: the “local” aspects, and a “global” picture (a.k.a design aspects).

Of C++, and the problem of bloat

Let me start with C++: traditionally my language of choice. It is great for contest coding, and contrary to popular belief, it is actually the local aspects that make C++ so great. If you haven’t programmed a large scale application, then you might disagree with me and might tell me that C++ is great for its design aspects.

When writing a small function, I can use STL and templates to reduce the number of lines of code drastically, and write very neat elegant code. Yes, it’s brilliant.

But lets look at the design aspect. Sure, object oriented programming is a fantastic concept. But the way C++ does it is painful. Firstly C++ is very bloated. (I am talking of the language itself, not the runtime. For example, I can say that C++ is more bloated than Java.) The additional bloat can confuse a programmer: how should he (oh, or she) design his application, and in the confusion he ends up using operator overloading to create supposedly neat modules.

Operator loading is sometimes very helpful (for operators like =,+,- etc., for objects for which it makes sense). However, sometimes library designers like using fancy operators for doing some routine function, just because they can. ostream‘s overloading of << operator has been one of the most conspicuous examples. I would definitely prefer a .put() method instead.

(Another argument against C++, which is not related to the language as such, is the difficulty in writing shared libraries using the language. For example, it is next to impossible to export member functions in a way that C can understand. Of course, you can create C bindings: for every member function create an exported global function. Hmm, kinda defeats the purpose of using C++ in the first place. But I definitely have done that in the past when writing rediffbol-prpl. I don’t know know how easy or hard it is to export C++ classes to, say, python classes.)

Of Java

Java, in terms of the language structure, is excellent. However the over-reliance on garbage collection creates bloated executables. Oh wait, I should say bytecode. So a small digression about bytecode. As a FOSS enthusiast, I find the concept of a precompiled bytecode daunting. See, I usually never run precompiled code from anywhere, unless I am cent percent sure of the source. A precompiled bytecode is trying to advocate a concept of code hiding: if you want to share the code, you might as well create portable code and compile it for each of the environments you are going to run it on. If you are talking of web applets, oh well, bytecode does a great job.

So we are back to talking of Java The Language. A big flaw in Java design, according to me, is the way every object has to be initialized and assignment is like copying pointers.

ClassName a = new ClassName () ;
ClassName b ;
b = a ;

Here, b and a both point to the same object. This is also different from how basic datatypes like int, or char works. It feels even nastier when creating an array of elements — you first create an array of “pointers” and then fill each element with the object of your wish.

Perhaps this is OK — if you have trained yourself to see it this way, but this is not my case.

I prefer the PHP way of doing it, where by default it creates a new object of the same type (and a different syntax for actually creating references).

Another issue I have with Java, is that I don’t like the behavior of Java generics. I can’t, for example, do List, I have to do the more painful List. There were some other issues with generics that I have come across in the past, but my memory fails me right now (garbage collection at work).

In any case Java is a much more well designed language than C++.

Of PHP and Strict Variables Declaration

Coming to PHP, a major design flaw in PHP is that variables need not be defined. Sure it’s a scripting language, but I certainly don’t like my typing errors to be translated into an all new, uninitialized, hard to trace, variable.

That, and the absence of variable scopes. So,

if ( ... ) {
    $a = "sfsdfs"; 
    // do some work with $a
}
echo $a ;

will output “sfsdfs”. Right, this is directly related to needing a variable to be defined before use. So we would like to be,

if ( ... ) {
  var $a = "sfsdfs";
  // do some work with $a
}
echo $a ; 

And this should ideally throw a compile error. Again you can argue that this is not very practical with PHP with the level of reflection it provides (and for webapps, I’ve seen reflection been used quite effectively), but it can’t be a good language until this is fixed. In fact it will be all the more interesting to enforce the variable type, like string $a, or int $a or MyClass $a, instead of just var $a. Because in most cases when you write something like $a = ... , you better know what that right hand side is going to evaluate to. Otherwise, you are going to find yourself debugging nasty Bohrbugs, which could have been caught at compile time in a well typed language. But in general, for a scripting language, PHP does a decent job.

Another (among lots) issue with PHP is the standard libraries that go with it. It neither follows object oriented conventions, nor is it completely procedural. So it is not too hard to find code which mixes both the coding styles.

C, I told you!

What about C? Ah, now here is a classic language!

Contrary to whatever I had believed previously (you might have heard me arguing against the use of C in the past), C can produce very neat, extremely elegant code. Add GLib to it, and you’ve got some amazing power!

Sadly, with great power comes great responsibilities. So now you have to be taking care of freeing memory, manually calling destructors, and so on and so forth. Although it is not bad as it sounds if you already have a good design in place. For example, make sure all your functions are very small: now call a cleanup code at the end of the function with a small goto. Or always have a concept of who owns a malloc-ed piece of code, and don’t try to do silly tricks to bypass that — don’t get tempted by efficiency.

Of function pointers, virtual functions and callbacks

Well written code in C is almost the easiest to understand. A small digression: I was tracking some C-code recently to see how it worked, walked down the code and eventually reached a line like this:

   (*variable->type->function) (... );

These are the C equivalent of virtual functions. Virtual functions are painful, for example, in this piece of code, I have no clue where this is jumping to next. Unless I know what type is. But now I have to locate where type got defined.

Sadly, virtual functions can’t be avoided. Function pointers are something that should be used carefully, and only in a very well structured design. With the exception of function pointers, it is much more easier to understand the flow of a C program.

So then, of C++’s handling of virtual functions: though it might seem the correct thing to do, it can very often be a PITA. It becomes even more painful if you accidentally mistype a function name in the derived class (so then the virtual function doesn’t get derived, and the new function is never used). Java’s interfaces seem more correct alternative to using derived classes with virtual functions. But IIRC, Java assumes all functions are virtual by default. PITA.

I have read about a few proposals to fix the misstyped virtual function definition problem, that could probably make it to C++0x.

Another thing that sets apart C from C++, is that: most modern applications are event driven. So you write callbacks, and callback handlers, you can signal events etc. The way I see it, callbacks in C++.. umm, just does not fit the flow. It fits elegantly in C though. (I’ve seen C++ code registering functions as callbacks. Hmm, in my personal opinion, if callbacks are to be used in an object oriented language, you should be registering an object, and not a function.)

Of Memory Handling

So what is the best way of memory handling? I argued against Java’s garbage collector. So do I like manually deleting all objects in C?

As of right now, Garbage collector seems like the way to go. Manual code clean up is messy, and often not possible. Need an example? Lets go back to callbacks. Suppose I set a network callback on an object, and in between the object is destroyed. Now the callback is called with an invalid object. This would not have been the case if a garbage collector were doing the cleanup job.

Yet, you can argue that in this particular case, I can use reference counting to get the job done. As soon as the reference count gets to zero, delete the object. It works in this case, but is flawed if used as a general strategy. (Consider three objects. A–>B, B–>C, and C–>B. Now delete the A–>B link. Now both B and C are not reachable, but both have non-zero reference counts.)

Still, we see reference counting being used for its performance benefits.

(In fact, sometimes you cannot be sure of the number of references if the callback is being called from another library, in which you cannot do manual reference incrementing. This was a major issue I had with rediffbol-prpl.)

In the particular case of callbacks, there is another solution. As far as I can see (and I may be shortsighted), the only situations where you can “lose track” or your variables are in callbacks or in multithreaded applications. For callbacks, we need some test to see if the object is valid or not. Libpurple, for instance, does the following nasty check to see if a PurpleConnection is still valid:

 #define PURPLE_CONNECTION_IS_VALID(gc) (g_list_find(purple_connections_get_all(), (gc)) != NULL)

Aha, so we store a list of all the globally declared connections, and to test if a given connection is valid, just check to see if it is the list. Hmm, so what if after the connection got destroyed, you did a malloc to create another connection, and this time the connection got placed at exactly the same address where your first connection was. If a callback is called with the pointer to the older connection, then heck, it’s still valid — but it’s not the same connection.

A more correct solution, would be to depend on a unique identifier for each connection object. So for each connection we would give a connection ID. We globally keep a list of all the valid connections as before (or if the number of them are very large, keep a map from the ID’s to the connections), and this time, instead of passing a pointer to the connection, pass around the unique ID. The callback can now correctly verify the validity of an ID and retrieve the object if required. Because of the uniqueness property, it can never get invalid.

Only, it might have been useful to have such a scheme integrated into GLib. (Or is it already?)

And as for threads, you need reference counting. Each thread keeps exactly one reference. It should not keep reference counters for each sub-reference it makes.

I would guess that, with this, it is not really necessary to have the garbage collection overhead. I would certainly love to hear a counterpoint.

Of GObjects

Maybe it is time we looked at GObjects as the future solution. It is not neat and elegant (in terms of number of lines of code!), but it — as far as my current reading-up-of-documentation-goes — it does everything correctly. It uses reference counting as an memory management aid, and doesn’t rely completely on it. Also, in some sense, you manually write down the virtual table, so there is no scope of spelling typos like you can get in Java or C++. It is (supposedly) easy to create bindings for other languages from GObjectified code. Another beauty is signal handling, a discussion of which is out of the scope of this post. :-)

And so I also took a look at Vala. So far, it definitely looks good, and I am keen on using it for some future application once it is stabilized enough. From what I see, it tries to give all the power of GObjectified code (in fact, the vala compiler just converts Vala code into GObjectified C-code) in a syntactically object oriented language. Again, the language itself isn’t perfect, and has many of the shortcomings described above.

Of C++0x

Lots of nice additions, but seriously — it’s increasing the bloat. Particularly I like the concept of “Concepts” (one of the more fundamental additions in the global design aspects), and of lambda functions (from the local aspects).

(P.S. While I am stopping here for today, this can at best be considered a draft. I am certain there are lot more rants that I am forgetting to jot down, but I will update this as and when I remember them.)

Advertisements

26 Responses to The Best Programming Language?

  1. A says:

    What are you talking about? C++ more bloated than java? Maybe there is something you are not doing right in C++. C++ is not a bloated language at all (at least when compared to java). I really don’t get your complain against object overloading. It, like almost anything else in C++ can be misused for sure but when used correctly is a pleasure. cout.put(char) exists and it would be trivially easy to write on if it didn’t.

    Java is not more well designed than C++? That’s just another way of saying I am not grown up enough to collect my own garbage. Come on! In that entire rant, you haven’t given one real point for your recent change of heart. I can only presume that you have a new girlfriend who likes java or something like that.

    Well written code in c is the easiest to read? Well written code in any damned language is easy enough to read for a well chosen definition of well read. This is the worst language rant ever!

    Most of your issues with PHP will be addressed in PHP6. And if you want a well designed language, try ruby… seriously.. it’s object oriented and without the mess… a tad bit slow… but not too much… Plus it’s easy to plug in c++/java/whatever whenever speed seems to be the bottleneck.

    As for the best programing language… I guess there is none… That’s like asking whats the best civilization in AOE2….

  2. A says:

    Errata:(would be glad if you merge this in to the above and delete this)
    Java is much more well designed than C++?
    instead of
    Java is not more well designed than C++?

    Well written code in any damned language is easy enough to read for a well chosen definition of well written.
    instead of
    Well written code in any damned language is easy enough to read for a well chosen definition of well read.

  3. arnstein says:

    I stick to whatever I said.

    Java is a much more *correct* language than C++.

    And I actually did give an example, where its not just about being “grown up” to handle your garbage. I also gave a solution to that, but its not exactly convenient. I also kept claiming that I was considering Java based only on its language aesthetics.

    As for operator overloading, I actually wanted to give a concrete example in my post. I did have one in mind, but I just was too lazy to find it.
    po::options_description desc(“Allowed Options”);
    desc.add_options()
    (“about”, “Test made by Collin Doering”)
    (“help”, “produce help message”)
    ;

    This is from the boost tutorial. By being bloated, I would mean that with all these powers you can write code which might seem elegant to a seasoned expert, but can’t be understood by a, say newcomer, without some effort. Most people would not realize how the above code works, and the point is its pretty unnecessary to do this via operator overloading. This kind of code makes C++ look more like a scripting language.

    By being bloated, I also mean the language syntax is too complicated. This is a known fact. C++ can be ambiguous at times, but Java cannot.

    I know of the changes in PHP6, and it does *not* address the issues I have mentioned here. I don’t know of any changes where I can define a variable scope, or force a variable to have a given type.

    The reason C is the easiest to read is that: you know exactly what it is doing! You can read the code line by line, and understand what is happening. But yeah, I agree with you, well written code in any language is easy to read. But in C++, for example, you can look at a class’ members’ definition (not definition of the class but the members):

    MyClass::funcA() {


    }

    MyClass::funcB() {

    funcA() ;

    }

    Just by looking at this source code, can you understand how the code is “flowing”?

    The answer is no, because funcA, could be defined as virtual, in which case it could be the child’s funcA which is being called, while you are spending so much time here trying to debug.

    Java, in some sense, corrects this by assuming that *all* non-private functions are virtual. This is a fairly sensible assumption to make. And if you don’t want a function to be virtual, you specifically say so. Also, java function declarations are written within the class declaration. So there’s no ambiguity as to extra modifiers modifiers like virtual. Some of the bloat that java provides (for instance nested classes) can actually be very useful. I might agree (but can’t say surely), that reflection in java is an unnecessary bloat.

    And no, its not as easy to plug in C++ or Java code with say, plain old C. For Java its next to impossible (without lots of overheads). C++ follows linking conventions that would mean that if I need to export a set of C routines to manipulate an object, I need to write a C wrapper for each of the object’s members.

    And no, I didn’t intend on writing the world’s best language rant. I was writing my rants, from my experience.

    And no, I never claimed to give a decision on the best programming language. In fact, I’ve given up on Vala too as an even more bloated language.

  4. arnstein says:

    po::options_description desc(“Allowed Options”);
    desc.add_options()
    (“about”, “Test made by Collin Doering” )
    (“help”, “produce help message” )

    ;

    For some reason this code came as smileys. note that there is no semi-colon after the brackets.

  5. Shreevatsa says:

    You do realise it’s absurd to have a post with this title and mention *none* of Haskell, Lisp, Perl or Python/Ruby, right?
    Those are languages with character. Java has character too, but a terrible one :P

    The issue at heart, when comparing Java and C++, is that they have fundamentally different “attitudes”: Java is a “directing” language, while C++ is an “enabling” language. Java wants to tell you how to code — its own world model, OO and all — while C++ is just an endless bunch of features piled on each other to just let you get your stuff done.

    [And the additions in C++0x (concepts and so on) are going to actually make it a simpler language :)]
    It is pretty much a given that C++ will always have “bloat”. [“If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor, and when was the last time you needed one?” — Tom Cargil, C++ Journal.]

    All said, this post is unsuited to its title; comparing four near-identical languages :P (They are all from the same family, more or less, and to whatever extent PHP can be considered a real language.)

    Some external links everyone should read, to make this comment go into the spam queue:
    Java: Kingdom of Nouns
    PHP: Training wheels without the bike
    Martin Fowler: Software Development Attitude
    And because any discussion about programming languages *should* include this:
    Paul Graham: The Blub Paradox

  6. arnstein says:

    @Shreevatsa:

    Right, only now I look back and see what you say is true, all four are from the same family :D .. but still, maybe I’m just comparing a few practical languages _I_ know. (Sigh, who needs Haskell.)

    The additions in C++0x, if it were to be ideal, could do with _removing_ a few older syntaxes. I can’t make any proposals right now. Concepts were something good, I actually did mention that in the post, it can’t be called bloat because of its utility value.

    Response to external links:
    Java: Kindom of Nouns: That was a well written post, and could pretty much convince anybody that the Java way isn’t the way of doing things. However, it doesn’t give any *real* reasoning against a Noun-based approach. I personally think, if you’re doing it OO, then do it OO all the way — you should not mix OO and procedural styles. Which I think Java is doing pretty well.

    PHP: Training Wheels without the bike: I don’t know Perl, but I should definitely have added the valid points against PHP presented here–the badly designed libraries.

    The Blub Paradox: Awesome post, I think I better be learning about Lisp now. :)

  7. anshul says:

    @shreevatsa

    Awesome comment there… Programming in Java (whatever little I did) always felt like someone holding my hand and showing me around…. Never liked it much… Much prefer C++…

    @arnie

    Regarding C vs C++…. You don’t have to look far to find difficult to understand C code. At least when you look at a C++ code you can (typically) make a reasonable guess that it’s C++…. With C, the code can look like just about anything… :D

    I have been working with ruby a lot recently and in the few languages that I have seen, it’s the one that comes closest to “well designed”. It just doesn’t get in your way…. lets you do whatever you want… It’s really the shortest learning curve I have walked on since LOGO…

    From REXML (REXML is a Ruby library) :

    Ruby is the language Buddha would have programmed in.

    :P

    Anyway, Lisp does sound very intriguing…. I have read too much about it…. It looks very interesting… If only I could settle on some implementation to get started with it…

  8. arnstein says:

    If you are talking of not wanting someone to hold your hand, how can any language be above C?

    Regarding Java and C++:
    But that’s not my argument. We can continue arguing the way a techie likes to argue why Linux is better (because its harder, silly!). Why is being directed to do the correct thing an issue? It keeps code standardized, neat, and very understandable. If you want to do Object Oriented Code, then it becomes extremely important for understandability reasons, that you follow a set of conventions, and not allow different people to follow different set of conventions. If you are a coding introvert (meaning, coding alone ;-), this does not hold.

    Regarding C/C++:
    The thing about C is that everything is at its bare minimum. Once you start being object oriented, everyone can have a different opinion of what is an “optimum” language. That’s what this discussion is about. And which is the reason for a hundred different languages coming up. If there are ‘n’ different features you need to implement, and for each feature the 2 ‘correct’ ways of doing it, we have 2^n optimal languages.

    With bare minimum, you can assume that are very few: which is why you have just a few procedural languages.

    Of course, using things like GObject can spoil that, because by enforcing a lot of conventions on top of C, you are almost creating a new, but highly pedantic, language. But the beauty is that this small GObject module can be exported like a C library which can be used without much knowledge of what goes inside. So anybody, who likes whatever style of coding (and whatever language!), can use it.

    Anyway, this is also why there are very few functional languages (oh there are many, but there are few that actually took off. Right, my knowledge of functional languages is itself pretty limited to some haskell). Functional languages follow few rules, and so there are few correct ways of doing it. I don’t see too many ways of modifying a functional language: except maybe the syntax.

    I can’t comment on Ruby since I don’t know anything about it. But well, I don’t mind reading about it later. :)

  9. arnstein says:

    @anshul: ‘A’ wasn’t you? Hmm, I thought he was. :-)

  10. Binu Paul says:

    Interesting factoid:
    Java design was influenced by C language’s mutant son Objective-C – which is the same language used in MacOSX app programming. See this:
    http://virtualschool.edu/objectivec/influenceOnJava.html

  11. […] is one mighty post on the elegance of several programming languages. Share and Enjoy: These icons link to social bookmarking sites where readers can share and […]

  12. Shreevatsa says:

    Sorry for the late reply; I forgot this in the midst of travelling etc.

    However, it doesn’t give any *real* reasoning against a Noun-based approach.
    The reasoning is that noun-based thinking is unnatural, encourages building grand edifices that are hard to tear down (thus impeding effective exploration), and makes for awful poetry. Like “pants-oriented clothing”, OO makes no sense at all. It is acceptable that sometimes it is appropriate to model certain things as objects, but it is not at all clear that there is any value to forcing everything into the object mould.

    C++0x [..] could do with _removing_ a few older syntaxes.
    That will never happen. The entire success of C++ is predicated upon its backward compatibility: Read The Forgotten Trojan Horse

    Lisp does sound very intriguing…. I have read too much about it….
    Heh, the Lisp crowd does have a high talk-to-code ratio ;)
    A good way to learn Lisp is said to be the (free online) book Practical Common Lisp. To get a rough idea of Lisp, one can also read Peter Norvig’s Python for Lisp programmers in the reverse direction :)
    [There are social problems with Lisp, though, and I wouldn’t heartily recommend it to anyone.]

    Finally, don’t write off Haskell. I actually think Haskell is a better language — for making you a better programmer — than Lisp. Lisp’s idea of macros and working with the syntax tree directly is cool, but there’s only so much to it. Sometimes, I like to think of Lisp as assembly language on the lambda-calculus model of computation: a lot of the “power” that Lispers claim is similar to the “power” that assembly languagers might :)

    Haskell is especially excellent for writing things like parsers and compilers (I’ve heard a Haskeller say “I will never write a compiler in an imperative language again”!) The bottleneck, as Haskell’s success goes, is the number of programmers: It *is* a hard language to learn, and a large part of the community are academics. It takes a lot of effort to advance in the Haskell ranks: “A newbie, in Haskell, is someone who has not written a compiler. They have only written a monad tutorial.” :)
    [This is “Haskell’s 90% problem”]

    I agree that learning too many languages is wasteful, and with the lesson in Slumming with BASIC Programmers. But Haskell is the language with the shortest semantic distance between your thoughts and the code, and I strongly think it is worth learning. (It’s also so *elegant*!!11one :P) Even if Haskell, like Miranda before it, is not the way of the future, ideas from Haskell certainly are. (Some of them are already finding their way into Python, Ruby, C#, and even Perl and yes, Java.)

  13. arnstein says:

    Well, just like functional programming, and procedural programming… object oriented programming is a way of thinking apart from just writing code. And so, I would say, the language shouldn’t confuse the programmer’s thinking by allowing a nasty mix of procedural and object oriented styles. If you want to do object oriented, go all the way and think completely object-oriented: think Java. Otherwise, you should be thinking in C.

    Anyway, my friend was doing an internship in UK for some bioinformatics project, and had to tackle some massive amount of C++ code that had to be ported to a Mac. That code used a lot of the Boost libraries, and he constantly bugged me for help.

    The Boost library is possibly the finest example of the C++’s bloat. The code is unreadable — not that the user’s code is written incorrectly, in fact, on closer inspection, and inspecting the source of the actual template that are being used, you will understand it is written the most *correct* way possible. There’s a mix of global functions that act on objects, member functions of objects, and some objects that are used as functions by overloading the “()” operator. Also, I would’ve thought that namespaces are good, but in this code its not hard to find things like long_namespace_name_1::namespace_for_causing_heart_problems::namespace_for_causing_blood_flow_to_heart::FlowStopper.

    C++0x cannot remove older syntaxes, I am very sure of that, and wouldn’t support any move that tries to break backward compatibility. But since I was simply ranting on the language itself, I am justified in saying that “it could do with _removing_ a few older syntaxes.”

  14. Shreevatsa says:

    The question is simply this: Why is object-oriented programming a good way of thinking? A specific way of thinking might be good for gaining experience in it — functional programming, for example — but any environment that coerces you into thinking a particular way is ultimately not going to be a productive one at all. This is exactly the argument against the nonsensical notion of “object-oriented programming”, and is what SteveY’s post is about. (And this is also why future good languages — like the Perl/Python/Ruby of today — will definitely allow a mix of objects, first-class functions, etc.)

    The Boost example perfectly illustrates the perils of verbosity and a lack of simplicity — which are precisely arguments against Java, as well as C++. A language in which you have to write a dozen lines to express a natural thought is simply too cumbersome to do anything wild. Java is _fine_ for large organisations full of mediocre programmers where “readability” (which is a euphemism for something else) is more important than expressivity, and in that sense Java is the new COBOL, but don’t expect anything truly exciting to be written in Java.

  15. mary ann says:

    hi!!! can i ask? do you know BLUE BUDDHA PROGRAMMING LANGUAGE?
    I need to know about this!!!! for my project!!!

  16. mary ann says:

    pls answer me!!! just send my e-mail mary_anngrace@yahoo.com

  17. Chasuble says:

    Somehow i missed the point. Probably lost in translation :) Anyway … nice blog to visit.

    cheers, Chasuble!!!

  18. chrisw says:

    Seems like this is very much a playground for C-programmers! And several mentions of OO, but no mention of Smalltalk, my favourite OO language and far more OO than Java IMHO!

    Readability? C permits extreme conciseness and a particular style of “elegance”. But it can often be pretty hard for the next programmer to understand what you’re doing. Good coding practice is independent of the language – if you write well-structured and well-documented code in Java or C, for example, you should be able to do so in any other language.

    As for garbage-collection (Java) vs. custom memory-management (C etc), I seem to recall reading a while back that something like 70% of bugs in C code were due to pointer errors. Now we can all be macho and pretend that “real” programmers never make mistakes and always want to manage their own RAM allocation, but in the real world programmers make mistakes (even the arrogant macho ones).

    And why should an application programmer have to waste time re-inventing this particular wheel – and risk creating a whole extra set of problems – when other languages prove it isn’t really necessary? If you’re writing a JVM or a realtime engineering app, for example, then C may well be the way to go. But if you’re working on a web-based CRM system for a bank or utility company, who needs C?

    Programming languages are tools and there is no “best” programming language, just the best tool for the job.

    A screwdriver is a great tool for turning screws, but it’s not such a great can-opener, even though you can open cans with it. If I’m writing a DB query, I use SQL, even if I could write the query in C, because who in their right mind would actually do so? Similarly, I could try to build my own car every morning in theory, but in practice I’ll use the one that Volvo already built for me!

  19. quantblog says:

    yep, its all kind of true.. reading this article, I’m reminded of Paul Grahams blog on the “100year language”. I think his lisp kaons are great and make a better lisp, and I enjoyed hacking up some web apps in arc, but I wonder whether arc should just be the ‘Paul Graham standard macros’ and maybe there is no need for further syntactic sugar?
    Certainly his DSL for emitting HTML was very nice, if you haven’t seen that before. Maybe lisp is the 100 year language, or maybe Haskell… watch this space.

    LISP got me looking at other functional languages [and I had been a died-in-the-wool C and C++ programmer thus far] For example, K of the KDB+ in-memory database, some ML-derivatives and Haskell. [fyi, K is a fairly terse map reduce style lang that comes with the commercial KDB+ database, and the combination is el supremo for processing stream data. Theres a bundled Q language that is less terse and a good place to start, before tackling K] Haskell is also superb – have a look at Simon Peyton-Jones video talk, its a great intro to Haskell and FP style in general.

    Recently I’m toying with the following idea – is it possible to write semi-functional style code in ansi C ? So I have this C header with verbs for handling arrays, that lets you program without so many repeats of for(i=0;i<n;i++), and it feels as if your thinking more at the right level of abstraction – making verbs act on vectors of data.

    I think the low hanging fruit for improvement is SQL. I think its creaking at the seams, although I unfairly lump in stored procs with my judgment here. There’s got to be a simpler cleaner way to specify queries…

    In the 21st century databases should come with callback events and a reasonably sane inbuilt language – maybe that language should be python or ruby given the audience? People are proposing specific extensions to SQL for Stream databases, but after looking at K I think theres a strong argument for a better ubiquitous DB-embedded language with powerful primitives and a light functional style.

    ok, rant over… [the vfuncs C code is at quantblog.wordpress.com or google code]

    gord.

  20. pizer says:

    Nice post! Here’re just a couple of comments:

    C++ virtual functions and mistyping:
    Go for abstract base classes with no data members if you want Java style interfaces. The compiler will give you an error if you forgot to override a pure virtual function.

    Events/Callbacks/Signals for C++:
    Function pointers still work as usual. TR1::function, Boost.Signals or libsigc++ may be very helpful, too.

    Memoryhandling and resource management in general:
    I’m totally fine with what C++ has to offer: RAII. I don’t need “shared ownership”. And If I did I would probalby make careful use of shared_ptr and weak_ptr. The purpose of weak_ptr is to break the reference cycles you mentioned. Manual management doesn’t have to be messy. I think when you stick to a certain programming style and design principles these things get a LOT easier. Still, it just might be me in that I don’t have the same problems to solve as you.

    Cheers!
    P

  21. Lucian says:

    Try Python or Ruby.

  22. Shari Lovell says:

    If I had a greenback for every time I came to arniealmighty.wordpress.com.. Great writing!

  23. Hacker says:

    I only respect C and LISP. The END.

  24. Neoma Caputo says:

    I don’t waste my free time in watching video clips except I go for to read articles or reviews on net and take updated from newest technologies.

  25. Even so, the usual aim shown with textbooks would be to acquire while close to 21 without
    going over. Managing your dollars with the year

  26. ReemeBels says:

    Hello! My name is Daniella Humphery and I live in Orland Park,IL. I have read your blog post about The Best Programming Language? | Arnie Almighty and I want to say that I am quite impressed with your professionalism on the subject!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: