Assessments for 06-18156 Internet Computing Workshop — Sem 2

Alan P Sexton


Table of Contents

1. Summary
2. First Assessed Exercise
2.1. Marking scheme
3. Second Assessed Exercise
3.1. Marking scheme
4. Third Assessed Exercise
4.1. Marking scheme
5. Fourth Assessed Exercise
5.1. Marking scheme
6. Fifth Assessed Exercise
6.1. Marking scheme
7. Sixth Assessed Exercise
7.1. Marking scheme

1.  Summary

So far, assessments for 50% of the marks for this term's half of the module have been set. The remaining half will be set as the term progresses and will cover the remaining learning outcomes.

2. First Assessed Exercise

The following program shows a full program using each of the features discussed above and a Postgresql database: Customer.java You also need the Database.Properties file. This file must be placed in the same directory that the Customers.class file is in when the program is executed (Customers uses the getResourcesAsStream method to use the class loader to find the Database.Properties file). Note that you must modify the database.name and the default database.user properties in this file to match your database and username. Note that the Customers.java file does not contain the password for the database nor is it stored in the properties file. Instead there is a routine that creates a Swing dialog that asks you to enter the password. This means that the application will not run on a commandline only interface. This restriction is better than requiring you enter your password as a command line argument (which is very easy for other users on the same machine to snoop) or to enter it in your files. Unfortunately, Java does not provide a proper portable way to input passwords securely from a command line interface.

The shop_create.sql script sets up the shop database in Postgresql (use the '\i' command in psql to import the script). There is also a script, shop_drop.sql to delete all the tables and sequences created by the creation script so that you can easily clear out your data and start again. Note that the Customer.java program does require the database to be set up and it ends up deleting all records from the Customer table.

The first assessed exercise is to implement the following use case:

Name        Add book to order
Initiator   User
Goal        Given a customer email address and a book ISBN, add the book
            the customer's order

Main Success Scenario
1.   User requests that a book be added to a customer's order
2.   System identifies customer from email address
3.   System identifies book from ISBN
4.   System obtains current open order for customer
5.   System adds new orderDetail for book to order

Extension
2.   No matching customer found
     1. Fail
3.   No matching book found
     1. Fail
4.   No open order for customer found
     1. Add new order for customer
     2. Resume 5
5.   OrderDetail for book exists
     1. add one to quantity for orderDetail
     2. Stop

  • You must implement the above use case in Java as a console application using JDBC for the database interaction.

  • You must use sql statements in the sample application above to create the tables that you will use in your application.

  • A printout of the source code for your program must be submitted to the appropriate pigeonhole (beside reception in the Computer Science building) by 11:00 Monday 24th January.

  • Every file of your printout should contain your student id number clearly at the top of the file in a comment. It must not contain your name or your username.

  • The marks for this exercise will be 10% of the marks for this term's half of the module (i.e. 5% of the entire module's mark).

2.1.  Marking scheme

  • 4 marks for general readability and program logic.

  • 3 marks for appropriate use of the basic JDBC library.

  • 3 marks for appropriate design and structure of transaction handling code.

3.  Second Assessed Exercise

The second assessed exercise is to re-implement, using Hibernate, the exercise "Add books to an order application".

  • Submission should be electronic: I will email details when the system has been set up. Deadline for submission is:

    11:00 Monday 7th February.

  • Do not use packages but leave all your classes in the default package.

  • Your submission should contain one directory containing your *.hbm.xml files, and your *.java. You should not include any hibernate.properties or log4j.properties files. It should not contain any other files (no class files, no log files etc.)

  • The directory containing your submission should be packaged up using jar. From the DOS prompt, if your exercise directory is called "ex2", execute the command:

    jar cvf ex2.jar ex2

    to create the jar file to submit.

  • Every file submitted should contain your student id number clearly at the top of the file in a comment. It must not contain your name or your username.

  • The marks for this exercise will be 20% of the marks for this term's half of the module.

3.1.  Marking scheme

  • 4 marks for general readability and program logic.

  • 6 marks for basic design of the business objects and basic Hibernate Object-Relational Mapping files

  • 4 marks for the advanced elements of the mapping files: bi-directional mappings, lazy loading, many-to-one relationships.

  • 6 marks for correct handling of Hibernate exceptions and transactions.

