In this assignment you are required to document, test and refactor an existing C# application.

You will be given a copy of an existing C# application, 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.

Your report1 should be written in the same manner as Fowler has done in the prescribed text - small refactorings with code comparisons and UML diagrams (refer Fowler pp.1-65). Ask your tutor if you have any doubts.

Some notes about the application:

  • Theatres have three sections: stalls, dress circle and balcony
  • Each theatre section has a number of rows and each section row has the same number of seats.
  • Each section has a different price per seat
    • Stalls $38.50
    • Dress circle $49.50
    • Balcony $91.50
  • Customers must register with the system prior to placing a booking
    • Customers must present credit card information when registering
  • Customers may be members or nonmembers of the “Theatre Club”
    • Non members pay full price per seat
    • Members fall into three categories: bronze, silver and gold
    • Bronze members are entitled to a discount of 10% off the total price of their booking
    • Silver members are entitled to a discount of 20% off their booking
    • Gold members are entitled to a discount of 30% off their booking
  • The system will automatically reserve a given number of seats in a requested section
    • The seats are booked in the first row of a section which is found to have the number of requested seats free adjacent to each other.
    • The application searches a section from the first row working backwards towards the last row until it finds the requested number of seats.
    • There is no facility to book a particular seat.
  • The system can potentially manage many theatres, each theatre has a number of theatre bookings (events) and each theatre booking has a number of customer bookings.
  • Customers can currently only make a single booking for each event.

Your report should identify any of Fowler’s “Bad Smells” in the code, and which refactorings you performed to improve the application’s design.

UML2 documentation:

  • Class Diagram: (represent the refactored system marking in any attributes, operations, associations and dependencies as required)
  • Sequence Diagram: Calculation of Charges (represent the calls made by the refactored system when calculating the charges for a booking)
  • Sequence Diagram: Booking Seats (represent the calls made by the refactored system when booking seats in response to a reservation)

Refactor the code using the textbook and the refactoring example from the lecture as a guide. The resultant code should be generally free from Fowler’s “code smells”, this will become obvious when you start writing your NUnit tests and documenting the refactored system in UML.

You should hand up a brief justification of your changes in your report (see above).

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.