Object Oriented Design - PowerPoint PPT Presentation

About This Presentation
Title:

Object Oriented Design

Description:

... Jim both work at Ticket Counter #1; Tom and Theresa work at Ticket Counter #2. Creating the model ... given problem AND what may be needed to solve future, ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 35
Provided by: mccl8
Category:

less

Transcript and Presenter's Notes

Title: Object Oriented Design


1
Object Oriented Design
  • Peter McClone

2
Goals
  • To be able to
  • Identify how an object contributes to a problem
    solution
  • Identify what classes are needed to solve a
    problem
  • Describe how objects work together to solve a
    problem
  • Group objects with similar attributes into one
    class
  • Distinguish between instances and classes
  • Draw the object diagram for a description given

3
Location Mootown Airport
  • Mootown is a small city in rural Wisconsin. The
    Mootown City Council has started discussions
    about building an airport. 
  • The Mootown City Council contracted with C.
    Thomas Wu Consulting Inc. to design a computer
    model of the airport. The City Council has a
    general description of the initial airport design
    from which we will base our design. 

4
General Design
  • The airport is small. It has one runway and two
    ticket counters.
  • Each ticket counter controls two gates where
    passengers can board their flights.
  • Each gate can only support one airplane at a
    time. 
  • Passengers enter the airport, go to a ticket
    counter to check-in, surrendering a ticket to a
    ticket counter employee and receiving back a
    boarding pass. After receiving a boarding pass,
    they go to a gate where they wait. 
  • When the airplane is ready, the passengers board
    their flight. When all of the passengers have
    boarded, the airplane taxis away from the gate to
    the runway, where it will take off to travel to
    Corntown airport in Iowa, Wheattown airport in
    Kansas, and/or Beettown airport in Minnesota.
  • Ticket Counter 1 serves Gurnsey Express and
    Ticket Counter 2 serves Holstein Airways. 
    Ticket Counter 1 has two Gates, Gate A and Gate
    B. 
  • Ticket Counter 2 controls Gate C and Gate D. 
    The two Ticket Counters also have various
    employees working at them.  Jennifer and Jim both
    work at Ticket Counter 1 Tom and Theresa work
    at Ticket Counter 2.

5
Pulling out the nouns
  • The airport is small. It has one runway and two
    ticket counters.
  • Each ticket counter controls two gates where
    passengers can board their flights.
  • Each gate can only support one airplane at a
    time. 
  • Passengers enter the airport, go to a ticket
    counter to check-in, surrendering a ticket to a
    ticket counter employee and receiving back a
    boarding pass. After receiving a boarding pass,
    they go to a gate where they wait. 
  • When the airplane is ready, the passengers board
    their flight. When all of the passengers have
    boarded, the airplane taxis away from the gate to
    the runway, where it will take off to travel to
    Corntown airport in Iowa, Wheattown airport in
    Kansas, and/or Beettown airport in Minnesota.
  • Ticket Counter 1 serves Gurnsey Express and
    Ticket Counter 2 serves Holstein Airways. 
    Ticket Counter 1 has two Gates, Gate A and Gate
    B. 
  • Ticket Counter 2 controls Gate C and Gate D. 
    The two Ticket Counters also have various
    employees working at them.  Jennifer and Jim both
    work at Ticket Counter 1 Tom and Theresa work
    at Ticket Counter 2.

6
Creating the model
  • Our Nouns
  • Runway, Ticket Counter, Gate, Passenger, Flight,
    Airplane, Employee, Ticket, Boarding Pass
  • Each noun in this list will be a class in our
    model of the Mootown Airport. 
  • Each of these classes will have one or more
    instances (also called objects) in our model.
  • Example
  • Class Employee
  • Instance Tom, Theresa, Jim, Jennifer
  • Class Ticket Counter
  • Ticket Counter 1, Ticket Counter 2

7
Leaving things out
  • What are we missing?
  • Plants, carpet, air etc.
  • Only include what is necessary for our model.
  • Careful consideration must be given to what is
    needed to obtain a solution to the given problem
    AND what may be needed to solve future, similar
    problems.
  • There are situations where a lot of detail is
    needed

8
Data Members
  • What sort of information is it important to
    associate with each class?
  • Lets go through each class

9
Runway
  • length - number of meters
  • direction - the compass heading the runway faces
    (north, south, etc.)

10
Ticket Couner
  • airline - name of the airline the ticket counter
    serves
  • employees - number of employees working at the
    counter
  • gates - number of gates the ticket counter
    controls

11
Gate
  • plane - the flight number of the plane currently
    outside, if there is one
  • name the name of the gate

12
Passenger
  • name - the passenger's first and last name
  • ticket a ticket for his/her flight
  • boardingPass - a boarding pass for his/her flight

13
Flight
  • airline - name of the airline the flight belongs
    to
  • number - flight number that identifies what
    flight it is
  • destination - the flight's next stop
  • departure - time the flight is scheduled to leave
  • arrival - time the flight is scheduled to land at
    its destination

14
Airplane
  • type - what kind of plane it is (Example 747)
  • airline  - what airline it belongs to
  • capacity - the number of people that the plane
    can hold

15
Employee
  • name - first and last name
  • IDNumber - identification number