4. Third Assessed Exercise

The third assessed exercise is to develop a new use case for our bookstore application and implement it using Hibernate. The new use case is to "Close an open order"

  • The use case you have to implement should take a customer's email address as an argument to the program, find the open order associated with that customer (printing an appropriate error message if there is no such customer or open order), get the current price for each book in the order and record it in as the book charge in the order details, set the date of the order to the current date, close the order and print, to standard out, an invoice which should include (at least) the date, the customer name, and itemised list of the books in the order and the quantities and prices and a total charge.

    Your program should take either a single "create" argument which should create the database and populate it, or a "closeOrder" followed by a customer email address argument to execute the use case.

  • The textual use case should be written in a comment at the top of your Main.java file.

  • You may base your solution on your solution code for exercise 2 or on my solution code for the same exercise (which will be made available on my web site after the deadline for exercise 2).

  • You are free, if you choose, to separate the closed and open orders into a set of closed Orders property and an open Order property of Customer.

  • Submission should be electronic using the BOSS system as described on my module page. Deadline for submission is:

    11:00 Monday 14th February.

  • Do not use packages but leave all your classes in the default package.

  • Your submission should contain one directory containing all your *.hbm.xml files, and all your *.java files that are necessary to compile and execute the program. You should not include any hibernate.properties or log4j.properties files. It should not contain any other files (no class files, no log files etc.)

  • The directory containing your submission should be packaged up using jar.

  • Every file submitted should contain your student id number clearly at the top of the file in a comment. It must not contain your name or your username.

  • The marks for this exercise will be 10% of the marks for this term's half of the module.

4.1.  Marking scheme

There is no new business objects or mapping files to create. The aim of the exercise is to learn to design and write an appropriate use case and to code the use case into appropriate business logic in a Hibernate framework.

  • 4 marks for use case.

  • 2 marks for coding of use case into business logic.

  • 2 marks for correct exception/transaction handling code.

  • 2 marks for general readability, clarity of logic and maintainability.

5.  Fourth Assessed Exercise

In this exercise, you are to take our Spring/Hibernate application in a direction of your own choosing. The result should be a single console application (no web interface yet please!). You can extend the BookShop application we have been building or you can start with a whole new application.

  • You must write a plain text (no Word files) README.txt file that summarises the option you chose, the tables you have added and the use case you have implemented. It must also list a number of sample lines (including appropriate arguments) to use to invoke the use case on your program.

  • It is your responsibility to ensure that you do not implement the same extension or new application as any other student in the class: opportunity will be given in the lecture on Monday 21st to compare your plans with other students. Otherwise, you can use email to let others know your plans (you should have a list of email addresses from my previous emails to the class).

  • If you choose to extend the existing Bookshop application, you must:

    • Start with the codebase provided in SpringHibernate.jar. You should not work from your own solutions to previous exercises (because of the difficulty of marking the result)

    • Add at least one new table to the database, with associated business class and DAO.

    • Add at least one new sensible use case to the system that works with the new table as well as at least one of the existing tables in the application (i.e. it is not sufficient to have a trivial lookup of a new table that has no relationship to any other table in the application).

    • All appropriate changes must be made to the application code (e.g. the code to populate the database must be updated if necessary, the main method should be updated to invoke the new use case etc.)

  • If you prefer, you may choose to start with a whole new application rather than extend BookShop. Note however, that there are no more marks available for doing so than for extending BookShop: this option has been provided merely because some students wanted it.

    If you choose this option, you must:

    • Start with the codebase provided in SpringHibernate.jar. You should not work from your own solutions to previous exercises (because of the difficulty of marking the result). Naturally, you will not be using the business or data access objects of that application, but you should use keep to the same general structure as provided.

    • Implement at least three tables with appropriate relationships between them together with associated business objects and DAOs.

    • Implement at least one sensible use case that involves three tables.

    • Provide appropriate database population code for initialising the database.

  • The deadline is Monday 28th February.

  • The marks for this exercise will be 10% of the marks for this term's half of the module.

  • Submission must be electronically via the BOSS system: You must provide a jar file of the directory containing all your sources in their appropriate Package structure, with the README.txt file in the top level.

5.1.  Marking scheme

