Contract Law
October 1, 2020
Topic: Managing Groups and Teams
October 1, 2020

Disclaimer

You must use the code supplied by yourtutor. Do not use code given to you by another student (or past student) asthe codebase
will be different and you will be awarded ZERO MARKS forthe 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 ofthe source code reveals many examples ofthe
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.csthat containsthe Main method.

Some notes about the application:

There are eight

types of cabin which may be booked, standard costs are asfollows:

o Balcony Suite ($5000 per cabin)

o Suite ($4000 per cabin)

o Deck

Outside Twin ($3500 per cabin)

o Deck2 – Outside Twin ($3400 per cabin)

o Deck1 – Outside Twin ($3300 per cabin)

o Deck3 – lnside Twin

($3400 per cabin)

o Deck2 – lnside Twin ($3300 per cabin)

o Deck1 – lnside 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 folderto “Assignment 1 – yourid” (your id

equals your student number)

3. Open the solution up in Asual Studio right click on the Solution and rename it as per (2)

4. Build the

solution and inspectthe output, now spend some time getting to knowthe code before you do anything else.
Step 2 – ldentify “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 wantto cut and paste the code into word to illustrate the problems).

Step 3 – Create a class diagram ofthe initial code.

Do this

in Enterprise Architect and copythe resultant diagram into yourword file. Ensure your EAfile is saved and labelled as “starting code
base”

Step 4 – Start refactoring and developing your unit tests

Ensure that your starting code and EAfile is backed up, and once this

is done jump back into fisual Studio and getto work refactoring.

Yourfinal code should be fullyrrefactored and have unit tests developed

for every method (otherthan oString and Get and Set methods).

NOTE:

-It is required to create different classes for each type of

cabin.

-Each cabin’s class should only contain the methods, which are related to the class.

Marking Criteria

This assi nment consists

of a numger oftasks for you to perform as detailed in the following:

(5 marks) Areport describing any”code smells” present in

the starting code, and an explanation how you intend to refactorthem out ofthe application.

(5 marks) Arefactored version ofthe

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

o (2 marks) Aclass diagram illustrating the initial

code and another class diagram illustrating the final refactored code (including all relevant dependencies).
o (2 marks) Asequence

dia ram illustrating howthe final refactored system processes a new booking.

(ll mark) Avisual studio solution containing your

completed Lab 1 code fully unittested.

Submit

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

AZip

file containing the following (submitted via Moodle under the Assignment 1 link)

o All code representing your refactored application and

Unittests

o The accompanying Enterprise Architect file with model versionsthat correspond to yourfinal code submission.
o An

electronic report, in MS-Word, containing your UML, identification of any problems with the initial code, and an explanation of your
Refactorings.