Professional Documents
Culture Documents
TECHSOFT
Mohammad Sadoghi
Nitakulan Maheswaren
Champika Fernando
Mansoor Siddiqui
Table of Contents
Part 1: Design Overview . 3
Architecture ... 3
Technologies .... 4
Part 2: Back-End .. 5
Database Tables... 5
Entity Classes ... 5
Data Access Objects. 5
Controller Data Access Objects. 5
Connection Pooling.. 6
Generic Programming.. 7
Part 3: Application Logic........ 9
Controller Classes. 9
Tools Classes.... 9
User Session Class...... 9
Part 4: Front-End10
View/Dialog Classes..... 10
RCP Classes .... 10
Part 5: Exception Handling
TSException... 11
Part 5: Design Rationale
Architecture Rationale...... 12
Coupling and Cohesion ... 12
Technologies
The application will be implemented using J2SE v1.5.0 (5.0). It will be developed
using IBM Eclipse v3.1 and will utilize Eclipse RCP (Rich Client Platform) for the
applications GUI components. For the applications back-end, MySQL 5.0 and JDBC
3.1 will be used. In addition we are using the many tools in forms of eclipse plug-in to
help use improve development time. These tools allow us to rapidly design, develop and
test our system.
Here is the list of eclipse plug-in that we have used so far:
CVS Repository
o To synchronize our files between team members
Code Analysis Plug-in 1.2.0 (CAP --- JDepend 2)
o To analyze our code dependencies and instability
Eclipse CheckStyle Plug-in 4.0.91
o To follow Standard Java Coding Style (i.e.: magic numbers)
Eclipse Modeling Framework
o To design our classes
Graphical Editing Framework SDK 3.1.1 (Visual Editor)
o To create our front-end GUI, we used Visual editor strictly to create our all
of front-end interfaces
UML Plug-in
o To design our classes
JUnit
o To perform Unit, Integration and System Testing
Part 2: Back-End
Database Tables
Tables within the database can be divided into two categories: entity tables and
lookup tables. An entity table represents some business entity such as a project, a TIQ
or a user. In addition the entity tables hold references to other Entity object if there
contains any Foreign Keys. Finally, lookup tables store values that are expected to
remain static over the running of the application. For example, the TIQ_STATE table
stores a list of all possible TIQ states; tables such as this one are read, but never written
to during runtime. The rest of this section concerns itself mostly with entity tables.
Entity Classes
Entity tables within the underlying database are represented within the
application by entity classes. An entity class generally contains variables for the
attributes of the table that it represents, as well as getter and setter methods for those
variables. Attributes that are common to all tables (primary key, last modified date, etc.)
will be externalized to a class called DatabaseObject, which acts as a super class to all
entity classes and provides an interface to other classes. DatabaseObject also inherits
our custom cloneable interface, therefore every entity classes is also cloneable.
Data Access Objects
Every entity object has a corresponding DAO (Data Access Object). DAO
classes contain methods that perform database operations which use or return an
instance of some entity class (or an array of entity objects in the case of queries that
return more than one result). Each DAO extends the DataAccessObject class, which
contains abstract methods for the most basic database operations (insert, select,
update and remove). More advanced operations are performed using CDAOs (more
on this later) DAOs do not perform any complex querying because each DAO is
meant to provide a simple one-to-one mapping between an entity and a database table.
This decreases the amount of application-specific logic that these classes contain,
causing DAO objects to have high cohesion.
In the case of query operations, the DAO performs the query, then it instantiates
whatever entity objects it needs to return and initializes them based on the query result
set. For operations that persist some changes to the database, the DAO accepts some
fully-initialized entity object and constructs a create or update SQL statement using the
data contained in the entity object, then executes it.
Controller Data Access Object
These classes perform database operations that involve more complex queries
than simple one-to-one table-to-entity mappings. The superclass for all Controller Data
Access Objects (CDAO's) is the ControllerDataAccessObject class. These classes
follow the same design pattern as the normal Data Access Object described above,
however, rather than providing a one-to-one mapping with some entity, each CDAO has
a one-to-one mapping with each controller class in the application layer.
Connection Pooling
For improved performance, connection pooling will be used so that a database
connection does not have to be created for each DAO operation that is executed.
Instead, the DAO will simply grab an existing connection from the connection pool. This
logic will be implemented within the DataAccessObject class since it is common
functionality that applies to all DAOs.
Generic Programming
Another distinct feature of our backend is that we are taking full advantage of
Java 1.5s new generic programming capabilities. All of our backend classes are
generic which allow us to improve our coding design and efficiency. This should
provide us with the advantage of being able to hand any entity class and any DAO class
to some method, for example, without having to verify whether the DAO class is
compatible with the entity class.
Here is snapshot our some our generic code. The class that extends this must
be of type DatabaseObject. More importantly the return type of clone object is also a
DatabaseObject. This helps enforce low coupling between classes:
public interface Cloneable<Entity extends DatabaseObject>
extends java.lang.Cloneable {
public Entity cloneEntity();
}
Also, note the way the DatabaseObject implements the cloneable interface:
public abstract class DatabaseObject<Entity extends
DatabaseObject> implements Cloneable<Entity> {
This is how we create our entity classes: it extends DatabaseObject of type Tiq
and the cloneable method also returns a Tiq. Returning of type Tiq would have not been
possible with using pure OO design. In OO design we had to return DatabaseObject
instead.
public class Tiq extends DatabaseObject<Tiq> {
.
public Tiq cloneEntity() {
.
}
}
This is how we are creating specific DAO object for each entity. You can see that
TiqDAO is implementing DataAccessObject of type Tiq. Therefore, in the header
definition of our insert we would have Tiq. We could not have achieved this using just
OO design. The alternative was that insert method accept DatabaseObject and we had
to cast to Tiq in order to have access to Tiq specific method that are not in the
DatabaseObject.
public class TiqDAO extends DataAccessObject<Tiq>{
Another important feature of backend design is that all of our classes is of type
Singleton reference, therefore only one of copy of the class exists in the java virtual
machine. Moreover, if you look closely at the definition of the methods, they are thread
safe, indicated by synchronized keyword.
Part 4: Front-End
View / Dialog Classes
Each screen within the application has a corresponding View or dialog class
(though similar screens may be grouped together into a single form class, if possible).
Form classes generally consist of variables for the fields that are contained within that
screen. All screens that are related to some major component of the application will
utilize the same controller class. For example, all dashboard screens will utilize the
dashboard controller class (though they may call different methods to perform different
related actions). These classes are created using the Eclipse Visual Editor plug-in which
follows the best practices standard in the creating GUI components.
RCP Classes
The flow of moving between screens is managed from within the RCP code itself.
This eliminates the need for a controller class that manages the application flow. Most
of these classes are very generic and contains the metadata for the each of view and
plug-ins.
10
11
12