Re: Java blunders
On 7/28/2014 5:59 PM, Josip Almasi wrote:
On 07/22/2014 08:41 PM, Roedy Green wrote:
I have composed an essay about what I consider were the blunders in
the design of Java. I hold out hope many of them will eventually
be fixed. You might like to add to the list.
see http://mindprod.com/jgloss/javablunders.html
OK that's an interesting topic, thanks!:)
Let me add a few:
1) Multiple inheritance
Diamond problem, uh, it's hard, it's sooo haaaaard... let's skip it.
But you can extend two java classes in jython, and use new class in
java. Problem solved.
More like problem created.
And we have multiple inheritance in JavaFX, right?
No.
It was part of JavaFX Script that was ditched.
So, why not in java SE?
Because it is a bad idea.
And in modern language design I believe that traits are usually
preferred over multiple inheritance.
That's feature critically lacking in java.
You have a rather low bar for a feature being critical lacking. It
is not that common to need multiple inheritance.
3) Beans, beans everywhere!
Using setters/getters for database access leads to retarded data models.
They don't do anything but accessing a private variable value.
Much the same with data transfer objects and many other applications of
beans, but to lesser extent.
Only technical reason for this nonsense is Proxy, which is not available
for variables, for public method call can be intercepted, and public
variable access can not.
Err... waitaminit.
I always have a database access abstraction layer anyway.
That layer knows when anything is accessed, and has no need to intercept
anything.
I don't think this make much sense. Encapsulating fields in
methods provide other benefits than proxy.
And intercepting in critical in database access layers to
implement lazy loading.
4) Error handling
Can I have central error handler please?
Isn't that what Thread setDefaultUncaughtExceptionHandler provide?
It is not very useful, but then central error handler usually are not.
Arne