ITECH3201-7201

Assignment 1 – Teaching Period 9, 2014

Marks: 20

(7201 students complete tasks which sum to 24 which then gets converted into a mark out of 20)

Due: As per course description

Type: Individual Task

Disclaimer

You must use the code supplied by your tutor. Do not use code given to you by another student (or past student) as the codebase will be different and you will be awarded ZERO MARKS for the assignment task.

Description

  • You are required to document, test and refactor an existing application.

You will be given a copy of an existing C# application which is responsible taking bookings for a cruise ship, this application is badly in need of refactoring and even a casual viewing of the source code reveals many examples of the “code smells” talked about in Fowler’s book.

The base application consists of several classes – Customer, Reservation, room, Ship, and UBCruises. There is also a file called Program.cs that contains the Main method.

Some notes about the application:

  • There are eight types of cabin which may be booked, standard costs are as follows:
  • Balcony Suite ($5000 per cabin)
  • Suite ($4000 per cabin)
  • Deck 3 - Outside Twin ($3500 per cabin)
  • Deck 2 - Outside Twin ($3400 per cabin)
  • Deck 1 - Outside Twin ($3300 per cabin)
  • Deck 3 - Inside Twin ($3400 per cabin)
  • Deck 2 - Inside Twin ($3300 per cabin)
  • Deck 1 - Inside Twin ($3200 per cabin)

Step 1 – Rename the base code

  1. Download the code from Moodle and unzip it in the filesystem
  2. Rename the base folder to “Assignment 1 – yourid” (your id equals your student number)
  3. Open the solution up in Visual Studio right click on the Solution and rename it as per (2)
  4. Build the solution and inspect the output, now spend some time getting to know the code before you do anything else.

Step 2 – Identify “code smells”

Open up a new document in Word (or equivalent), start jotting down any code smells you identify in the code in point form (you might want to cut and paste the code into word to illustrate the problems).

Step 3 – Create a class diagram of the initial code.

Do this in Enterprise Architect and copy the resultant diagram into your word file. Ensure your EA file is saved and labelled as “starting code base”

Step 4 – Start refactoring and developing your unit tests

Ensure that your starting code and EA file is backed up, and once this is done jump back into Visual Studio and get to work refactoring.

Your final code should be fully refactored and have unit tests developed for every method (other than ToString and Get and Set methods).

Marking Criteria

This assignment consists of a number of tasks for you to perform as detailed in the following:

  • (5 marks) A report describing any “code smells” present in the starting code, and an explanation how you intend to refactor them out of the application.
  • (5 marks) A refactored version of the system eliminating all identified code smells present in the initial code
  • (5 marks) Unit tests for all methods excluding ToString, Get and Set methods
  • Contained in an Enterprise Architect File and your report
  • (2 marks) A class diagram illustrating the initial code and another class diagram illustrating the final refactored code (including all relevant dependencies).
  • (2 marks) A sequence diagram illustrating how the final refactored system processes a new booking.
  • (1 mark) A visual studio solution containing your completed Lab 1 code fully unit tested.
  • ITECH7201 Students Only(4 marks) Add further functionality including:
  • (2 marks)Add a loyalty rewards system. People who are bronze members of the loyalty rewards program receive a 5% discount on all bookings, people who are silver members receive 7.5% discount on all bookings whilst gold members receive 10% off the cost of their bookings.
  • (2 marks) As an added test add a platinum membership to the loyalty rewards program which entitles the holder to 50% of the cost of booking on decks 1,2 and 3 and 25% off the cost of bookings for all suites.

Submit

You are required to submit the assignment before the due date consisting of:

  • A Zip file containing the following (submitted via Moodle under the Assignment 1 link)
  • All code representing your refactored application and Unit tests
  • The accompanying Enterprise Architect file with model versions that correspond to your final code submission.
  • An electronic report, in MS-Word, containing your UML, identification of any problems with the initial code, and an explanation of your Refactorings.

Plagiarism

This is an individual assignment you are not to attempt this assignment (or any part thereof) in conjunction with any other parties. All work handed in for marking should be your own and any help received should be explicitly acknowledged.

It is important to learn from the work of others and you are encouraged to explore the library, World Wide Web resources and have discussions with other students. However, work for assessment must be entirely the student's own work.

Plagiarism is the presentation of the expressed thought or work of another person as though it is ones own without properly acknowledging that person.

You must not allow other students to copy your work and must take care to safeguard against this happening. In cases of copying, normally all students involved will be penalised equally; an exception will be if you can demonstrate the work is your own and you took reasonable care to safeguard against copying.

Plagiarism is a serious offence. As set out in the University Regulation 6.1.1. Students who are caught plagiarising will, for a first offence, be given a zero mark for that task. A second offence will result in a failing grade for the Unit(s) involved and any subsequent offence will be referred to the Student Discipline Committee.

CRICOS Provider No. 00103D / Insert file name here / Page 1 of 3