16
Ticket
  • planeNumber - what plane the ticket is for
  • rowNumber - what on the plane the ticket is for
  • seatNumber - what seat the ticket is for

17
Boarding Pass
  • name - name of the passenger who holds it
  • gate - gate the pass is for

18
General Design (2nd)
  • The airport is small. It has one runway and two
    ticket counters.
  • Each ticket counter controls two gates where
    passengers can board their flights.
  • Each gate can only support one airplane at a
    time. 
  • Passengers enter the airport, go to a ticket
    counter to check-in, surrendering a ticket to a
    ticket counter employee and receiving back a
    boarding pass. After receiving a boarding pass,
    they go to a gate where they wait. 
  • When the airplane is ready, the passengers board
    their flight. When all of the passengers have
    boarded, the airplane taxis away from the gate to
    the runway, where it will take off to travel to
    Corntown airport in Iowa, Wheattown airport in
    Kansas, and/or Beettown airport in Minnesota.
  • Ticket Counter 1 serves Gurnsey Express and
    Ticket Counter 2 serves Holstein Airways. 
    Ticket Counter 1 has two Gates, Gate A and Gate
    B. 
  • Ticket Counter 2 controls Gate C and Gate D. 
    The two Ticket Counters also have various
    employees working at them.  Jennifer and Jim both
    work at Ticket Counter 1 Tom and Theresa work
    at Ticket Counter 2.

19
General Design (2nd)
  • The airport is small. It has one runway and two
    ticket counters.
  • Each ticket counter controls two gates where
    passengers can board their flights.
  • Each gate can only support one airplane at a
    time. 
  • Passengers enter the airport, go to a ticket
    counter to check-in, surrendering a ticket to a
    ticket counter employee and receiving back a
    boarding pass. After receiving a boarding pass,
    they go to a gate where they wait. 
  • When the airplane is ready, the passengers board
    their flight. When all of the passengers have
    boarded, the airplane taxis away from the gate to
    the runway, where it will take off to travel to
    Corntown airport in Iowa, Wheattown airport in
    Kansas, and/or Beettown airport in Minnesota.
  • Ticket Counter 1 serves Gurnsey Express and
    Ticket Counter 2 serves Holstein Airways. 
    Ticket Counter 1 has two Gates, Gate A and Gate
    B. 
  • Ticket Counter 2 controls Gate C and Gate D. 
    The two Ticket Counters also have various
    employees working at them.  Jennifer and Jim both
    work at Ticket Counter 1 Tom and Theresa work
    at Ticket Counter 2.

20
What isnt mentioned?
  • Land - Airplane makes contact with the runway,
    slows down, and eventually stops
  • Others?
  • What action belongs to what class?

21
Runway
  • Data members
  • Length number of meters
  • direction - the compass heading the runway faces
    (north, south, etc.)
  • Methods
  • None

22
Ticket Couner
  • Data members
  • airline - name of the airline the ticket counter
    serves
  • employees - number of employees working at the
    counter
  • gates - number of gates the ticket counter
    controls
  • Methods
  • None

23
Gate
  • Data Members
  • plane - the flight number of the plane currently
    outside, if there is one
  • name the name of the gate
  • Methods
  • None

24
Passenger
  • Data Members
  • name - the passenger's first and last name
  • ticket a ticket for his/her flight
  • boardingPass - a boarding pass for his/her flight
  • Methods
  • enterAirport - proceed through the door to the
    airport facility
  • wait - sit, stand, or pace until the correct
    boarding call is announced
  • surrenderTicket - give a ticket to an airport
    employee
  • goToGate - proceed to the gate indicated on a
    boarding pass
  • boardPlane - get on the plane

25
Flight
  • Data Members
  • airline - name of the airline the flight belongs
    to
  • number - flight number that identifies what
    flight it is
  • destination - the flight's next stop
  • departure - time the flight is scheduled to leave
  • arrival - time the flight is scheduled to land at
    its destination
  • Methods
  • None

26
Airplane
  • Data Members
  • type - what kind of plane it is (Example 747)
  • airline  - what airline it belongs to
  • capacity - the number of people that the plane
    can hold
  • Methods
  • taxi - plane moves from the gate to the start of
    the runway
  • takeOff - plane accelerates down the runway and
    lifts off the ground
  • land - plane makes contact with the runway and
    decelerates until it reaches the end of the runway

27
Employee
  • Data Members
  • name - first and last name
  • IDNumber - identification number
  • Methods
  • receiveTicket - obtain a ticket from a passenger
    and give a boarding pass

28
Ticket
  • Data Members
  • planeNumber - what plane the ticket is for
  • rowNumber - what on the plane the ticket is for
  • seatNumber - what seat the ticket is for
  • Methods
  • None

29
Boarding Pass
  • Data Members
  • name - name of the passenger who holds it
  • gate - gate the pass is for
  • Methods
  • None

30
Diagrams
31
Diagrams (cont.)
32
Diagrams (cont.)
33
Diagrams (cont.)
34
Summary
  • Understanding the problem and designing a
    solution can save you much time during the
    implementation
  • Modular and language independent design are part
    of the principles of OOP
  • Questions?
Write a Comment
User Comments (0)
About PowerShow.com