May 16, 2007

JavaOne 2007: Day Three

My day three is full of interesting sessions, but this is the only day my evening looks empty - to make time for the After Dark Bash, the official JavaOne party. Motorola's key note is a little disappointing, not much about open development as it's titled and mostly hype. The first technical session is then way better: Eclipse Europa, the next release train of Eclipse platform. The Eclipse people mention this as well, but one of the most extraordinary aspects of these simultaneous releases of Eclipse projects is that while dates are decided 12-18 months before, the releases are always on time. A lot of projects could learn something from that, whether open or closed source. Also the milestone releases are typically very stable from early on. Overall, the size of Eclipse and all Eclipse projects have gone up and there's too many improvements in each one to go over in a one session. There doesn't seem to be anything earth-shattering, but of single plugins that I've heard about, but never bothered to try out, I must bring up Mylar. Mylar's this "active filter" that watches what you are doing in Eclipse and creates dynamic views showing you only the stuff that you are actually interested in.

I skip one session to have just a tiny bit of time to post my notes of the previous day. The next one is OSGi best practices that should come in handy in the future. Eclipse contains an implementation of OSGi, called Equinox, and the plugin and loading architecture is completely based on it. My quick notes explain fairly well what OSGi can do for you, but most applications bigger than Hello-World Applet would benefit from the architecture. Of course the problem is that a few applications want to be architecture-heavy from the beginning and consider these issues while the application is still small. That's why Eclipse RCP is a good choice for a lot of client application projects; you don't need to start from scratch and you have the architecture available when you need it.

My next session is about "Advanced Refactoring in Java platform". I'm really interested in the the topic but the session is mostly a disappointment; the Sun guy is demonstrating the concepts in Netbeans and most of these have been implemented a long time ago in Eclipse, not to mention IntelliJ IDE. In any Netbeans session, you typically hear somebody asking if they could just move to Eclipse. The answer is always the same, but maybe overall it's good that a major player is missing from Eclipse foundation; the competion will push both platforms forward.

I also attend Ning session, which is an interesting architectural presentation. I've been interested in the company for a long time, and while their solutions are not necessarily applicable to other architectures, they re-iterate the known principles: don't over-engineer, a single well-designed system can handle a lot of load, and simple is good.

The last session of the day for me is "Ant to Maven migration", which I picked solely because of the presenter, Jason van Zyl, the creator of Maven. Maven's no silver bullet, but their case study speaks for itself: 21,000 thousand Ant lines were replaced by 3000 lines of Maven code. Obviously, this is a big project. Maven's XML is rather verbose just like Ant's, but it gives you structure and you rarely need to repeat things; both areas where Ant often fails.

Raw notes below

---
Motorola's keynote on open development on Mobile platform

not much about open development.. mostly hype


TS-9920 Eclipse Europa (3.3, WTP 2.0 etc. simultaneous release, like Callisto last year)

for four times in a row (since 3.0) Eclipse has released on time, the last Thursday of June
- commercial projects could learn something from Eclipse

JDT improvements
- Ctrl+Alt to step into
- Ctrl+3 makes available ALL the UI elements; views, menus, etc.
- hyperlink to custom tag declarations
- browser object references/instances (only available on Java SE 6)
- import test runs from your nightly build
- ctrl+space propses unresolved names(!)
- completion in catch clause
- edit>undo for package and other Java views
- visual page designer for jsp and jsf editing
- SWT runs native on Vista WPF (transparent windows, native double-buffering, GPU acceleration, etc.)

BIRT (business reporting)
- jsp page tags and integration with WTP
- word, excel and postscript output
- web services as data sources

Mylar (must check this out)
- focuses the UI to show only infromation relevant to the task-at-hand
- multi-tasking becomes effortless

STP
- service component architecture standard Java code development
- service component architecture SCDL for constructing composites that include services

configurable and extendabl hyperlink detectors

CDT 4.0 new project model
- easily extensible tool chain
- more cpapable indexer

CDT becoming compiled language tooling
- for Ada, C#, Fortran

eclipse for embedded developers
- cdt is just the beginning

DLTK dynamic languages toolkit
- supprot for tcl, ruby, python, javascript
- integrates with mylar and JDT
- major chlalenge: type inference
- a framwork with 20+ extension points, easy to add new dynamic language support

