Sasha Pachev wrote:

Jochem van Dieten wrote:

Sasha Pachev wrote:

Heikki Tuuri wrote:

C versus object-oriented lanuguages like C++/Java is a topic I have
discussed a lot with programmers. I believe that traditional procedural
approaches and languages, like C, are the best for 'systems programming', by
which I mean implementing anything with complex data structures and lots of
parallelism. A DBMS is a typical example of such a complex program.



3) A weakness of C compared to Java is memory management. In C you can
easily write programs that leak memory or run over allocated buffers. In
practice, it has turned out to be relatively easy to keep these memory
management bugs at a tolerable level in our C programs, so that a move to a
language with automatic memory management is not needed.



In Java is it easy to write a program that wastes large amounts of memory, which is worse than a leak. In C, you are full from the start, and then you leak a drop at a time until you are empty. In Java , you are empty from the start, and you have nothing to leak anyway even if you could :-)



http://citeseer.nj.nec.com/shah01java.html


That's nice, of course. But can you think of a one database server written in Java that comes anywhere close in performance and reliability to their C/C++ counterparts?

I suspect that a hard-core tough system software (in Heikki's sense) programmer, the kind of guy it would take to write high-performance and high reliability code, finds Java unappealing. Java's safety mechanisms are helpful when you do not quite know what you are doing. When you do, for every instance of help, you get ten instances of hindernance.

The problem is that C took off for, amongst other reasons, being just the right distance from the metal. It's close enough so you can write things that execute quickly yet has useful enough abstractions so that you can represent whatever data structures you need with a reasonable amount of effort.

Personally, I think Java's memory management advantages are terribly overrated. Some of the dodgy things you can do in C with malloc() allow you to very efficiently allocate ahead of time without initialising all that pre-allocated space ready for usage as whatever struct it is you're intrested in.

Additionally, Java's main strength is arguably the sheer number of libraries it comes with. Another great strength is the community-accessible documentation, but this can also be a problem as every single one of my friends at uni insists that to use any class that is provided with ther JDK, you must extend it. The old recommendation of favouring composition over inheritence seems to be lost on them.


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to