About OSGiNews and EventsMarkets and SolutionsSpecificationsWork GroupsUsers' ForumsLinksMember Area
Hi, We're OSGi. We mean no harm2009-06-23
Dear James,
I read your interesting interview with eWeek. There were many parts where we agreed, but I was also slightly puzzled with your observations about OSGi. "OSGi is this thing that kind of came from a different universe that's being used for modularity." I do agree that many people see the quality of the OSGi specs as out this world, but that seems a bit exagerated. I do agree we did not start out in the enterprise application space, we started in embedded world where space and performance constraints are pervasive, but after all I thought we both lived in the Java universe. However, this seems at odds with your remarks like "So we needed something that was a lot lighter weight." and "... OSGi's just too much fat." Hmm, the OSGi core API is 27 classes. That is a all. Security, Module layer, Life cycle layer, and Service Layer. Exceptions, permissions, and interfaces. And one of them is even deprecated! Just the module layer in Jigsaw seems to have more classes, and they just got started ... Or did you mean the implementations? With Concierge at around 80k for an R3 implementation and Felix at 350k it seems a stretch to call us fat? OSGi is even deployed in smart cards. It's true, our documentation is a bit fat. The core is described in 300 pages. Though we have lots of pictures! And we have virtually no errata, despite the fact that OSGi has been used in tens of thousands of applications over the last decade. I'd like to tell you a little anecdote. In 1997 I tried to convince Ralph Johnson about Java. My key argument was that Java was so nicely small and therefore easy to understand. Only 11 packages! Ralph, a famous Smalltalker, looked at me wearily and said: "Just wait." Oh boy, was he right. That lesson still drives me every day to keep OSGi lean and mean, annoying many people along the way, but I guess that is the price one needs to pay. If you think project Jigsaw will be leaner than OSGi, well, modularity is a problem where size does matter. You cannot demonstrate modularity with a Hello World because modularity solves the problem of large evolving code bases. [deleted] So, James, I think that are lots of details where we did not get it perfect, but OSGi's weight is not one of them. The misconceptions about OSGi at Sun stand to cost our industry a lot of money and pain in the coming years. Project Jigsaw's simplicity is a fallacy, hidden by the fact that they do not address the hard issues that OSGi has now been working on for over a decade. All major application servers are today based on OSGi, not because it was fun or a hype, but because they had no choice. These are applications in themselves that have a scale where modularity is not an option but a necessity. The success of open source will move many Enterprise applications in this same realm. If you believe that a simplistic solution can address the needed scale, well than indeed we do live in another universe. However, please remember that we're here as friends, to help, and mean no harm. Your's sincerely, Peter Kriens CommentsClasspath hell just froze over?2009-06-12
Other blogs seems to drive this blog nowadays. Just read Classpath hell just froze over. This raises the questions where OSGi stands in the relation with JSR 294. I am not speaking from an official OSGi point of view, but I can of course give my personal opinion. I therefore posted a comment on the original blog but it turned out to be its own blog ...
JSR 294 contains 2 parts:
The module-info.java file? I have my severe doubts and have expressed this in the expert group. I do not think we fully understand the interactions with IDEs like Eclipse, IntelliJ, Netbeans, JDeveloper, etc. Currently, the command line with javac is completely driving the design while imho the IDE will be the common case for anyone needing modularity. Nobody needs modularity for a Hello World program, and letting this use case drive the design seems plain wrong. One of the problems with this approach that I'm seeing is that a lot of dependencies are already specified in the sources (import package anyone?) and that a smart IDE can help find the proper modules to import those packages from. However, selecting package for import needs a wide range of modules because when you're developing, you want completion support in the IDE. However, when you have compiled your code, the compiler knows exactly which module was selecrted out of this wide scope it was compiled against. And not to forget the build tools, they will start having to interpret the module-info file and link to the appropriate module system to find their class path. Today, a build tool tells the compiler its class path, in the future it would first have to compile or interpret the Java file. This alone will probably kill 90% of the ant scripts because the class path is used in other places then compiling. Also maven will have to start to interact with this. This is not all. The current approach for module-info.java is creating a meta-module system. Both Jigsaw, OSGi, and any other module systems can put their metadata in the file. This is the famous design by committee problem: let's each have it our own way and make the other optional. Good for vendors, bad for users. This is something that I am always fighting inside the OSGi. Having a meta-module system will cause severe fragmentation on the module layer. Some people hope for runtime interaction between module systems. Well, this will be very hard, if not impossible. Java module systems are just to complex to be able to map one to another without causing some severe pain. Then about Jigsaw. It is very focused on breaking up the JDK into modules. I like the native installers but I dislike the fact that they put this native packaging stuff in my face. Java should abstract the platform so I can write code for any platform and distribute my code in a singular form. It's Java's original promise to deploy and manage this code on all the variety of VMs/OSs/packagers out there. There are hundreds of VM's and even more VM-package manager combinations. There is no way anybody can support all of these combinations. Write once, deploy everywhere, and then run anywhere? This all goes against the original promise and architecture of Java. Jigsaw is too simple for the kind of applications in the enterprise space. Most of the class path problems are still in the module-path: split packages, no real hiding of classes (they will be protected by the module keyword only, not like OSGi invisible to other bundles), no multiple versions of the same JAR to solve hard dependency problems in large applications. Looking at Mark Reinhold's slides I think he agrees, Enterprise applications should be build on OSGi. However, small applications do not have to bother with modularity, so why allow Jigsaw to be used for applications at all? Unfortunately, if Jigsaw becomes part of the JDK delivery, people will start using it, causing immediate irreversible fragmentation. Ok, to summarize. The module keyword is heavily supported by me and other OSGi people I know. It would allow us to put the bundles in the accessibility check of the Java VM. We're not there yet, but it looks good. From a module system point of view I think we're moving into a direction of a meta-module system, where one of the two users of this meta-module system has an awful lot of homework left to do. After ten years of working on OSGi I would not yet dare to say that I completely understand Java module systems, I therefore shudder of the thought of a meta-module systems ... Hope this helps to enlighten some issues. Peter Kriens Commentstbee :
It does not :-) And frankly I do not want to completely understand. As a Java coder I want a good working module system... I want assemblies. I want "write code for any platform and distribute my code in a singular form".
Tom (tbee) Peter Kriens : Augusto :
Hi Peter, thanks for the detailed reply.
First, what is the status of 294? Is it almost completed or is there a lot more work to do? I'm a bit confused since you are part of the expert group for that JSR, I thought you guys had to come to an agreement and then the implementations would follow. But it seems Jigsaw is already in the middle of that, I wonder what that means for the JSR. I'm also not sure what you mean by the "command line" (javac) driving the design. If I understand you correctly, you mean dependencies should be automatically detected by higher level tools like an IDE. I agree that this is desirable, but on the other hand I think these language features should be as IDE independent as possible and that you should be able (even if it could be a bit of a pain) to configure a relatively simple module from say vi and javac. In this case, the current approach doesn't seem to impose much on the tooling (the native packagin piece does btw). There's also no reason why a tool shouldn't be able to pick up a lot of the dependencies from import statements and general analysis of the project's classpath. But again, if you want to do it manually you have that option. And it does seem to be more user friendly than the MANIFEST file approach that OSGi currently uses. I do agree about the complexity of a "meta-module" system, but then again I thought this was a concession to OSGi. It would also be nice to see some examples on how OSGi bundles could interact with a Jigsaw enabled VM. Say you have a bundle for log4j, do you also have to have a Jigsaw version of it at runtime for it to work or will the module system be able to pick it up and have Jigsaw modules link to it? As for the native packaging, without knowing how it will work in other platforms outside of Linux, the whole concept is still a bit too nebulous to me. I can understand the goal, but I worry too about having to have all these native artifacts around when a simpler Java specific package format would do. Anyways, I wish I had caught up to this topic before the Q&A to ask more of the questions I listed on my blog post. I hope maybe we get a chance to get some answers, and I think for the OSGi side of things, see more technical details about why the current approach is technically better for Java 7. Thanks! Augusto dleskov :
Re Jigsaw, it is already possible to dissect the JDK and stay compliant. You can in particular have an Eclipse RCP app packaged into a native installer having the size of the JRE.
keilw_id :
After the JavaEE 6 (JSR 316) presentation at DevoXX which followed the keynote about Jigsaw I also confronted the 316 Spec Lead with different wordings and paradigms behind the existing Java EE spec (e.g. "Module" is already used there to some extent) and upcoming ideas introduced by Jigsaw.
So either it remains simply for SE or there has to be consolidation and (most likely Java EE 7 ;-) coordination on that, too. Including all these vendors most notably future Sun-owner Oracle who bet on OSGi massively with their Java EE containers. OSGi Case Studies == Pain?2009-06-10
During JavaOne Atlassian presented a case study of OSGi and offered Atlassian Plugins. The presentation was very dualistic. One one side it was very positive towards OSGi but it also was (overly) critical, mostly because they ran in many problems with legacy code. This caused reactions, like the blog OSGi Case Studies == Pain.
As the OSGi evangelist I would probably say it a bit sweeter, but in principle the blog is right: don't use OSGi unless the benefit offsets the cost. Which should of course be true for everything you do. If you have a legacy application of a couple of thousands lines of code, don't bother with OSGi, it will probably be just in your way at its current incarnation. The reason for the pain is not some unnecessary complexity in OSGi, on the contrary, with less than 30 well documented classes OSGi is actually quite simple in contrast with almost any other API I know. However, enforced modularity is painful because it confronts you with all the entanglements in your code, and even worse, the hacks and shortcuts in the libraries you use. Strong modularity puts your code in a straightjacket, and often that is no fun when you have legacy code that enjoys the anarchy of the Java class path. Is that pain worth it? Well, both industry and science seems to have clear consensus that modularity provides lots of benefits for large applications. All the major Java app servers are not based on OSGi because they think it is fancy (notice that most do not provide the API to application developers), the sheer size of these systems just require strong modularity to survive their evolution. Eli Whitney was one of the key drivers of the industrial revolution because he had the idea of interchangeable parts for guns. However, it took the effort of many others and long years before this simple idea could finally be put into practice. During that transition, the skilled gun making craftsmen of those days poked fun of the whole idea and told each other jokes about how interchangeable parts weren't. I think OSGi is that simple idea of interchangeable parts for software. It is a very, very hard problem, but I am convinced it is worth pursuing. Once you have experienced how you can mix and match bundles to construct a large part of an application it is imposible to ever go back. OSGi is by far the furthest along this idea but I am the first to admit we're not there. It will require more time and effort of many, including you, to modularize our codebases and develop the tools to simplify that process. So yes, it can be a pain to move legacy code towards strong modularity but I am sure that when your applications are big enough the gain will more than compensate the pain. As many can already testify, including Atlassian. Peter Kriens CommentsAlBlue :
Don Brown clarified the presentation a little bit, saying that the slides weren't the whole story.
gterrill :
The pain isn't with the complexity of the API.
OSGi would be a lot easier if the containers supported deployment in a non-proprietary way. patrick :
We need to do more to make it easier to migrate to OSGi, and in my opinion that means making it possible to run legacy code in an OSGi container without changes.
We need to think of migration to modularity as a long-term process based on the refactoring of always runnable code. The problem is that potential OSGi developers currently need to make a lot of changes just to get their app in a runnable state, and many will not think this is worth the effort. I recently wrote about potential solutions to this problem, and I'd be interested to hear what you think. http://rcpquickstart.com/2009/06/03/making-osgi-easier/ --- Patrick Peter Kriens :
@patrick: I think this blogs try to make the point that making your code (and its libs) modular is the painful part. I do not think there are any tools or ways to automate that :-( Any tools around, and I include bnd, are just putting lipstick on a pig when the underlying code is not modular.
Peter Kriens Christian Schneider :
The biggest chance and also problem with osgi is that you do not describe exact dependencies anymore. When you only import packages and require some minimal or maximal version it means that the developer of the library has to do very good version management. If he changes an api and does not change the major number it can affect an already deployed application.
With maven you already have the same problems it compile time but with osgi it can crash at runtime. We need a whole set of new tools for this problem. Premysl Brada :
I fully agree with Christian; my view is that to have a good run-time stability/consistency we need versioning sorted out quite well. Among other things this means a scheme that is universally applied and tools that generate always correct id-s. I'll touch this issue during my talk at the upcoming OSGi DevCon in Zurich (Monday 22nd June).
Jigsaw #42009-06-03 |
Community Event Join us for the.... in conjunction with 29th to 30th Sept |
|||
|
Home | Trademark Policy | Privacy Policy Copyright © 2010 OSGi™ Alliance. Comments about the site? Send them to: OSGi Alliance WebMaster. |
With the new language feature in later versions, it could be much clear. The question is: would OSGi break backward compatibility for cleaner code?
I wrote a rebuttal on my blog to that article yesterday...
It's fine to debate technologies, not fine to have clear misconceptions.
It is always very dangerous to take your own experiences and declare it as truth, there is a very diverse eco-system out there. Backward compatibility is important, as it is important to include newer features.
That said, the OSGi API is very small and works very well on Java 5, 6, and in the future Java 7. There are very few places where the new futures of Java 5 make sense. However, most application programmers are shielded from these APIs anyway because they use a programming model like Spring, DS, iPOJO, that hides the OSGi API.
A module system is plumbing. You know the shit hits the fan when it stops working but in day to day you should not bother with it.
@Chris: nice blog!
Peter Kriens
If they were indeed political motivated, then it would appear that Sun really are digging their heels in on OSGi. Not that we should be overly worried. We live in meritocracy after all.
Actually, GlassFish team switched to OSGi because we liked the technology. We wanted to build on it as well as be part of the communities. It really had nothing to do with learning any hard lessons, in fact hk2 is used everywhere in GlassFish today as our programming model and as an isolation layer to the OSGi APIs. And I don't think we particularly hurt any community in the process.
Jerome Dochez
http://www.javaposse.com/index.php?post_id=492239
http://www.javaposse.com/index.php?post_id=492239
Let's stop on the last two word an remember a comment about him spending too much time with some diet program.
Maybe, this was caused by an obsession or did I watch too much Woody Allen movies ?
In a few words, he showed disrespect to many people with his mistake.
I remember a post or article titled smthg like "using jigsaw might get you fired".
Anyway, too bad He did not 'turn his tongue seven times' before to speak.
Before that, I supposED He knew the 'embedded world' as java was started for being used in embedded software.
Everybody can be wrong sometimes.
Wadaƫl
However, the sentence wasn't overly clean and I guess written in frustration. I've deleted it.
Hi,
I meant that his "So we needed something that was a lot lighter weight." hurt the OSGi community particularly developpers.
I am very glad GF uses OSGi now.
A five seconds startup on a decently recent machine is .... incredible when you are used to JBoss 4.
Well, of course, it is not fully ready (web layer has to be started, apps too).
From my short experience with it, GF merits its success.
I am waiting for V3 FINAL.
I discovered OSGi recently because I work with app servers and it's used in the new versions of GF, JBoss (and maybe others) so I can not discuss the pros and cons of OSGi & jigsaw.
My opinion is that something 10yo and so wide spread should be respected. Even more by someone so influencial.
The article I wrote about in my previous post can be found there :
http://neilbartlett.name/blog/2009/03/25/using-suns-jigsaw-may-get-you-fired/
Peace (and modular coding) for all
Jerome / Wadael
The "lightweight" issue reported by Gosling is a non-issue for OSGI.
It must have been spelled out by mistake.
Yet, there must be something "technical" that prevents jdk-7 architects from basing its modularity on OSGI!
(see jsr294)
Whether this is:
* java 1.3 compatibility
* slow evolution
* not controlled by sun-oracle
* ...something else...
it is your burden (the OSGI Architects) to find what that obstacle is
and save us (developers) from having to deal with 2 module-systems.
(Jigsaw & OSGI)