Lab 3 : Notes and Exercises on OODesign

Case Studies

It is not possible to discuss the OO Design lecture without using some case studies. Here we use three case studies:

Case Study 1: Temperature Converter program

Assume that you have been asked to develop a program to convert from centigrade to Fahrenheit and vice versa. The program is command line based and should present a menu to user to convert from centigrade to Fahrenheit or vice versa.
In both the design and implementation we want to have a low coupling between the UI components and the object which does the actual conversion.
See full design and implementation

Case Study 2: CurrencyUnitsConverter program

Assume that you have been asked to develop a program for converting currencies.
When the program is launched the user will see a menu to choose between converting currencies.
If the user chooses currency conversion the UI show a textfield to enter amount to convert and two drop down lists to convert between two different currencies such as US Dollar to British Pound or Pounds to Euros etc. On clicking the selecting the currencies to convert between and clicking the Convert button an amount is shown to the user.

Case Study 3: Flight Information System

All airports maintain a flight information system to let passengers know to arrivals and departure times of flights at the airport.
It displays the following information about a flight: flight number, airline, aircraft, arrival/departure time, destination/origin, status (ontime, delayed, arrived/departed, canceled).
New flights are added to this system by an administrator. The administrator can remove flights permanently which are no longer using the airport.
Flights which are not current (have already departed more than 1 hour ago or arrived 1 hour ago) are not shown on display.
Users can search flights by flight number, airline, destination/origin and time ranges.
For simplicity you can assume that this a web based system.

Case Study 4: Registration system for Short courses

A university offers various short courses for working people. People interested in taking these courses have to register for a course on the website. A person may register for only one short course on a particular day.
A registration for a course may or may not be successful this depends on the staff who is will take that course.
A staff for course can view a list of registration and approve/reject a registration (because there might not be enough places etc)
New short courses are added by an admin for this system - the admin also remove courses that are no longer offered or make course inactive for courses which may be offered later.

Notes on the lecture

Class, Responsibilities and Collaborations. These are written on cards to identify a class, its reponsibilities and its collaboration (other classes which a class has a relationship with)

Low coupling supports low dependency, low change impact and increased reuse.

Coupling is the measure on how strongly one element is connected to, has knowledge of, or relies on other elements. These elements can be classes, subsystems. — Craig Larman

High Cohesion
This is usually a measure of how the responsibility of a class or subsystem are related to each other - this means that you should not have too many different responsibilities for one class.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License