Tuesday, 27 March 2007

Meeting 27th March 07

Present:
James McDonald
Mark Jovic
Feng-Ming Liu
Rob Rowley

The purpose of this meeting was to collect everything that we have done so far together, and decide what additional methods need to be written. Also, we went through our existing methods to see if any additional functionality was needed. The outcomes of this are listed below:



  • Firstly, the menu.jsp method lists all the methods that a user can access. This needs to have some additional functionality that accounts for whether a person viewing the page is either admin staff, a customer, or a non-customer. This functionality needs to be added to the session and the menu.jsp page needs to display different methods according to this session.

    So, a non-customer will be able to:

    • Browse the list of books using all the search book methods
    • Create a new customer account
    • Login as an existing customer

    A customer will be able to:

    • Browse the list of books using all the search book methods
    • Update their personal details
    • View a list of their past orders
    • Logout

    An administrator will be able to:

    • Browse the list of books using all the search book methods
    • Browse the list of customers using all the customer search methods
    • Update their personal details
    • Search for specific orders using search by Order ID
    • Logout

    There will be other methods available to each user type, but these will be accessed from the current page, rather than by the side menu.

  • The method header.jsp will just contain the webpage title and will remain constant throughout.
  • The method main.jsp will be the title welcome page and will contain no functionality.
  • The NewUser.jsp page will be used to create a new customer. It contains some Javascript code to perform some validation checks, but no additional functionality will reside in this page.
  • The search.jsp page covers all the search methods that will be used in this program. It requires no extra functionality.
  • The book.jsp page returns one book and displays all the details on the page. This method will need additional functionality depending on the user. All users will need the ability to perform a new search. A customer will need the ability to buy the book. An administrator will be able to delete the book from the database, as well as being able to update the book's details.

    MJ to introduce the additional functionality that this method requires

  • The bookResult.jsp will list a table of all the books returned from that search. It will need a function that allows each user to select an individual book and then list this book using the book.jsp page.

    FM to introduce the additional functionality that this method requires

  • The customer.jsp page will list a customer's details only for an administrator. It will need additional functionality for updating or deleting that customer.

    JM to write this method.

  • The NewBook.jsp method will create a new book and be only accessible by an administrator.

    RR to write this method.

  • A logout.java method will be required to remove the current user from the session.

    MJ to write this method.

We also discussed which session parameters we will need. At the current time we will only be implementing a User attribute in the session. This will have the values:

  • Null - for a non-customer
  • Customer - a customer object (cust_id>1000) for the current customer
  • Admin - a customer object (cust_id<=1000) for an admin member

N.B The way that we will distinguish between a customer and an administrator is by the customer id value. A value from 1 to 1000 represents an administrator and anything over 1000 represents a customer

Wednesday, 14 March 2007

Deliverables 1

Msc Software Workshop 2006/7


Semester 2, Exercise 4


Group Members:


Rob Rowley

Mark Jovic

Feng-Ming Liu

James McDonald



Deliverable 1


Project Definition


Creation of an online E-commerce site. The site will be an online book store from which individuals can purchase hardcopy (and if functionality is extended, electronic) books.



Requirements


1.

Graphical display of book cover (size restriction to aid formatting).
2.

Access to (and ability to write) reviews of individual titles.
3.

'Basket' or 'checkout' option.
4.

Storage and retrieval of individual title details, including:

1. Title, genre, ISBN number, price.
5.

Storage and retrieval of personal details, including:

1. Name, address, payment details, etc.
6.

User enters all necessary personal details (see above) when making first purchase. These details are then stored and a user ID and password facility is evoked for further transactions.
7.

Search method for displaying titles.
8.

Distinct 'user' and 'administrator' (the latter for employees) access.
9.

Dynamic price function so that item prices can be upgraded or altered to 'sale items'.


Project Plan


1.

Major tasks:

Four main aspects: HTML, JSP, JDBC, and database design and maintenance.

1.

HTML:

Each process from user selection to maintenance of book information is presented in HTML format. However, HTML is only a display of static information or information from database queries and from some business logics. Therefore, the role of interaction belongs to some “active” web pages.

2.

JSP:

Like PHP and ASP, JSP is a kind of active web page, which allows interactions with users according to some requirements. There are two primary tasks that a JSP program should handle. Firstly, checking input information by requirements when it receives the information. Secondly, processing data together with that stored in the database. For example, a user might try to find a book by inputting an author’s name. When receiving input data, the JSP program will use a pre-set SQL command to query data in the database and show processed information on web page to the user.

3.

JDBC:

