adam bien's blog

EJB 3, JPA, JSF and Patterns - sample application online - already 75 registered users 📎

The  (Training Data Base, or "Run And Bike") is an application which manages your training data (sports, not Java trainings :-)). The essential use case is the corelation between the average running/biking speed and your average pulse. I started with sports and was just curious about my progress. Because of lack of time I used Netbeans 6.0 with visual JSF and Glassfish v2 with Java DB. The first version was fully functional, but I wasn't really satisfied with the maintainability and quality of code. Especially the separation between the generated and implemented code was not good enough. I rewrote the whole application during a weekend using the Domain Driven approach (or just objectorientation) and some presentation view patterns like ("Passive View"/"Supervising Controller").

The API to the JPA entities and Session Beans looks like (an excerpt from a Unit Test):

            training.login(userName,password).
            running().
            today().
            averagePulse(135).
            comment("ok").
            duration("1:05:01").
            maxPulse(165).
            distance(12).
            wasRace().
            weather(SUN).
            add();
 

Only in few days (actually in three) about 75 new users registered. I got even one contributor/committer. The Training Data Base is a part of the "Patterns For Java EE 5" java.net project (built with Netbeans 5.5/6 and tested with Glassfish v2). The whole sourcecode is maintained in the Subversion repository, I install the bits from time to time on my Glassfish v2 server (in general once a week - it's always beta :-)). E.g. this week I implemented RSS feeds with most eager runners. The goal of the project should is fun + an opportunity to try out interesting things. I will provide a charting component in the next time, and excel (or openoffice of course :-)) export as well.

The whole architecture will be explained in detail in the upcoming JavaSpektrum issues (German Java Magazine). The first part will concentrate on the presentation, the second more on the business tier... I will explain the whole application in great detail during the "Entwicklertage" workshop as well.