C sharp assignment question
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 for taking bookings for a hospital system, 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 three classes – Doctor, Patient and Hospital.
A patient can be a private or public patient and is handled differently in either case. Patients are assigned to Doctors according to availability and preference.
Step 1 – Rename the base code
- Download the code from Moodle and unzip it in the filesystem
- Rename the base folder to “Assignment 1 – yourid” (your id equals your student number)
- Open the solution up in Visual Studio right click on the Solution and rename it as per (2)
- 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 intial 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
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.
- (8 marks) A refactored version of the system eliminating all identified code smells present in the initial code (including all unit tests).
- Contained in an Enterprise Architect File and your report o (2 marks) A class diagram illustrating the initial code and another class diagram illustrating the final refactored code (including all relevant dependencies).
o (2 marks) A sequence diagram illustrating how the final refactored system processes a new patient.
- (2 marks) Add new functionality according to the following specification. A private patient, according to his/her policy, is able to receive a discount from the Doctor’s fee. These discounts are: § Level A – 10%
- Level B – 20%
- Level C – 30%
Implement functionality that enables the Doctor’s fee to be calculated according to the above requirements. Note a public patient gets no discount.
- (1 mark) A visual studio solution containing your completed Lab 1 code fully unit tested.
- Assignment Help
- Homework Help
- Writing Help
- Academic Writing Assistance
- Editing Services
- Plagiarism Checker Online
- Research Writing Help