There is no new business objects or mapping files to create. The aim of the exercise is to learn to design and write an appropriate use case and to code the use case into appropriate business logic in a Hibernate framework.

  • 3 marks for design and coding of new/differing business objects and Hibernate mapping files.

  • 3 marks for general correctness of code and appropriate design of use case.

  • 2 marks for modifications to Spring configuration file to wire objects (Dependency Injection) and to declaratively specify transactions (Aspect Oriented Programming).

  • 2 marks for general readability, clarity of logic and maintainability.

6. Fifth Assessed Exercise

The fifth assessed exercise is to design a web user interface for some use cases in our bookstore application and implement it using Spring MVC, JSP and JSTL. You should use the business objects from previous exercises. Since we are not connecting to the database in this exercise, we will not use Hibernate or the Data Access Objects defined previously.

  • Your user interface should involve at least one command style controller, at least one simple form controller and at least one wizard form controller.

    Data in forms should be validated, with appropriate error messages on incorrect input, and duplicate form submissions should not be possible.

  • You are free to design your pages, and your page navigation, as you please. However, the result should be a suitable design and implementation for part of the web Book Shop application.

  • You do not need to have working use cases: after all, there is no database access required in the exercise. You may wish to partially simulate use cases in order to better test and debug your interfaces: e.g. maintain a set of customers in the session so that an "add new customer" and a "list customers" use case can simulate their operations. However, that is not required.

  • Submission should be electronic using the BOSS system as described on my module page. Deadline for submission is:

    12:00 Wednesday 16th March.

    There will be vivas in the LG05 immediately after the submission deadline where you will be expected to demonstrate your working user interface. Each viva will take from 5 to 10 minutes.

  • Your submission should contain one directory containing all your files that are necessary to compile and execute the program. It should not contain any other files (no class files, no log files etc.)

  • The directory containing your submission should be packaged up using jar.

  • Every file submitted should contain your student id number clearly at the top of the file in a comment. It must not contain your name or your username.

  • The marks for this exercise will be 20% of the marks for this term's half of the module.

6.1.  Marking scheme

  • 2 marks for command view design and processing

  • 4 marks for simple form view design and processing

  • 4 marks for wizard form view design and processing

  • 3 marks for overall design of page navigation

  • 3 marks for validation, error handling and duplicate submission handling.

  • 4 marks for general readability, clarity of logic and maintainability.

7. Sixth Assessed Exercise

The sixth assessed exercise is to bring together all aspects of web application development covered to date. You should implement a web application that allows a customer to log in, to search for a book and to add it to the customers basket. On successfully adding it to the basket, the application should display the current contents of the basket.

  • On every page, (except the login page) there should be a logout facility.

  • The basket, i.e., the open order, should survive across separate sessions.

  • You do not need to implement extras such as password change forms, registering a new customer, closing orders or secure access.

  • You should use the BookShop classes we have used earlier in the module, although you will have to add a password field to the Customer object, and you should use Hibernate for accessing the database.

  • Exceptions from controllers should be caught and handled appropriately.

  • Data in forms should be validated, with appropriate error messages on incorrect input, and duplicate form submissions should not be possible.

  • You are free to design your pages, and your page navigation, as you please. However, the result should be a suitable design and implementation for the required part of the web Book Shop application.

  • Submission should be electronic using the BOSS system as described on my module page. Deadline for submission is:

    12:00 Wednesday 27th April.

    There will be vivas in the LG05 immediately after the submission deadline where you will be expected to demonstrate your working user interface. Each viva will take from 5 to 10 minutes.

  • Your submission should contain one directory containing all your files that are necessary to compile and execute the program. It should not contain any other files (no class files, no log files etc.)

  • The directory containing your submission should be packaged up using jar.

  • Every file submitted should contain your student id number clearly at the top of the file in a comment. It must not contain your name or your username.

  • The marks for this exercise will be 30% of the marks for this term's half of the module.

7.1.  Marking scheme

  • 10 marks for overall web interface design and implementation

  • 15 marks for functionality and correctness of application, including database access, http Session, handling, exception handling, validation, duplicate form submission etc.

  • 5 marks for internal design and coding for maintainability, including choice of package structure, layout of context files, coding style, clarity of logic etc.