Re: Why do some people hate java?
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Tue, 13 Mar 2007 21:18:02 -0400
Jon wrote:
On Mar 12, 6:41 pm, Arne Vajhøj <a...@xxxxxxxxxx> wrote:I think most agree that multiple inheritance and explicit deallocation
of memory is a bad thing.
C++ templates can do some things that Java generics can not. And
vice versa. They are simply relative different concepts.
You can do things with multiple inheritance that can never be done
with interface implementations alone. Can it be abused? probably.
Does that justify tieing the programmers hands? I would argue no.
It is very rare to have a need for multiple inheritance.
And experience has shown that the dreaded DoD often surprise
people.
I find the statement that "explicit deallocation of memory is a bad
thing" to be laughable. It assumes that this MUST be done in C++. If
you look at boost shared pointers and the like you will find that
object lifetime can be easily and, more importantly, predictably
managed. There seems to be an implicit assumption in this rather
childish statement in the philosophy behind garbage collection that
memory is the only resource that must be managed. File handles,
network connections, and other resources that are just as important to
manage and must be managed in a way that is more deterministic that
can be done by relying on garbage collection. The result is that, if
you code a class in Java that must manage one of these resources, you
MUST add methods that allow the application to release the resources
and these MUST be invoked before the object reference is released.
So, tell me again, how does GC really help here??
You can write "laughable" and "childish" many times.
Any programmer who have worked with C/C++ knows that
there is almost always some team member than manage
to create a memory leak.
If all programmers were perfect, then GC would not be necessary.
Except for the improved performance.
That automatic memory release does not handle non memory resources
is not particular surprising. But I can not see it as an argument
against automatic memory release.
- Lack of unsigned integer types. I realise that, with two's
complement math, the math operations between signed and unsigned is
all the same. However, I find that not being able to use unsigned
types results in sign extension in places where it was not expected
and results in casting/masking operations that only serve to clutter
the source code.
- Bit shift operations only appear to be implemented for the integer
type. The result: if I am trying to do bit shifts on something
smaller than an integer, a byte or a short, the arguments are promoted
to integers and the reslt of the shift is an integer. So in order to
assign that back to something smaller than an integer, guess what,
yet another cast is needed.
I agree.
It seems to be easy to forget that there are reasons for writing
programs that transcend the language or environment in which it is
developed. At the end of the day, my value to my employer is not in
the languages I have mastered but in what I can produce that can solve
our customers problems and/or needs. To the extent that the language
and/or environment facilitates that, it becomes a valuable tool. To
the extent that the language/environment fetters that, it becomes less
valuable and less likely to be chosen as a tool. No language or
environment is free from blemish. Java has some real advantages but I
do not consider it a replacement for what can be done in C++.
C/C++ will exist for many years. It may outlive Java and C#. But the
usage of C/C++ is going to be small in the next decade compared
with Java, C# and the scripting languages.
Arne
.
- Follow-Ups:
- Re: Why do some people hate java?
- From: Mark Space
- Re: Why do some people hate java?
- References:
- Why do some people hate java?
- From: samir
- Re: Why do some people hate java?
- From: Arne Vajhøj
- Re: Why do some people hate java?
- From: Jon
- Why do some people hate java?
- Prev by Date: Re: Trouble installing Tomcat 5.5 on Windows XP
- Next by Date: can Java do this?
- Previous by thread: Re: Why do some people hate java?
- Next by thread: Re: Why do some people hate java?
- Index(es):
Relevant Pages
|