Developing Great Software

Thursday, March 24, 2011

Java EE6 & Wicket - Article #1 - Requirements, Architecture & Resources

Welcome to the first in a series of detailed articles on Java EE6 & Wicket. If you haven’t already, please read my previous article before continuing.

Lets begin with a discussion of the requirements for GuestBook, the Web application we will create.

It is always a good idea to define the purpose of an application right up front so here’s ours for GuestBook

  • Present a Web page that allows visitors to sign a guest book and view a list of visitors who have signed the guest book.

Rather simple, isn’t it. But even simple applications have business rules so here’s ours for GuestBook

GuestBook Requirements – Business Rules

  • Collect the first and last name of each visitor.
  • Limit the number of characters our visitor can key in for their first and last names to a maximum of 45 characters each.
  • Both first and last name are required. So when either are omitted we have to display appropriate and informative warning messages and also highlight the offending data entry fields.
  • The list of names displayed should be rendered to the browser in a case-insensitive manner.

GuestBook Requirements – GUI

Good! We’ve succinctly defined our business rules but we haven’t decided what GuestBook should actually look like. My budget for the project is zero so I can’t hire a professional graphic artist. Therefore, I’ve enlisted the assistance of Vincent Van Gosh, a friend of mine, to work up an image of the page. Below is what he came up with. Nothing fancy, mind you (so what do you expect to get for free these days, anyway?) but it will serve our purpose.

As you can see from the above image, the GuestBook application consists of a single page on which are the following sections:

  1. A header section display the Wicket graphic and the title.
  2. Below the header section is a form which visitors use to enter their first and last names to sign the guest book. Both fields are required and each field is limited to a maximum of 45 characters. The form also contains two buttons, one for submitting the form and one for clearing out its contents.
  3. Below the form section is a list of the names of the visitors who have previously signed our guest book. The first and last names are in ascending order by first and then last name and collated in a case-insensitive manner.

GuestBook Requirements – Data

We can’t display the list of names of our visitors if we don’t store them somewhere. So here are the requirements for storing visitor data.

  • We will use the popular open source MySQL relational database as our datastore.
  • The name of the table in which we will store the data is going to be called ‘guest’.
  • The schema for the quest table defines three columns: 1) id (an auto increment identity column); 2) firstName (a variable character column able to store up to 45 characters) and 3) lastName (like firstName, a variable character column able to store up to 45 characters).
  • The firstName and lastName columns should be defined so that they use case-insensitive collation. Remember, above we stated that the list of names displayed should be rendered in a case-insensitive manner.

GuestBook Architecture

So far we have expressed the purpose for GuestBook, we defined its business rules, worked up a graphic for what we want the Web page to look like and defined the data requirements. But we haven’t touched on what architecture we will use for actually developing GuestBook, so lets define that now.

  • GuestBook will be developed as a browser-based Web application.
  • We will use Oracle GlassFish as the Java EE6 application server.
  • For our presentation tier we will use the Wicket Web framework.
  • MySQL will be used for the datastore tier.

So our architecture stack looks something like the following:

Browser
Java EE6/GlassFish
Wicket MySQL

IDE

I originally thought about also using Eclipse in these articles but in all honesty the Netbeans tooling is far superior to that of Eclipse when it comes to targeting Java EE and GlassFish. In my opinion, Eclipse is a great IDE. In fact, I use it very often and I am very comfortable and productive with it but I’ve come to recognize that both IDEs have their strengths and weaknesses and so I’ve opted to use NetBeans for these articles.

What you will need to complete GuestBook

Following is a list of items that I will use to complete the GuestBook application. If you intend to code along with me (and I certainly hope that you do) then you will need to have these items installed on your development machine. The list provides links to each item’s home page and download page.

ITEM DESCRIPTION
HOME PAGE
DOWNLOAD PAGE COMMENT
MySQL Community Server
Open Source Database http://www.mysql.com/ http://www.mysql.com/downloads/ Version 5.5.10 at the time of writing this article
MySQL Workbench To design, manage and document database schemata http://www.mysql.com/ http://www.mysql.com/downloads/ This is totally optional as I will provide the database schemas for you. But it is a very good tool to have so I thought I’d mention it here.

Version 5.2.33b at the time of writing this article
NetBeans Open Source Java IDE http://netbeans.org/ http://netbeans.org/downloads/index.html Version 6.9.1 at the time of writing this article.
Wicket Plugin For NetBeans Adds wicket support to the NetBeans IDE http://netbeans.org/ http://plugins.netbeans.org/PluginPortal/
faces/PluginDetailPage.jsp?pluginid=3586
Supports NetBeans 6.9.1 at the time of writing this article

Please download and install the items listed above. In the next article, Java EE6 & Wicket - Article #2, we will focus on setting up the GuestBook MySQL database. We will define the database schema for the GuestBook application and apply it to create the guest table. We will also load the guest table with data that will be used during testing.

2 comments:

  1. Jeff,

    Looks like a promising series of articles! One quick comment... the Wicket Plugin for NetBeans link in the Download Table is missing a letter (should be "?pluginid" and not "?luginid").

    Thanks!

    - Dwayne

    ReplyDelete
  2. @Dwayne thanks for pointing out the erroneous link which I've corrected.

    ReplyDelete

Note: Only a member of this blog may post a comment.

About Me

My photo
New York, NY, United States
Software Developer