Monday, September 21, 2009

One Day in your Life... with UML2, oAW, Weblogic FastSwap, Oracle Enterprise Pack for Eclipse, Maven2 and SpringFramework...

In my new project - as usual in a software project - we have a very tight schedule. Using our old JEE application architecture (Oracle 10g, EJB 2.x, JFormular, Ant with Maven2 dependencies, full deployment EAR, WAR and EJB JAR on Weblogic 10.3 with Java6) would mean that we will have a long turn-around time (code, compile, deploy and test) for our development. Our build process with Ant does not support "naked" deployment", so it takes ages before the artefacts are built, jarred and can be deployed in Weblogic. In case that you only change one small thing in your web layer (JSP file, Java class) you will need to go through all those build steps. In combination that at that time I had an old development hardware (3 years old) you can imagine how horrible the situation was...

So I was searching for a better solution. We need a fast turn around time, especially in our web layer because I'm not an expert in JFormular and I definitely need to "try and error". At that moment I already know how easy to develop with GWT in hosted mode. You are just doing "ctrl-s" in Eclipse and make a reload on your browser. That's it, you will see all the changes directly. So your turn around process is just code, compile and test. No deployment anymore. You are very productive in this style. Amazing!

Luckily I found Oracle Enterprise Pack for Eclipse (OEPE) in combination with Weblogic FastSwap technology. With these stuffs you can do the GWT development style for JSP and any other web frameworks within your Eclipse as well. Not for all the things but it works very well. So after I found this I was thinking of making a new application architecture for our new project and here is the result:

1. Modeling strategies and technologies: UML2 (MagicDraw 16) with oAW generators. Actually I'm a fan of AndroMDA (yeah AndroMDA is a great Open Source project!), but because of certain circumstances we move to oAW (it was not my decision). From the application developer point of view I just need to generate the codes from the UML2 models. Nothing special here. In the mean time MagicDraw is becoming a very solid UML product. One thing which still needs some improvements is the file format (XMI) management. Since MagicDraw does not save the UML file in the native Eclipse UML file format you always need to export the file before it can get processed by oAW or AndroMDA. The export can take time if you have a big UML file.

I have to admit that my vision of "the next step in software development is reusing model components" is still not there. Four years after I wrote my MDA book I still don't see any movement that we are beginning to reuse models. But still it would be very cool if I need to have a user management component I can just import an UML2 user management module in my UML2 application module, afterwards I can customize the model und regenerate everything. At the end I can get a running application with a complete user management which is customized
for my application. Very cool but not a reality yet.

2. Implementation technologies: Oracle10g database, Weblogic 10.3, Hibernate 3.x.x, SpringFramework 2.x.x, JFormular (our own development for web framework):

I'm using OracleXE for development which is very good. Only for the integration test we use Oracle10g.

Weblogic 10.3 is a very solid software. There are some new things which I like in comparison with the older 8.1. Here are some points:
  • Support for FastSwap: This is great. In combination with OEPE (see below) you just make ctrl-s and reload on your browser and you will see the changes directly. Amazing, especially for development of web user interfaces. You also won't lose your session in the web application. So if you have an application in which you have to log in, you don't need to log in everytime you change something in your web application because your session is still there. There are some contrains in FastSwap but all in all you can life very good with FastSwap.
  • User interface of Weblogic 10.3 is a lot more better than the older version. Still you have a bug if you are using Chrome.
  • You can start Weblogic in a very slim version (without EJB, etc.), thanks to OSGi architecture of Weblogic. This is great if you just want to make a simple development with servlet.