JDBC is an interface between the JSP program and database. Its responsibility is to provide a channel through which the program can communicate with the database and that the database can return information to the program.

4.

Database design and maintenance:

A database is the “cornerstone” of a system. Good database design could reduce queries from a program and make queries easier and more efficient. However, a good database design relies on thorough realization of the objectives and requirements of a system. In order to clearly specify requirements, interactions with user should be defined. For instance, an online bookstore allows only registered members to purchase books. Then what kind of data should a user should input when he/she wants to become a member of the store? Or what is the sequence of buying a book and how does the member pay the bill? Once these behaviors are decided, the requirements of the system become clear.

In order to keep the data consistency of the database, the maintenance of the database is also very important. For end-users, they probably could not directly operate the console of the database system; so a good implementation of the application is necessary. Actually, this is the implementation of requirements for the staff of the bookstore.

2.

Gantt chart

(see attached chart)

3.

Assessment of the major risks:

1.

Primary risks might be in two fields: database design and JSP program implementation. Primary risks for database design are about bad designs that cannot trutfully reflect relationships between entities and attributes of entities. How to keep data consistency is also an important issue related to database design.

The primary risks about JSP implementation are related to how to implement the “commercial logic” of the bookstore and how to maintain the database in a reasonable way.

2.

How to handle the risks

With regard to the database, the design should follow the requirements. At the design phase, we could use ER Model to represent the relationships between the entities and use normalization to reduce redundancy of data in the database.

With regard to the JSP program, we should concentrate on how to control the process with static HTML. For instance, we could use an exception to catch an input String for a supposed int variable and display a message to inform the user to input the correct data. The JSP program is responsible for maintaining the database, so we have to pay a lot of attention when implementing the program.

3.

Roles of each team member:

We anticipate that the roles will be dynamic, as each member has a desire to fully-understand each aspect of the project design and give input where necessary. That said,general provisional responsibilities have been allocated as follows:


1.

JDBC and database - Mark and Rob
2.

HTML and JSP - Feng-Ming and James


* See Gannt chart for breakdown of implementation.

Tuesday, 13 March 2007

PostgreSQL from home using Windows and Netbeans

Getting PostgreSQL running on your home machine

To import a database created at uni, you first need to dump the information into a file readable by PostgreSQL. To do this, in the terminal window type pg_dump -O DBNAME > FILENAME. This will create a file with the name you specified, removing the owner privelages which will make it easier to restore it on another computer.

First, download postgresql from the official website here.

Install postgresql on your local machine. It would be a good idea to use your windows login for your PostgreSQL main login to save you having to log on as a different time you access psql.

