Quality Assurance Driven Development - And The Resulting Damage...
Everything started with measurement of JavaDoc coverage. The equasion was simple - more coverage, better software quality. But the result is actually sad. In case developers are forced to comment every piece of code, they will comment getters / setters as well. It's hardly possible to provide usable comments for straight-forward code. The problem is not the process of writing - if you comment obvious code, someone will have to read your documentation....
Recently QA departments spotted the opportunity for measurement of the unit-test coverage. This gets even worse. Because writing unit tests takes some time, it's often much easier to test obvious code to raise the test coverage. Meanwhile, I gets suspicious in case an average corporate project shines with test-coverage > 80%. The question is: what are actually the remaining 20%? A more serious problem I encountered in an "agile" project (with huge amount of unit tests :-)), was a considerable coverage of CRUD-cases (like masterdata management) ...but some really hard to test algorithms were just skipped ...and caused trouble in the production.They just didn't contributed enough to the code-coverage results :-).
You could even generate your tests to increase the coverage. Then even System.out.println could be tested - the acronym would be cool as well Code Driven Test Generation (CDTG).
...instead of believing in numbers - sometimes a portion of common sense could really streamline your development. The problem here: then you could get rid off many buzzword, acronyms, processes and tools :-).
How To Kill A SOA Project - Or What Questions To Ask First Your Client
SOA focusses on business and customer needs - what is a good thing. However it becomes often too expensive, or hard to estimate. The problem is seldom the technology - and always business, organizational issues and politics. Things, which cannot be fixed with any technology. There are some technical challenges, which can be derived from the distribution, reuse and orchestration. The following facts have impact not only to the technology, but especially for business - and can make your customer no more so excited about the SOA approach:
- A once deployed service (e.g. WSDL, Java interface, WADL, IIOP etc.) cannot be changed any more. Every change breaks all clients (potentially from other departments). In some protocols - even minor interface changes can break the contract. So, what is the strategy for the release management?
- Because a service cannot be changed - new copies (versions) of slightly changed service have to be deployed. So, how many versions of one service your department like to maintain?
- Monolithic services are orchestrated inside one process in a local transaction - now they are distributed - and distributed (XA, 2PC) transactions are needed. Does it really work?
- The robustness of the whole systems becomes as good, as the weakest service. Can your customer live with that?
- You have to live with partial failure - this problem was unknown so far in monolithic silos. How to deal with it from the business perspective?
- It is hard to find a semantically valuable service, which is interesting enough to different departments. Business Domain Objects like "Customer", "Invoice", or even "Address" are different concepts for each department. So will the service be actually reused at the end?
- The abstractions and distributions and TX coordinations do cost performance - synchronous transactions becomes asynchronous, or have to be split to many fine transactions coordinated by the end-user. Is your client ready to change the already existing process to adapt SOA?
Gesendet von admin [Java EE 5 Architectures And Idioms] ( May 29, 2008 08:29 AM ) Permalink | Kommentare [5]
Sun xVM Virtual Box - the Killer Virtualization Tool? Second Smoke Test with Ubuntu
I had to test some stuff under Linux (I'm still running Vista :-(), and installed Ubuntu "under" Sun xVM Virtual Box instead of VMWare Workstation. During my first test I installed opensolaris - now I had to map virtual drives and exchange some files. The whole installation again went without any problems - surprisingly smoothly (very comparable to VMWare Workstation). Even the installation of the additional Virtual Box tools was really simple - then I was able to set up higher screen resolution. The only, little bit tricky thing, was the access to the virtual drive. Instead of reading the help I googled for this - and lost about 1 hour. However the help is helpful in this case:
"In a Linux guest, use the following command:
mount -t vboxsf [-o OPTIONS] sharename mountpoint
Replace sharename with the share name
specified with VBoxManage, and mountpoint with the path where you want the share to
be mounted (e.g. /mnt/share). The usual mount
rules apply, that is, create this directory first if it does not exist yet.
Beyond the standard options supplied by the mount command, the following are available"
Virtual Box is really amazing, you can suspend, restart, "store" images, take snapshots, even configure the "seemless" mode - I'm still searching for shortcoming / caveats :-). Perhaps a small issue: I just tried to setup the ubuntu's fancy 3D stuff - but it didn't worked inside the Virtual Box....
It's Not Flash -It's An Video Streaming Applet - With Java SE 6u10 Effect
I watched yesterday a streaming video session from Apache Con and recognized, that it isn't flash but an applet. The start time was very fast - it took about 2 seconds on my machine - the streaming begun almost immediately (Disclaimer: I'm using JDK16u10 und Firefox 3rc1 with the new plugin - Eclipse, Netbeans, Glassfish and JavaDB were already running - so the bytecode was probably precached....). Even more interesting - I looked at the code and it seems like the applet communicates with the HTML-page using JavaScript for the slideshow - a perfect sample for liveconnect. I found the link to the origin applet as well. It seems like it was created long before the JDK 1.6u10 release. So - applets are back. The only problems is the name "applet". Because of it history - it is no more buzzword compliant :-).Kudos to the German http://www.linux-magazin.de/ for providing (propably un-intentionally) this use case.
Gesendet von admin [Java EE 5 Architectures And Idioms] ( May 27, 2008 08:37 AM ) Permalink | Kommentare [3]
Google Trends - Netbeans 6.1 More Popular Than Eclipse? What's about IntelliJ?- try it out...
I just couldn't believe the Amateur's Coding Post about Google Trends result and played around with this tool. Regardles which parameters I used - Eclipse became less and less interesting - and Netbeans the opposite. Both lines were crossed at the end of 2007. It's really surprising - the popularity of Netbeans seems to increase, and of Eclipse to decrease. I tried with Netbeans IDE as first parameter, and Eclipse IDE as first - but the result was in both cases the same - Netbeans is more popular regarding to Google Trends! The comparison between IntelliJ and Netbeans was even more surprising.
However the result could also mean: Eclipse has fewer bugs, than Netbeans - so developers do not have to search for it :-).
Gesendet von admin [Netbeans] ( May 26, 2008 12:35 PM ) Permalink | Kommentare [18]Netbeans 6.1 Support For Ant File Editing - One Thing What I Miss
The support for working with Ant-Files in Netbeans 6.1 is really good. However Eclipse provides a better editing experience right now. Especially useful in eclipse is the resolution of variables in the build.xml. If you hover over a variable in build.xml e.g. ${some.variable} which was defined in my.properties:
some.variable=hello world
Eclipse will show you the resolved values in a tool tip - however Netbeans 6.1 is not able to do that right now (or I didn't found the fuctionality :-)). Even more useful is the resolution of more complex ids:
<path id="appserver.client.classpath">
<fileset dir="${appserver.client.lib}">
<include name="*.jar"/>
</fileset>
</path>
In the upper case Eclipse would resolve the <path refid="appserver.client.classpath"/> in the editor (so you will see all JARs listed) - which is really useful.
It shouldn't be that hard to support this feature in Netbeans as well - then the Ant-support would be outstanding. Now Netbeans is able to map Ant-Task to IDE actions, so you are able to work with existing Ant-projects seemlessly. Beyond that, you can even create shortcuts (just go to a task, right mouse click and choose "create shortcut") and execute the Ant-Tasks from menues or toolbars. It takes about 2 seconds to do that ...and can save you a considerable amount of time afterwards.
The Relation Between Java FX (Script) And Swing - Are You Still Concerned?
The concerns about the future of Swing and it's relation to Java FX seem to be all over the place right now. However - if you look under the hood of Java FX Script - all the widgets seem to wrap / need Swing components less or more directly. Java FX Script seems to use Swing components as "Service Provider".
Some Java FX samples (the declaration inside << >> refers to Java classes):
//Java FX Button
public class Button extends Widget, RotatableWidget, ActionWidget {
private attribute button: <<net.java.javafx.ui.XButton>>;
//Java FX Dialog
public class Dialog extends AbstractFrame {
private attribute jdialog:<<javax.swing.JDialog>>;
//Java FX Script Frame
public class Frame extends AbstractFrame {
private attribute winListener: <<java.awt.event.WindowListener>>;
private attribute compListener: <<java.awt.event.ComponentListener>>;
private attribute frame: <<javax.swing.JFrame>>;
[I copied the samples from Netbeans 6.0 Java FX Plugin]
The relation between Java FX Script and Swing is similar to the relation between Swing and AWT or JFace and SWT. Java FX Script is a decorator of Swing components.
However Java FX Script allows the usage of Swing components in declarative way (without the setter - style) - and is able to simplify so the Swing development. From my perspective Java FX Script can be considered as a Domain Specific Language which compiles to Java 2D / Swing. With Java FX Script the development of Swing components becomes more fluent and object oriented - so it is a nice complement and not a substitution. It is much easier to pimp up Swing apps with Java FX with some visual effects.
I'm actually less concerned with the future of Swing - during the JavaONE 2008 technical sessions enough exciting, Swing related stuff was presented (JWebPane, Scene Graph, Java 6 update 10, Applets / WebStart etc.). ...and all cool IDEs like IntelliJ / Netbeans are Swing-based :-).
Some Ultimate java.net Projects
java.net seems to be a little bit underestimated. It is actually great platform for opensource projects - and very easy to set-up. You get a SVN or CVS access with mailing lists, project homepage etc. the full infrastructure. However there are already some really interesting java.net projects out there:
- http://beansbinding.dev.java.net: the JSR-295, databinding framework which will be probably used in JDK 1.7. You can already test it in netbeans.org
- http://nimbus.dev.java.net: the starting resource to the new l&f. It is already available in JDK 1.6u10
- http://substance.dev.java.net: an alternative look and feel for Swing. Great as well!
- http://hudson.dev.java.net: the ultimate and really easy to setup (actually nothing to do) continuus integration tool. You have really check it out
- http://opends.dev.java.net: a scalable and easy to use and install (even via webstart!) directory service - it works well with glassfish
- http://wonderland.dev.java.net: this one is awesome. It is easy to install and setup - second life like - virtual reality application. I use it to demostrate Java's visual capabilities
- http://openmq.dev.java.net: a scalable, clusterable JMS provider. Can be used standalone or in glassfish. Really active community. There was even a BOF at the JavaONE.
- http://openjdk.dev.java.net: this is the home of the next generation JDK. It is already used in some linux distros.
- http://glassfish.dev.java.net: the "killer" Java EE 5 server. Even embeddable!
- http://jsr-310.dev.java.net: this is the future of java.util.Date and java.util.GregorianCalendar (R.I.P to both :-))
- http://openjfx.dev.java.net: the Java FX resource with demos, source and doc.
- http://shoal.dev.java.net: easy to use and install clustering and broadcasting solution (uses JXTA or JGroups as SPI). Is used inside glassfish
- http://visualvm.dev.java.net: the "killer" monitoring, profiling console. Allows you local and remote monitoring of JVM processes
Gesendet von admin [Java EE 5 Architectures And Idioms] ( May 21, 2008 09:30 AM ) Permalink | Kommentare [6]
I really enjoyed yesterday's Java User Group Meeting in Hamburg - during my Java EE 5 workshop week at oose.de. The session started at 8 PM ...and ended about 11.00 PM. We talked about patterns, approaches and best practices an additional hour - it was a great Java developer crowd in a nice hacker-like location. I started with rudimentary slides and tried to answer the questions with hacking - it worked good (at least from my perspective :-)). I used Netbeans 6.1 with Glassfish v2ur2 (the "out-of-the-box-Java-EE-edition") - I was asked several times afterwards, whether it is really free - it is - I only used an additional UML plugin to visualize the stuff which is free as well.
Btw. the Java User Group meetings are located in a book store in Hamburg - with a considerable amount of Java books. They told me - that the Java ONE top selling books are all available and discounted. ...the Java area is significantly bigger, comparing it to the .NET (at least yesterday - during the JUG-meeting :-)).
The best of all - I got a PI-mug afterwards - but the JUG-leader didn't knew the PI Movie (it's really great hacker movie with the same name)... I would expect to have at least one DVD in the shop :-).
Generic EJB 3 CRUD, DTOs and Lost Updates with Optimistic Locks and JPA
I got some feedback with concerns about a generic CRUD interface which I described in this post, as well as checked in into p4j5. The basic idea was the direct exposure of persistent JPA-entities to a remote client - without the use of DTOs. This approach works really well for simple use cases like e.g. master data management. However it isn't a silver bullet for more complex use cases. In general, the @Version in an JPA-entity is going to change in case the persistent state (the attributes) is changed. However the relations do not belong to this set. So, even in case you are using JPA with optimistic concurrency, changes to relations do not cause the @Version attribute to be increased / changed. In case the client changes a relation (e.g. deletes a link between the master 1----n> client), the @Version of the master entity will not be increased - concurrent access could cause lost updates in this case.
Beyond this "logical" problem - before you would like to start using detached entities over network boundaries, you should think about the following challenges:
- Lazy loading - you have to preload the object graph, which is needed at the client. You could use e.g. "FETCH JOINS" for this purpose, or just invoking the methods
- Lazy loading and AOP - some providers weave proprietary extension into the persistent entities. In this case it could be necessary to deploy additional libraries to the client as well.
- The client will need at least the JPA-annotations in the classpath
- In case you are sending a subset of the object graph to the client - automatic merge will be not always possible (what happens, in case the client deletes some childs?)
I will discuss this issue in more detail during the upcoming talk at JUG HH (19.05.2008) as well.
Gesendet von admin [Java / JEE / Architecture] ( May 18, 2008 11:54 AM ) Permalink | Kommentare [1]








