Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

Java, the OLPC, and community responsibility

The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
Replies: 162 - Pages: 11   [ 1 2 3 4 5 6 7 8 9 10 | Next ]
  Click to reply to this thread Reply

Better, faster, stupider Java

At 10:14 AM on Nov 16, 2005, Ed Burnette Javalobby Junkies wrote:

Lately there has been a lot of talk about "improving" the Java language. In response to C#, JSE 5 introduced generics, foreach, autoboxing, and varargs among other things to make it "easier" to program in Java. Annotations are supposedly much "cleaner" and more "powerful" than doclet comments. Now in response to C#3 there are proposals for even more changes. Will today's Java programmer even be able to read tomorrow's code?

This has got to stop. I like the next new thing as much as anybody (probably more than most), but look, Java is not C#. Java comes from a variety of vendors, and C# comes from one. If C# changes, that vendor will create a new version of the .Net framework and push it out to everybody's machine. Java doesn't have that luxury. We still have customers running 1.4.1 and will have for at least another year because it takes a while for the JVM vendors and open source implementations to catch up.

And why should they? Is Java great because of cool language features? Would it be more popular if you could skip a couple curly braces here or an extra cast or function call there? No, just the opposite.

New language features make Java less great. And to a lesser extent, so do new features in the core java.* and javax.* libraries. Like new methods on commonly used classes such Integer and String. Is this heresy? Probably, but I'm sure it's right.

Take the example of Mylar. Mylar is a plug-in for Eclipse and, being written from scratch, the developers decided to use all the newest features of JSE 5. One little problem, not everybody could use JSE 5. For example there is no JSE 5 support on RedHat Linux with GCJ. Oh, there probably will be someday, and maybe there are workarounds with retroweaver or something but that's not the point.

Java is great because of the huge amount of 3rd party software available for it. The majority of open source software in the world today is written in Java. It's nearly ubiquitous. But Java has to stabalize or we'll lose that advantage. It's 10 years old and it should be mature. Not dead, just mature.

Right now there's kind of a backlash against new versions of Java. For example many Eclipse plug-ins are being recoded to work in what they call a Foundation environment. This is a subset of Java which works on older versions, smaller VMs, constrained environments. While it's not as sexy as taking advantage of every new thing coming down the pike it makes the software usable in a whole lot more places than it would otherwise be.

Language guys love to tweak. I know, because I'm a language guy myself. I used to work on compilers, code generators, libraries, and debuggers. We were always adding new stuff, new commands, special keywords, etc. Did our users thank us for it? Maybe the one or two that wanted the new things, but the vast majority would just groan when a new release came out. What will this break now? Will I have to upgrade? Will I have to use somebody else's code that requires this new thing before I'm ready? Has it been ported to all the machines I need to run on? Boring, I know, but very practical and important issues.

My suggestion? Hold the line at the JSE 1.4 level or earlier. Set your IDE to not allow JSE 5 and over language or library dependencies creep in unintentionally. You still get the advantage of the run-time improvements of up-level JVMs, such as better memory allocation algorithms and better JIT code generation without changing one iota of code. If you look at all the changes in JSE 5 and beyond, ask yourself honestly, Do I really need this? Am I gaining more than I'm giving up by locking myself into that? Almost always the answer will be "no".

So when do I think it's safe to use JSE 5 level features? At the earliest, not until JSE 5 runtime support has become ubiquitous. By that I mean when it is production and supported on all platforms including the pure free/open source ones, and everbody has had a chance to deploy it and shake the bugs out and get comfortable with it. This is especially true the lower you sit on the software stack. The more people use your code, the later you should convert. It may be, you should never convert, or even go back to Foundation levels to achieve wider adoption. That's up to you.

In summary, innovate outside the language and the core libraries, in those places where the power of Java really lies. And innovate in new languages that have no existing base. Just quit making Java a moving target! Minor tweaks, I've got no problem with, but wholesale changes that try to morph Java into something quite different, I do. Accept its maturity as a good thing, as a strength that can be built upon, not as a weakness that needs to be corrected.

(with apologies to Bruce Tate for the subject)
  Click to reply to this thread Reply
2. At 10:56 AM on Nov 16, 2005, murphee (Werner Schuster) DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

Actually, it's not just GNU CLASSPATH and other free VMs that lack Java 5 support.

Just look at Java on MacOS X... seems like the Java version is fixed for a MacOS X version... meaning that you only get Java 5 if you have MacOS X Tiger... (Is that actually true? This http://www.apple.com/macosx/features/java/ still only claims Java 1.4.2).
So: if you don't want or can't update your Mac to Tiger, there's no way to get Java 5.
There's a reason why even Eclipse 3.2 is targetted towards a Java 1.4.2 runtime (for running Eclipse).
  Click to reply to this thread Reply
1. At 10:58 AM on Nov 16, 2005, Stefan Langer DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

I wonder where we would be if nobody moved on...
  Click to reply to this thread Reply
3. At 11:13 AM on Nov 16, 2005, Michael Javalobby Newcomers wrote:

Re: Better, faster, stupider Java

Hm, I can't agree with this. I would love to see more of java enhancements. Some things are just too complicated to implement in Java or need too much time. I like to use generics but without typedefs it's only 50%. So often there is a need to convert between types to be able to use some functions (i.e. Collections.sort()).

About eclipse in genaral: I love the many ways that eclipse helps you in writing java code but compared to the Microsoft tools it's a pain to write a dirty little gui application (i.e. for learning apis etc.). Visual Editor is too slow and buggy in my eyes. Maybe there is a better way to do it with eclipse? Is there a way to integrate user defined objects with VE in a simple way?
  Click to reply to this thread Reply
4. At 11:38 AM on Nov 16, 2005, Dave Lopez DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

Ed is right about a couple things. Microsoft has never cared about so-called simplicity like Sun. As far as Microsoft is concerned, C# can become another C++ and if it's too complex for some then they can use VB or Microsoft will just come up with another language to ride on top of the CLR and the framework.

But Java doesn't exist in a vacuum. There are features that many people wanted such as enums, varargs, a foreach, etc...that make sense and then some features such as generics that might not make as much sense especially considering the way it was implemented.

Then there are the "agile" languages such as Ruby and Python that people are using. They don't have the powerful IDEs that Java has, but then many people don't see the need for them either.

The way I look at it, Sun needs to stop adding language features, concentrate on making the VM as language agnostic as possible, and come up with an "agile" language that is statically typed via type inferencing (maybe something like Boo). And at the same time develop a powerful IDE to go along with it. Let's face it, Java has too much boilerplate code associated with it.

The whole "let's see what Microsoft is doing with C# and then copy it" seem like a losing proposition. Sun needs to leapfrog Microsoft and come up with something that is powerful but simple. They're trying to come up with the new Fortran via Fortress, they need to either adapt a current language or come up with something else for the next generation.
  Click to reply to this thread Reply
6. At 11:39 AM on Nov 16, 2005, Konstantin Scheglov DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

> About eclipse in genaral: I love the many ways that
> eclipse helps you in writing java code but compared
> to the Microsoft tools it's a pain to write a dirty
> little gui application (i.e. for learning apis etc.).

MS C# tools (as Delphi) may be good for little GUI, but without good layouts it is hard to use for complex forms.

> Visual Editor is too slow and buggy in my eyes. Maybe
> there is a better way to do it with eclipse? Is there
> a way to integrate user defined objects with VE in a
> simple way?

Not VE, but GUI builder for SWT/JFace/Swing: http://www.swt-designer.com/
Konstantin Scheglov - Java GUI developer
SWT/Swing/ GWT Designer - SWT/Swing/GWT GUI designer for Eclipse
  Click to reply to this thread Reply
5. At 11:51 AM on Nov 16, 2005, Silvio Bierman Occasional Javalobby Visitor wrote:

Re: Better, faster, stupider Java

I strongly disagree. There is a difference between stopping all development and only add features that add power without increasing the language complexity.

Good examples already implemented in Java: none
Bad examples: generics, annotations, autoboxing

Some language extensions can actually make Java programs easier to develop and read. They can also take away the need for much syntactic sugar.

Closures is probably a very good example of this. Languages supporting closures enable very elegant programming styles and standard libraries. Languages lacking that support normally need to compensate with syntactical constructs. The last thing we need is more syntax enhancements. The new for-loop syntax is a perfect example of this.

Regards,

Silvio Bierman
  Click to reply to this thread Reply
7. At 1:00 PM on Nov 16, 2005, Andy Tripp DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

Ed,

Very well said. I agree with everything you say here.

I don't have a link handy, but I remember Stroustrup talking about the rationale for C++ purposefully remaining stagnant for about 10 years. His thinking was the same as yours here, that the language had pretty much everything it needed, and it was time for stability.

Here: http://www.research.att.com/~bs/DnE2005.pdf
he also says "...As I predicted, Java has been accreting new features over the years so as to negate its “original virtue” of simplicity..."

I think it's already to late to "hold the line at 1.4". 1.5 is here to stay, people are already using it.

I think the most important issue is how can we ensure that there are no language changes to 1.6 and beyond (unless there is really a huge consensus that they're needed)? If something gets proposed for 1.6 or later that's even as questionable as the 1.5 language changes, we need to be able to defeat it. Does anyone know enough about the JCP process to comment on how that might be done? Or are we doomed to have any new feature added because there are likely to be enough proponents to push it through?

Seems like the JCP may be a bit like Congress...no real way to stop the pork.
Andy Tripp, CTO and Founder Jazillian - Legacy to 'natural' Java.
  Click to reply to this thread Reply
8. At 1:03 PM on Nov 16, 2005, Andy Tripp DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

> Sun needs to leapfrog Microsoft

Sun and MS are software companies and not kids on a playground, so your leapfrog comparison doesn't work :)
Andy Tripp, CTO and Founder Jazillian - Legacy to 'natural' Java.
  Click to reply to this thread Reply
9. At 1:06 PM on Nov 16, 2005, Alex Dolftei DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

A language has to evolve in order to survive. And community oppinions aren't always the best thing to consider ... because of the `community` we now have to declare final arrays with 1 element whenever we want to simulate closures with annonymous classes.

New language features make Java less great because they are incompletely implemented. Generics are half baked only because the backwards compatibility is a concern.

Productivity is no.1 on any programmer's wish list. Not being locked to Microsoft is on second :D , and maturity is on third.
If maturity was our primary concern, why not stick with C++ and dismiss Java since `95 ?
  Click to reply to this thread Reply
10. At 1:15 PM on Nov 16, 2005, Dave Lopez DeveloperZone Top 100 wrote:

Re: Better, faster, stupider Java

Andy, I know in your world everything is an analogy, but this wasn't the case. Please consult a dictionary.
  Click to reply to this thread Reply
11. At 1:36 PM on Nov 16, 2005, Ed Burnette Javalobby Junkies wrote:

Re: Better, faster, stupider Java

Ok let's look at closures. If closures were added now, it would be some half-baked poorly understood graft like generics. Closures are fine in languages that were designed with them in mind. Instead of adding them to Java, I would argue you should consider another language like JRuby. Or use the idioms and patterns that have come into standard practice to do closure-like things. An experienced Java developer reads and writes those idioms naturally.
Ed Burnette
Author, Google Web Toolkit, Eclipse IDE Pocket Guide, Eclipse in Action
ZDNet blogger, Dev Connection; former Top Eclipse Ambassador.
  Click to reply to this thread Reply
12. At 1:38 PM on Nov 16, 2005, Ed Burnette Javalobby Junkies wrote:

Re: Better, faster, stupider Java

If you plant a flower today then come back every so often and pull it up to move it somewhere else, you're not going to have a very healthy flower. But there's nothing to stop you from planting a different flower in the new place.
Ed Burnette
Author, Google Web Toolkit, Eclipse IDE Pocket Guide, Eclipse in Action
ZDNet blogger, Dev Connection; former Top Eclipse Ambassador.
  Click to reply to this thread Reply
13. At 1:40 PM on Nov 16, 2005, Ed Burnette Javalobby Junkies wrote:

Re: Better, faster, stupider Java

True, and at $129 an upgrade, I'm going to keep whatever version is running on there until it croaks.
Ed Burnette
Author, Google Web Toolkit, Eclipse IDE Pocket Guide, Eclipse in Action
ZDNet blogger, Dev Connection; former Top Eclipse Ambassador.
  Click to reply to this thread Reply
14. At 1:50 PM on Nov 16, 2005, Gunnar Wagenknecht Javalobby Regulars wrote:

Re: Better, faster, stupider Java

Ed, you are right. Java doesn't need more language constructs that make reading code even more difficult. What it really needs is more innovation under the hood, for example better integration into operating systems, desktops, native environments and performance and memory usage.

thread.rss_message