Access the command prompt and move to the \Postgresql\8.2\bin\ (this is done automatically if you load 'Command Prompt' in the newly created Postgresql folder in your start menu. To log into postgresql, type psql postgres. This will log you into PostgreSQL.

You can setup a new user from here to allow you to connect as the same username as you use at uni to keep your code as close to what you will need to run on the uni computers. To do this, type Create user USER with password 'PASSWORD' createdb; This creates your new user with the privelage to create databases. Quit PostgreSQL using the \q command.

Log back in as your new user using the command psql postgres "USER" (include the " " around username). You will be asked to enter your password. Once you are in, create a new database with the same name as the database you are working on at uni with the command create database DBNAME. Quit PostgreSQL once this is done.

Now we need to restore the database dump into your local postgresql. Make sure that the dump of your original database is in this directory, and then type psql DBNAME <>". This will imort the file into the newly created database and you're ready to connect to it. To do so, type psql DBNAME "USERNAME".

Getting netbeans set up to connect to PostgreSQL databases

Download the JDBC drivers here. Put the jar file in your Java folder (normally \Program Files\Java\).

Load up netbeans and right click on your project and go to properties. Select Libraries from the left pane and make sure you are in the compile tab. Click Add Jar/Folder and find the JDBC jar file you just saved.

To make a connection in a java method, you first need to call

Class.forName(org.postgresql.Driver);

This tells netbeans which driver to use when creating connections.
When creating a connection, the default url for a locally stored database is

jdbc:postgresql://localhost:5432/DBNAME

Meeting 3

Minutes of meeting 2 (13/3/07)

People present - James, Feng-Ming, Rob, Mark

Database design

Discussed the current format of the database and considered implementing a staff table to store details about staff members. Agreed that this is not essential to the application and may serve to complicate the database design as well as the JDBC code without adding any real extra functionality.

Added email address to the customer table.

Task Allocation

Discussed implications of workload for JDBC versus JSP and decided to share JDBC code evenly in order to allow all members the chance to learn and code JDBC before moving onto JSP, which will hopefully give us a better understanding of what we expect the JDBC to offer us in terms of functionality.

I have already written some basic Exception classes and Rob and I have come up with API's for 3 classes - Book, Order and Customer.
We have assigned some Java code writing to each member to have done by Thursday;

Mark - Outline methods that we need to provide access to our database.
Rob - Write Customer class.
James - Write Book class.
Feng-Ming - Write Order class.

Deliverables

On Thursday, we expect to have some reports into research by each team member, concentrating on the area(s) that we have covered so far. Database design is to be modified by Rob, and we will all consider revisions to our requirements and Gantt chart.

I also hope to have a brief guide to getting postgresql setup on our home computers, and details on how to get netbeans to communicate with the database done by tomorrow which will allow us to work from home.

Next meeting - 15/3/07 12.00pm. Agenda - review current position, complete deliverables, assign JDBC tasks and start JSP implementation.

Sunday, 11 March 2007

Database Design

We now have a provisional design for the database done, as outlined below;

Database design has now been mdified and finalised - 12/3/07

Table 1 - books

book_id - varchar(10) - primary key
title - varchar - not null
author - varchar - not null
genre - varchar - not null
price - real - not null
picture_loc - varchar
stock - integer - not null
review - varchar

Table 2 - customers

cust_id - serial - primary key
password - varchar - not null
first_name - varchar - not null
last_name - varchar - not null
street - varchar - not null
city - varchar - not null
postcode - varchar(8) - not null
country - varchar - not null
phone_number - varchar - not null
email - varchar - not null

Cust_id sequence = customers_cust_id_seq
cust_id starting value is 100001

Table 3 - orders

order_id - serial - primary key
cust_id - integer - foreign key
book_id - integer - foreign key
data - date - not null

Order_id sequence value = orders_order_id_seq

Rob and I will be spending the weekend working on SQL queries, focusing on adding/modifying and queries respectively. We hope to have the database design finalised by Tuesday at the latest, allowing us to decide on the methods we require, with a view to coding the majority of the JDBC by the end of the week.

We have now, after considerable issues, been able to connect to a local version of our database using netbeans and the postgresql drivers, and we are now able to start writing our JDBC.

Now that the database is finalised, an API for the JDBC can be written and work can begin on writing the methods and the sql queries.

Next Meeting - 13/3/7 12.00pm - Agenda = task review & allocation.

Thursday, 8 March 2007

Meeting 1

Minutes of meeting 1 (6/3/07)

People present - James, Feng-Ming, Rob, Mark

Project Diary format

Discussed possibilities for project diary, with consensus that a blog will be best suited to our needs.It will enable all group members to add informal thoughts, findings etc and can be edited to a final submission if necessary.

Project Definition

Discussed alternatives for project theme. Possibilities considered included:


  • Online family tree

  • E-Commerce website

  • Online rental service

  • Wiki-themed site

Online family tree

Considered as we have all covered this area but quickly dismissed as it might not be very interesting as a lot of the work has been done previously.
Finished product could be rather plain and uninspiring

Wiki-themed site

Seriously considered as it would suit the web-based theme very well.
Could require huge database, even if narrowed down to a specific theme/area.
Would require massive initial database, with updates being infequent and small, which is the opposite of what we were hoping for.

Online rental service / E-commerce website

Essentailly alternatives to the same idea.
Meets the requirements of the project, and satifies our own aims.
Considered an acheivable project by all, with scope to showcase our abilities.


Project agreed as an e-commerce website, and we narrowed the field down to an online bookstore.

Successful alternatives available which will aid research.
Wealth of 'real' data available to us
Natural primary key for database in ISBN number

Next meeting - 8/3/07 12pm

Before next meeting

All - draft submissions for deliverable 1
think about database needs
look into current technologies

Mark/Rob - concentrate on JDBC / SQL
James/Feng-Ming - concentrate on HTML / JSP

Introduction: A Web-Based Application

This blog acts as a project diary for the completion of the final MSc Software Workshop exercise, the remit for which is as follows:

Purpose

This exercise will be undertaken in small groups.

The project will build a small web-based application. This application will be selected by the group members.

Given that the potential applications are very large, an important requirement is to set the scope so that it is achievable in the time available.

To do this, group members will have to research and understand new technologies. Work will need to be planned, allocated to group members, and progress monitored.



The only constraints on the project are that it must:

  • Be Java-based

  • Include a relational database

  • Be delivered by the deadline (Friday 4th May, 2007)