A few thoughts on AppFuse
I've been thinking about how to structure AppFuse for the upcoming Spring and iBatis enhancements. These enhancements shouldn't require any directory structure changes. However, I've received some suggestions to change the common, ejb and web directory structure to be a little more inline with the tiers. So it would become something more like database, business and web (or dao, service and web). After thinking about this for the last couple of days, it seems to make sense. I picked up the notion of common from Erik Hatcher's JavaDevWithAnt, which I borrowed heavily from when creating AppFuse. Erik used common because this represented classes that would be included in both the web tier and the EJB tier. But since I (currently) don't plan on every adding EJBs to AppFuse, does it make sense? Even if I did, I'd probably only use SessionBeans, and those could easily fit into the service layer. The nice thing about moving the business layer (currently in web/**/services) to it's own directory is that it will get it's own JAR (with hardly any modifications to build.xml) and can be used outside of the webapp.
The nice thing about isolating the web directory to web-only classes is I can use Ant to replace any Struts-specific classes with WebWork or Tapestry. To prevent AppFuse from being cluttered with too many options, it'll ship with Struts out-of-the-box. If users want WebWork for their framework, they can download a WebWork version of the web-tier and run an Ant target that will replace all the Struts stuff with WebWorks stuff. It seems like the cleanest way to do web framework switching.
Another thing that might happen to AppFuse, caused by my enthusiasm to try out everything, is that it will contain too much stuff for a basic web application. It currently has security and user management built in, which is what most webapps need. I recently added in OSCache and Clickstream. OSCache is not enabled, but most webapps can probably use it somewhere. Clickstream is a different story. For most of the webapps I've built, this is not needed at all. Most of the apps are no more than 20 screens, and it's unlikely the client will care where people go the most. Another option that deserves ripping out is the idea of Struts' submodules. I tend to rip this out as the first thing when starting a new project. File Upload is something I've used rarely, so I should probably lose that feature too.
There are also other technologies that I've thought of adding to AppFuse, namely Quartz and Lucene. However, I've only used Quartz on 1 of my last 5 projects and Lucene on 2 - so obviously these might be considered bloat for a basic webapp. I think the best thing would be to implement these in AppFuse, on my own, and then document how I did it on the wiki (for an example, see diagramming build.xml with Vizant). If folks need to use it they can add it on their own. Documentation is always good, and if I can just document how to add stuff, I can certainly reduce the bloat.
Whaddya think - is it better to include options out-of-the-box or simply document them? Should I restructure the directories to match the tiers more?
Posted by Sam Newman on January 23, 2004 at 03:13 PM MST #
Posted by Dan Allen on January 23, 2004 at 03:27 PM MST #
Posted by Jaap on January 23, 2004 at 07:36 PM MST #
Posted by Matt Raible on January 23, 2004 at 07:47 PM MST #
With J2EE 1.4 allowing for POJOs and Session Beans to be treated as Web Service Endpoints you might think carefully about naming a 'services' subdirectory since services will take on two meanings (business services or web services) as J2EE 1.4 apps become the norm.
Just a thought.
Posted by dsuspense on January 23, 2004 at 08:10 PM MST #
OTOH,If you plan on reusing the same set of domain model classes in a number of applications , each with somewhat different business logic, they shoud be separated in to their owne source directory. This is a little esoteric, you have to be planning on a lot of reuse in a number od different applications. Plus you still need to re-process these POJO's using XDoclt to build parts of your presentation (struts, web descriptor, etc.) and persitence logic.
I think the first approach, keeping them in whatever source tree your business logic is in makes the most sense.
Posted by Richard Mixon on January 26, 2004 at 07:21 AM MST #
Here's my two cents on Architecture, AppFuse, i18n, etc. Note, I am not an active user of AppFuse yet, only looked at the code. This is partly inspired by your latest post on Java Open Source Programming.
Quote: To be honest, in AppFuse, all the Managers (a.k.a. business layer) do is transfer POJOs to ActionForms, and then back again. The Managers are were my business logic should go, but I often find it easier to put it in my actions.
So, as you feel that not much is going on in your service classes, perhaps it is time for a good review of what as ended up in the actions classes in all those months ;)
Regards, JaapPosted by Jaap on January 26, 2004 at 10:06 AM MST #
Jaap - here's my answers to your bullet points. <ul class="glassList">
I don't think there's too much logic in AppFuse's action classes, but implementing other frameworks will surely show me what I'm doing wrong.
Thanks for all the comments, they're greatly appreciated.
Posted by Matt Raible on January 28, 2004 at 01:55 AM MST #
Posted by Wiebe de Jong on January 31, 2004 at 07:52 PM MST #