6
DEVELOPMENT CONCEPT AND DESIGN PATTERN FOR TRAVEL ITINERARY PROJECT 1 Module: Web Application Design and Modeling (WDAM) Assignment: Final Assignment (Itinerary 2012 project) Team Name: As a Whole Created by Team Members Reviewed by Team Members Created Date 10 Jan 2012 Revised Date 12 Jan 2012 Revision No. 1.0 Document Name D01-002

Itinerary Website (Web Development Document)

Embed Size (px)

Citation preview

Page 1: Itinerary Website (Web Development Document)

DEVELOPMENT CONCEPT AND DESIGN PATTERN

FORTRAVEL ITINERARY PROJECT

1

Module: Web Application Design and Modeling (WDAM)

Assignment: Final Assignment (Itinerary 2012 project)

Team Name: As a Whole

Created by Team Members

Reviewed by Team Members

Created Date 10 Jan 2012

Revised Date 12 Jan 2012

Revision No. 1.0

Document Name D01-002

Page 2: Itinerary Website (Web Development Document)

OBJECTIVE OF THIS DOCUMENT2

1.To propose our design pattern

based on well-known framework

and architecture.

2.To prevent if our application

cannot run in different

environment properly.

3.To explain how we used object-

oriented and development

concept applied for this project.

Page 3: Itinerary Website (Web Development Document)

Abstract Controller

Itinerary Controller

Flight Controller

Friend Group

Controller

ActivityController

Transport Controller

Trip Manager Controller

Itinerary.mail

Itineary.Util

Itinerary User

TripManager

Admin

Data Model Layer ORM (Mapper)

Business Logic LayerItineary.Model, utils, mail

JSP page#1

JSP page#2

JSP page#3

JSP page#4

JSP page#4

JSP page#6

Itin_Item

Transport

Privacy Note

Activity

FriendGroup

Flight

Note Controller

Privacy Controller

User Controller

JSP page#n

Applied from Kuali Application Architecturehttps://wiki.kuali.org/display/KULRICE/Architecture+(Archive+from+Original+KTC+Work), Last accessed 7 Jan 2012

Web Browser

Database (Microsoft Access)

Applied abstraction, inheritance and and polymorphism concept. Therefore, code can be reused in each layer.

Services

Services

OUR DEVELOPMENT CONCEPT

FOLLOWING OO & DESIGN PATTERNWe separated code into three tiers

JDBC

Presentation LayerWeb Application (JSP)

Itinerary.Model

Itinerary.Controller

Page 4: Itinerary Website (Web Development Document)

APPLIED MVC (MODEL VIEW CONTROLLER)

ON ITINERARY PROJECT.4

Applied from http://www.asp.net/mvc/tutorials/overview/asp-net-mvc-overview, last accessed 11 Jan 2012

Update DataUpdate

presentation

Get Data

MS Access database

Abstract Controller Class

Entity Specific Controller ClassCalss1 .. Class n

Data Model Layer

Benefits for this concept.

1. Encapsulate DBMS and SQL Language

2. Flexible to change DBMS

Main functions of our Controller Class

1. Support CRUD Operation between DBMS(persistent layer) and Data model layer. ( C=Create, R=retrieval, U=Update, D= Delete )

2. Map database and tables into Objects. So, a user programmer doesn’t need to learn about database backend behind application. Also, SQL syntax is encapsulated from the application layer.

The Controller Concept

Page 5: Itinerary Website (Web Development Document)

Benefits:

1. Separate characteristic of each subclass which has same concept of the abstract class.

2. Code is the same pattern. It is easy to maintain and delegate work.

EX. SOURCE CODE AND IMPLEMENTATION

CONCEPT IN CONTROLLER PAGKAGE5

// Tell controller what is the table's Primary Key Field Namepublic abstract String getPKFieldName();

// Tell controller What is the table Name to Store Objectpublic abstract String getTableName();

//Tell controller How to Load data from Database to objectprotected abstract Object CreateFromResultSet()

// Tell controller How to Store object to databasesprotected abstract void SaveToResultSet(Object obj)

// 1) Find And return Single Object by Primary key Value

public Object FindObject(String PKValue)

// 2) Retrieve Object by specific Field Name and Value

public Object FindObjectByField(String FieldName,String FieldValue)

// 3) Save Your Object to databases

public void SaveObject(Object obj)

// 4) Retrieve all objects in table

public ArrayList<Object> getObjectList()

// 5) Retrieve objects with conditions

public ArrayList<Object> QueryObjects(String Condition)

// 6) retrieve Objects with specific query

public ArrayList<Object> CustomQueryObjects(String SelQuery)

// 7) delete Object by Primarykey Value

public boolean DeleteByPKValue(String PKValue) throws SQLException

Ex. Abstract Methods in our AbstractController Class Ex. Superclass Methods in our AbstractController Class

Regarding with our abstract class, programmer can implement a subclass as following;

1) Create Class and Inherit from Abstract Controller Class.2) Override the Abstract Methods to Implement the Controller class.

Abstraction, Inheritance and Polymorphism concepts are also applied in this AbstractController.

Page 6: Itinerary Website (Web Development Document)

//1) Create ItineraryCreateItinerary():boolean

//2) Update ItinearyUpdateItinerary():boolean

//3) Delete ItineraryRemoveItinerary():boolean//==================================//4) Search Itinerary by Condition //ex. ItinNo = ‘T01’ and UserName = ‘john’//Function will return array list following condition//==================================SearchItinerary(String condition):ArrayList<Itinerary>

//5) Search by ItinNo//Return Object of ItinerarySearchByPk():Itinerary

//Search Shared Itineraries (Needs to check privacy)SearchSharedViewItinerary(String UserName):ArrayList<Itinerary>

EX. COMPLETED DESIGN IN MODEL PACKAGE

(REDUCE RECOMPLING CODE)6

Ex Method in Itinerary.Model

//1) Create User ProfileCreateProfile():boolean

//2) Update User ProfileUpdateProfile():boolean

//3) Delete UserRemoveUser():boolean

//==================================//4) Search User by Condition //ex. UserName = ‘abc’ and FirstName = ‘john’//Function will return Array list following condition//==================================SearchUser(String condition):ArrayList<User>

//5) Search by UserName//Return Object of userSearchByPk():User

Ex Method in Itinerary.User

As can be seen, model classes have five main methods.1. Presentation layer (JSP) can operate inserting, updating,

deleting and retrieving data objects following these main methods.

2. We add some methods in model classes for specific needs ex. SearchSharedViewItinerary because this function needs to search with privacy. It cannot use general search method.

Benefits:

1. Flexible to operate creating, updating, deleting and retrieving data without recompiling java.

2. Database is also encapsulated in this layer.

JSP is flexible to operate data objects and reduce needs to add more

methods in model classes.