TS-1419 OSGi best practices (good presentation, get the slides)
dynamic modules system for Java
- visibility rules, depndency management, versioning bundles
- installing, starting, stopping, updating, uninstalling all at runtime
service-oriented
- can be registered and sonsumed at runtime

why?
avoid jar file hell
reuse code "out of the box"
simplifies multi-team projects
enables smaller systems
manages deployments locally or remotely
tool support
no lock in - many providers
high adoption rate

osgi layering
services
lifecycle
module
execution environment
os+hardware

security and applications spans through all layers

portable code best practices

- compile your code against the minimum suitable class libraries
- osgi specifies bare minimum execution environment

- your bundle must import all packages that it needs! (except java.*)

miminimize dependencys - use import-package instead of require-bundle
- require-bundle can have only one provider - the named bundle
- import-package can have many providers
- allows for more choices during resolving
- has a lower fan out, which gain adds up quickly
- use version ranges(same as in Maven!)
- design your bundles

hide implementation details
- put implementation details in separate packages from the public API
- do not export the implmentation packages
- avoid class loader hierarchy dependencies
- better to use a safe OSGi model like services or the extender model to have bundles contribute codecs

lifecycle layer best practices

avoid start ordering dependencies
- do not assume that you can always obtain a service during initialization
- use servicetracker to track services and respond to their publication by subclassing
- use a declarative service model like OSGi declarative services or spring OSGi

handle service dynamism
- service is a dynamic entity and can be unpublished after you get it
- use the helpers based on API to watch the event from services
- declarative models for declaring service dependencies with states

whiteboard pattern
don't call us; we call you
design your API to have the listener registered as a service: simple, more robust leverages the OSGI service model
don't use addListener, removeListener (both sides need to implement it, etc.)
the even source tracks the listener services and calls them when there is an event to deliver
OSGi EventAdmin an example of this principle

extender model
- the bundle being "extended" specifies a data schema
- contributing bundles define this data in their bundle
- the extender bundle will track the bundles via a certain lifecycle event and process the data

avoid OSGI framework API coupling
- best practices for any framework
- write your codes as POJOs
- program against interfaces
- isolate the use of OSGi API to a minimal number of classes
- let these coupled classes inject dependencies into the POJOs
- make sure none of your domain clases depen on these OSGi coupled classes

return quickly from framework callbacks
- bundle developers have a tendency to do too muuch up front activation
- lazy is good
- framework callbacks need to return quickly
- use eventing, sping off background thread to perform the long running work

thread safety
- in an OSGi environment, framework callback to your bundle can occur on many differnt threads simultaneously
- your code must be thread-safe!


TS-9861 Advanced Java Refactoring

richer models of the code
catch refactoring options early, the faster you correct, the less the cost
better navigation
more accurate model allows more safe capabilities

semantic modeling very difficult
- accurate type relationships hard
- generic types much harder
- let the compiler guurs figure it all out

ides will rely on compilers for creating the model and getting the errors
refactoring now rarely a separate activity

jackpot executes custom queries
- full access to complete java language semeantic model
- transformers can modifyg query matches
- included rule language
- integrated into netbeans 6.0

TS-6039 web-application development at Ning


TS-7496 Migrating from Ant to Maven

Old stuff for me on Maven benefits...

case study - problems to solve:
- company had almost 25000 Ant lines of code in 129 files, about 6 million lines of Java code
removal of the inner platform effect
adoptions of development infrasturcture standards
ease the cost of deployment

conversion issues
- directory structures
- multi-artifact builds
- checked-in dependencies
- tooling

conversion tools
- nexus - a repository management application that indexes maven repositories and provides a query mechanism to search for artifacts using their MD5 checksum
- tip: do a google search on md5 checksum of a maven artifact
metamorphosis - an adaptable conversion tool (from ant to maven)


result:
- maven build resulted in: 97 pom files, 2910 lines
- eliminated 32 build files and 20502 lines of build logic
- used standard maven plugin to remove most of the build logic and converted their axis tooling wrtten in ant and wrapped it as an ant-based maven plugin

Posted by thoughts at May 16, 2007 10:25 AM | TrackBack
Comments
Post a comment









Remember personal info?