Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what features of java need further improve ?

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, was wondering since java are so powerful currently, are there any features that sun should taking care on further enchance or improve it ?
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there is always something extra one wants, right? That's why SUVs get bigger every year...

I agree with you that the language and library seems pretty complete. Hopefully, Sun will focus future JDK versions on making programmers' lives simpler and more productive.

If I could ask for one thing, it would be properties, like in VB and C#. I am tired of coding getFoo/setFoo. I know that Eclipse could do it for me, but it's not the same thing--I still have to read all that code.

If I could ask for one more thing, it would be better syntax for trivial inner classes. I hate

myButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { /* ok, what did I want to put in here? */ });

Another thing that I see cropping up in scripting languages such as Groovy is a more compact notation for lists, maps, and so on. That sounds like a good thing too.

I'd like to know how others feel about this issue? Do we need more libraries? Do we need more convenience built into the language? What would you ask for if you had three wishes?

Cheers,

Cay
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Another thing that I see cropping up in scripting languages such as Groovy is a more compact notation for lists, maps, and so on. That sounds like a good thing too.

Scripting language, just like some short forms, in fact is simplifed for developers to write codes, however, the compiler will still transform it back to old-day-style Java codes, isnt it? I have this feel from the experiences of JSP scriptlet and Servlet codes.

Even though it does not affect run time performance, but compiler developers might need more effort to parse and perform the transformation.

Nick
 
Mark Neher
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pet peeve has always been the clunkiness of formatting. Coming from a C background, I've missed the power and simplicity of printf/scanf type statements.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Neher:
My pet peeve has always been the clunkiness of formatting. Coming from a C background, I've missed the power and simplicity of printf/scanf type statements.

I think I have to agree with this. Fortunately, this feature is now included in Java 5!

As for my wish list, a simplified I/O system would be nice. Don't get me wrong, the current java.io package provides a lot of power and flexibility. However, when you are starting to learn Java, it is quite overwhelming.

Layne
 
Matthew Gerring
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps SWT / Jfaces in the core Java distribution? Then GUIs would really start to compete with other toolkits. Perhaps this is already slated for a later release of Java?
 
Jayesh Lalwani
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cay Horstmann:


If I could ask for one more thing, it would be better syntax for trivial inner classes. I hate

myButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { /* ok, what did I want to put in here? */ });


I like the .NET way of declaring methods as event handlers. So, if Java supports that, then the above will look like this

public void buttonActionPerformed(ActionEvent event)
{
// do what I want to do
}

myButton.addActionListener(buttonActionperformed)
 
Cay Horstmann
author
Ranch Hand
Posts: 172
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I like inner classes better than .NET delegates because I can reference final local variables from an outer scope (i.e. they are closures).

If you don't care about that, you can use EventHandler in Java:



Maybe we could lobby Sun to add a convenience method to EventHandler, like this:



Cheers,

Cay
 
Jayesh Lalwani
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I agree that inner classes have advantages over .NET style event handlers, like being able to acces final local variables. But, inner classes are just too darn hard to read. Also, I have seen many newbies get confused by the inner clases. If you just casually glance at the code it looks like the implementation of the inner class is part of your function, but it's not.. well it is..sort of.

Inner classes definetly have their uses. I'm not saying Java should'nt remove Inner classes. However for most implementations, the listener function can be easily put in a private class level function. It makes the code much easier to read

Usually, unless one of my developers has a good reason to do otherwise, I recommend them to do something like this



compare that with this



Now if someone is glancing through the second version, it looks like "int i" is part of function "setup".. which it's not
[ November 18, 2004: Message edited by: Jayesh Lalwani ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic