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: 8 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Not Invented Here - Java modularisation

At 6:36 PM on Oct 19, 2006, Alex Blewitt DeveloperZone Top 100 wrote:

No-one can deny that in the last few years, Java development tools have become much better. The three main Java IDEs are Eclipse JDT, IntelliJ IDEA and NetBeans (as well as Eclipse JDT-derivatives). The competition between them has resulted in major advances; IntelliJ IDEA, as the commercial heavyweight, has had to innovate to justify its price (and by all accounts, well worth the money) -- but Eclipse and NetBeans have been snapping at its heels (and of course, each others'). Other non-Java development tools haven't tended to improve as quickly over the years, pretty much due to a lack of competition.

But at some point, competition for the sake of it becomes re-hashing old ideas, and often in a less constructive way. For example, Sun relatively recently added the java.util.logging API, which is seen as inferior by many to the de-facto Log4J. One of the main problems with introducing it as a core library is that it's not available on older VMs. (I have a separate beef about the problems with bundling core libraries as part of the JVM; but that's not the point of this entry.) From all accounts, it was seen as Sun with Not Invented Here syndrome, needing to roll out their own.

More recently, Sun have released an early draft of JSR 277 for modularising JARs. The goal is to provide versioned dependencies between JARs and to treat JARs as modules (by providing extra meta information in the JAR itself, computed from annotations in Java code). It seems to be quite closely related to JSR 294 in that both deal with modularisation of Java modules; but seems to require additional changes to bytecode to make it happen, and as such, it will only be available from Java 7.0 (or J2SEv7 or Java JDK 7.0.1_b42 or whatever it will end up being called ). As Elliotte Rusty Harold put it: "if inner classes and generics did not require VM level changes, this proportionately smaller change shouldn't either?"

Peter Kriens (of the OSGi Alliance ) is also less positive about JSR 277. (Perhaps that isn't too surprising; the OSGi framework is submitted as JSR 291 ; however, the OSGi framework is actually being used by millions of people right now, whereas JSR 277 is still in early review form.)

What's particularly amusing is that the JSR has a section entitled "Why isn't this need met by existing specifications?", in which they try and justify the reasons why OSGi isn't sufficient ... amongst other things: "Because the versioning semantics in the OSGi framework is simplistic, it is not a sufficient solution to address the JAR referencing problem." Of course, the ironic thing here is that the OSGi versioning is both well defined, and can have abitrary fixed versions, or ranges (with either open or closed ends). The JSR 277 defines versions by using 1.1* or 1.1+. Care to guess what those mean? The first means anything from 1.1 to 1.999; the second means 1.1 to 9999.99999. These are relatively easily explained using the (well-known) mathematical notation that OSGi adopts, using [1,2) or 1 respectively. So it seems the argument about versioning is fallacious at best; unlike well understood mathematical intervals, they've chosen to come up with their own variants that isn't easily capable of representing ranges like [1,5).

Also, the versions are specified as 1.2.3.4.qualifier. I'm not really sure why people need that many numbers; there seems to be enough difficulty with the third digit as is in Eclipse, let alone adding a new level for no particular reason. However, one nice part is that 1.2.3.4.qualifier is seen as less than 1.2.3.4; presumably, with the idea that people will release 1.2.3.4.beta1, 1.2.3.4.releasecandidate2 etc. all of which will seem as less than the final 1.2.3.4 when it's released. It's almost a shame that this idea wasn't mooted with the original OSGi stuff; but it's a bit of an assumption about what you're going to use the versioning for.

I think Peter sums it up best at the end of his blog:

"The only way this EG can pass its final review is lack of attention for detail of the Executive Committee or alternatively, serious muscle power of SUN. JSR 277 is a missed opportunity for Java. I do not doubt that this specification will end up in Java 7, but it will further fragment the Java world for no technical reason."
  Click to reply to this thread Reply
1. At 4:21 AM on Oct 20, 2006, Neil Bartlett Javalobby Regulars wrote:

Re: Not Invented Here - Java modularisation

If you read the answer to the "why isn't this need already met" closely, you'll notice that the original version of the JSR said that "OSGi" is not capable of various things. Then, evidently, somebody pointed out that those things are in fact possible in OSGi R4. So they merely changed the JSR to read "OSGi R3 is not capable of various things".

Err, hello? No JSR should exist without a valid answer to the question "why is this need not already met", and JSR 277 has failed to give an answer to it.

The other very important point that Peter made in his review was that JSR 277 is not dynamic in any way. Changes to the module graph require a restart of the VM; you cannot install and uninstall modules on the fly, in the way you can with OSGi bundles.

Given that JSR 277 was specifically targetted at JEE environments, does this mean we won't be able to hot-deploy EARs any more? Or does it simply mean that platforms like JBoss will have to continue using their hacky custom classloading architectures - the ones that give developers no end of headaches?

Or perhaps it means that more JEE platforms will start to move to OSGi... as WebSphere already has done , JOnAS is doing , Geronimo may be starting to do , and I'm beginning to wonder about WebLogic ...
  Click to reply to this thread Reply
2. At 4:34 AM on Oct 20, 2006, Marko Schulz Javalobby Newcomers wrote:

Re: Not Invented Here - Java modularisation

As quite often the comments on the votes are interesting. Almost all of them name OSGi, yet nobody dared to say "no".
  Click to reply to this thread Reply
3. At 10:38 AM on Oct 20, 2006, Alex Blewitt DeveloperZone Top 100 wrote:

Re: Not Invented Here - Java modularisation

Yeah, especially:

"On 2005-06-27 Google Inc. voted Yes with the following comment:
Google believes it is critical that the JSR-277 expert group focus on the linguistic aspects of this design. If done well, this JSR has the potential for great improvement to the platform; if done poorly it has the potential for great harm."

Also, both BEA and IBM note that OSGi R4 should be used as a starting point (which doesn't appear to have been the case). As both of these vendors already use and support OSGi, I don't think they're likey to be overly bothered if a non-compliant JSR goes through, as they'll just ignore it.

Mind you, it's also worth observing that the votes came out in June of last year, and that was whether the group should start (rather than the actual early draft text that was published earlier this month). Also, the group was formed in June 2005, and OSGi R4 was released in October 2005 (which is probably why/when the spec was updated to show that it reflected the views of OSGi R3).

I think the telling comment comes from Sun, as the first comment:

"It has been pointed out that OSGi R4 addresses some of the
concerns expressed about OSGi R3. Happiness. We will
be happy to treat OSGi as one of the inputs to this JSR."

I think they treated it as something you don't want to step in on the street ...
  Click to reply to this thread Reply
4. At 10:39 AM on Oct 20, 2006, Fred Grott DeveloperZone Top 100 wrote:

Re: Not Invented Here - Java modularisation

This might also have to do with other Sun interests moving towards OSGi such as Apache Geronimo which also means IBM WASCE as well with release of Apache Geronimo 1.2..

Sun has in the past tried or attempted to use the JCP JSR process as a battering ram against market competition..

I prefer OSGi..
Fred Grott, ShareMe jabber:fg82183@conference.javalobby.org(shareme) Official contributor to EclipseZone.com and supporter of JavaLobby.org.
  Click to reply to this thread Reply
5. At 9:12 AM on Oct 22, 2006, Steve Northover DeveloperZone Top 100 wrote:

Re: Not Invented Here - Java modularisation

Can you name other instances where Sun has done this?

Steve
  Click to reply to this thread Reply
6. At 7:08 PM on Nov 6, 2006, Alex Blewitt DeveloperZone Top 100 wrote:

Re: Not Invented Here - Java modularisation

There are other discussions on this here , and the announcement at the early draft . And, in the spirit of open communication, the thirty comments on Stanley Ho's blog have been deleted, only leaving three comments on the blog.

Not invented here -- and dissenters will be deleted.
  Click to reply to this thread Reply
7. At 8:07 AM on Nov 8, 2006, Alex Blewitt DeveloperZone Top 100 wrote:

Re: Not Invented Here - Java modularisation

Turns out that the blogging software was at fault for the lack of comments; the current comments can be found at the current verson of the blog page . The blogging software apparently generates a new page when it's edited, so the comments on the ( old version are distinct from the comments of the new version . Perhaps he should be using Pebble instead ...

Alex.
  Click to reply to this thread Reply
8. At 1:28 PM on Nov 16, 2006, Alex Blewitt DeveloperZone Top 100 wrote:

Re: Not Invented Here - Java modularisation

Scott Delap just pointed me in the direction of a response to this subject atInfoQ . The questions raise important issues and ask why JSR277 is necessary given that we've got OSGi at the moment.

I was particularly interested in the quote:

JSR-277 and JSR-294 are attempts to produce a module system to address these problems directly in the next generation Java SE platform, with versioning support, new distribution format, repositories, and built-in language and JVM support.


I'm not sure that JSR-294 attempts to standardise on the repositories, but we've already got the OSGi spec here, working, and (as mentioned earlier today ) a number of different implementations available.

It's also (still) not really clear why we need changes to the language or the core to make it happen, given that all it will do is prevent it from working on older VMs (whereas OSGi runs fine on hand-held devices through to supercomputers). In short, they've started from the position "We must have modifications built in to the JVM and the language", and then used that to justify the changes to the language necessary to take advantage of changes in the language. For goodness sake, why? The more things you mandate will work in a newer version of the VM, the more you cut out old VMs from using it. Instead of adopting it, it will be avoided in droves; just look how successful the Java logging API or EJBs were when dominated by simpler systems like Log4J and Hibernate.

The answers finish with:

Besides, JSR-277 is as much an extensible framework for module systems as it is a module system. Its inclusive architecture allows 3rd parties to plug in alternate implementations for the repository mechanism and for the actual module system implementation. In other words, it can serve as an umbrella under which various existing systems can sit and add values. We are still working out many of the details and would appreciate feedback on this topic.


So, they're building an API that can be used to provide modules, and they hope by becoming the standard, other implementations (read: OSGi) can use that standard. Is this going to be of any use to anyone? You're not going to get (say) an OSGi bundle being stored via a JSR-277 repository being used in a NetBeans platform, or for that matter, a NetBeans plugin being stored in a JSR-277 repository being used in an OSGi runtime environment.

No other answers about the versioning format (yes, Sun, you really are the only people who have that anal version numbering problem -- you can't even get your marketing and developer guys to distinguish between Java 1.5 and Java 5.0, for goodness sake.). Still, they want comments about their proposal so far, so you should feel free to mail them at jsr-277-comments at jcp dot org .

You can read the remainder of the question and answers at InfoQ's interview . What's your take on it? On a scale of one to EclipseCon, how transparent is their process?

thread.rss_message