Appfuse 2.0 Review

Appfuse 2.0 Review

AppFuse is an open source project and application that uses open source tools built on the Java platform to help you develop
web applications quickly and efficiently.

What is AppFuse?

AppFuse is an application for “kickstarting” J2EE web application development. It consists of a set of libraries, jsp’s, templates and several build scripts. Running the ant new target in the AppFuse root directory will prompt for a few parameters of the target application, like database and package names. AppFuse then generates and copies a deployable web application that can serve as a starting point for further application development.

How well does AppFuse work in practice?

To find out how well AppFuse really works, I followed the QuickStart Guide, the Creating new DAOs and Objects in AppFuse, the Creating new Managers, the Creating Spring Controllers and JSPs and the Adding Validation and List Screen tutorials. I then tried to port the generated code to another RDBMS (Cloudscape 10.1). I also had a go at replacing the default two column page design with a three column design.

These are my findings.

Strengths

* Short startup time - I had a deployable, database driven, tested, 3-Tier J2EE application supporting authentication, authorization, logging, click through tracing etc. in less than 3 hours. Even taken into account that I already had a complete Java environment installed on my machine (JDK, Eclipse, MySQL, Ant), this is fast … very fast.
* Choose between IBatis and Hibernate - for persistence, AppFuse lets you chose between a DAO layer implemented using IBatis or Hibernate.
* Choose between Spring MVC, Tapestry, Webwork orJSF - for the Web Tier, you can chose between two Component based (Tapestry and JSF) or two Request based web frameworks (Spring MVC, Webwork).
* Support for Test Driven Development- apart from DAO, Manager and Web classes, AppFuse also generates Test Cases and the ant targets to run them, either individually or in logical groups (test-dao, test-web, etc.).
* Build script - the Ant build script consists of 1200 lines and 65 targets and covers everything from dropping, creating and populating the database to deploying to Tomcat and fixing CRLF for Unix Machines.
* Integration with Sitemesh - the JSP’s are build up using the the Sitemesh templating library, providing for clean separation between content and layout directives. Compared to for instance Tiles, Sitemesh is more powerfull and flexible.
* Released under the Apache License - it lets us freely use the software for company internal and commercial purposes and does not require us to submit changes that we make to the software back to the Apache Software Foundation.
* Documentation and community support - the tutorials and JavaDoc are quite good, and there is an active developer community using the software.

Weaknesses

* MySQL only - the generated code is targeted at the MySQL database system. AppFuse does not support other RDBMS out of the box - manual adaptations of the generated code are necessary to achieve this.
* No clean dependency management - AppFuse relies on ant build scripts and properties files to configure its (50+) dependencies. Usage of a tool like Ivy, a simple to use but powerfull dependency manager would be nice instead.
* Heavy reliance on XDoclet for code generation - this leads to code that belongs in the Integration Layer (i.e. Hibernate mapping definitions and column names) being part of the Domain Layer.
* Large build scripts - although they do provide a lot of functionality, the large build scripts are difficult to understand and maintain. It is also not always clear what the different targets do and how they depend on each other.
* Usage of Business Keys as PKs - in general, when using Hibernate, it is a best practice to use Surrogate Keys as PKs for database tables representing Business Objects (”User”, “Car” etc.). AppFuse ignores this and uses the Business Keys as PKs.
* Small committer base - it is unclear to me how large the developer base is that actively maintains and develops the AppFuse project. This is something to investigate when planning any long running projects.


In a typical web application, it is common to have a login screen, registration screen, content storage in database, security and most importantly testing.

When building a Java web application, we might start adding one jar file after another to implement a particular user story.

For example, if i want to have ACEGI security for my web app, I might download ACEGI jar, map and configure it in web.xml and security.xml files.

What if, there exists a toolkit that already provides these common features to us. ?
For instance...

ACEGI security
Hibernate integration
AJAX templates
Switchable CSS framework
Unit test
Layout reuse
PDF support
Excel support and so on...



Installing Appfuse is easy for people who have basic knowledge of Maven 2. We took the Spring MVC Basic archetype of Appfuse, as the team already had good expertise on Spring/Hibernate/Junit.

The Spring MVC Basic archetype was made with excellent set of framework and libraries, some of them include Hibernate, JUnit, Spring MVC,DisplayTag, DWR and so on. The good thing is, its also supports most of commonly used databases.

It took very short time to add a new spring-mvc jsp page, a spring controller and the related test cases.
It took hardly no time to add our own language extension for internationalization, because Appfuse comes with ready made templates.

At one point, we wanted to extend the user registration form, spring controller and the database. I was able to do it with the help of documentation provided on the Appfuse website.

It takes a while to understand the whole structure of the project, but I dont feel it wasted my time on learning it's structure.
Heavily based on many external jars files so you never know when they will become obsolete.One can also argue that is not the problem of Appfuse but the individual package. We faced some compatibility issues on using the jars but later we managed to correct them using our pom.xml

I strongly recommend to the spring developers to look in to the Appfuse application before you start developing your own set of common features and requirements for your web application.
This helps you not to re-invent wheel and saves time and effort.

The mailing list/user community is very active in answering the queries. The Appfuse team is also very active in keeping their application at par with new changes in the technology.
Apart from Spring MVC archetype, Appfuse also has its archetype for JSF, Struts and Tapestry. Checkout Appfuse website for more info about online demos, tutorials and release roadmap.


http://appfuse.org/display/APF/Home

http://appfuse.org/display/APF/Demos+and+Videos

Conclusion
AppFuse does what it promises to do, which is always nice: it kick starts a J2EE project in a very short period of time. In my opinion, this makes it a very good tool for Consultants that are assigned to small to medium sized, Proof of Concept like projects. Here AppFuse really shines and should be used to its full extent, meaning including all XDoclet code generation features and ant targets.

For larger projects, that will be running over longer periods of time, that have to integrate with other RDBMS like Oracle and need a clean dependency management, AppFuse can serve as a starting point. In that case though, one really has to invest the time to refactor the generated code.