3. Project structure and build process: Maven2. Actually I'm not fond of Maven2 because I always thought "I need my freedom and flexibility". I don't want to be dictated by a common structure and standard phases like in Maven. My project has always something specials so I need my own Ant task to get the flexiblity I need. I'm wrong, very wrong. After doing some stuffs in Maven2 I began to really like it. A very great build tool. I will never ever do my project without it again! Following points are the reason why I like Maven2:
  • The documentations of all those plugins are great. You can always find solutions to your problem in internet (I already forget how to do programming without internet ;-))
  • You have two great free Maven books which are very nice in case that you will need to understand something principally in Maven2 (Maven: The Definitive Guide and Better Builds with Maven). Something like Assembly or Profile for example.
And why is Maven2 should be your choice (instead of pure Ant)? Here are some reasons:
  • You can still use Ant in Maven2, so you actually don't lose your flexibility!
  • I already see some hand-written Ant tasks. OK you can surely standardized them all but almost all of them are just re-written of Maven goals (compile, test, package, install, deploy). So mostly they are quite useless. Especially in a small team of developers this is not applicable since one person needs to take care and always extend the build files. Did you ever try to extend Ant tasks which are not written by yourself? Have fun! Another thing is that in a lot of cases you will have to use the dependency management of Maven in Ant, so you are beginning using Ant task for Maven anyway. In this case just throw your Ant tasks away and start using Maven2. You can still integrate some of your Ant tasks directly in Maven2.
One thing I still don't like is the Maven2 Eclipse plugin. Yes this plugin is still buggy. After a long time of its existence it's a pitty that there is still no good Maven2 plugin for Eclipse. For more info - or problem - on Maven2 Eclipse plugin please continue reading.

Here is a list of topics which I found very useful during my first contact with Maven2:

4. IDE: Eclipse 3.4.x with OEPE and Maven2 plugins: OEPE offers you a lot of good functionalities (starting, stopping server, some editors for Weblogic stuffs, etc.). One I really like is the FastSwap technology. At the moment some developers are using a remote installation of Weblogic 10.3. It's a pitty that FastSwap only supported for a local installation of Weblogic. I don't know if FastSwap is working for a remote installation with a Samba access. Maybe worth to try.

In conjunction with Maven2 Eclipse plugin there are some bugs still available. If you are seperating your presentation layer (web war) and your business layer (jar) in two different Eclipse projects you can't have the FastSwap technique in your business layer. You also cannot use the Maven2 plugin functionality "Resolve Dependencies within Eclipse IDE" which is actually pretty cool. So you always need to "install" the business jar file into your local Maven repository. Your web application needs to link this jar file directly. See this discussion for this type
of bug: M2Plugin and OEPE. I hope to see bug fixes for all these problems, so that we can use FastSwap also in our business layer like with SpringFramework, etc.

I also found that this Eclipse plugin is a good one (not a perfect one) to see changes of your Weblogic or your application log files: Log Watcher.

All in all, with all its bugs, OEPE and Weblogic FastSwap are great technologies and if you are using Weblogic you have to try these stuffs. You will never ever want to comeback to your old development process and steps. One thing to remember: Using FastSwap does not mean that you don't need to write unit tests anymore! FastSwap is a beautiful technology to quickly prototype applications and unit tests are there for you to be able to deliver high quality applications. So the combination of both is just what you need!

One thing I want to replace in our application is JFormular web framework. Maybe it was a good framework in the past but today I won't develop a new application with that framework anymore. GWT would be a better choice for web user interface.

Update:

Have fun and be productive!
Lofi.

3 comments:

Steve said...

Hi
I am looking to use OEPE for the same reasons as you. However I am surprised at the lack of documentation.
Any pointers as to kick starting OEPE when using Eclipse and maven. Also about migrating existing projects.

lofi said...

Hi Steve,

Sofar I did not find any article or documentation about these stuffs...

I will try to write a small article about HOW-TO for OEPE, Maven2 and Eclipse... I'll put it here in my blog.

Cheers,
Lofi.

lofi said...

Hi Steve,

I added the first HOW-TO for OEPE with Maven:
http://lofidewanto.blogspot.com/2009/11/how-to-oepe-with-maven2-and-m2eclipse.html

Cheers,
Lofi.