1 / 8

Object Oriented Design

Object Oriented Design. Object-Oriented Design. Method for designing computer programs Useful for thinking about large problems Consider “objects” interacting in the program Example: a zoo, a gradebook. Objects. Objects have state – what they know

domani
Télécharger la présentation

Object Oriented Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object Oriented Design

  2. Object-Oriented Design • Method for designing computer programs • Useful for thinking about large problems • Consider “objects” interacting in the program • Example: a zoo, a gradebook

  3. Objects • Objects have state – what they know • Objects have behaviors – what they can do • Example: Car

  4. Classes • A programming construct to define the state and behaviors of a particular type of object • A class is the blueprint • An object is an instance of the class

  5. CRC Cards • Class, Responsibilities, Collaborators (CRC) • The CRC card method is a mechanism for discovering the classes that will be part of a program.

  6. Example: A Card Gamehttp://max.cs.kzoo.edu/AP/OOD/OODPresentation/CRC4.html • Classes: Card, Deck, Hand, Dealer • Class: Card • Responsibilities: • Display self • Report suit • Report rank • Collaborators • None

  7. Example: A Card Gamehttp://max.cs.kzoo.edu/AP/OOD/OODPresentation/CRC4.html • Classes: Card, Deck, Hand, Dealer • Class: Deck • Responsibilities: • Shuffle • Deal • Report size • Collaborators • Contains cards

  8. Exercises • Form groups of 2 or 3 and use the CRC method to design a coffee machine. Start with a coffee machine that can dispense black coffee or coffee with cream. Each costs 1.00.

More Related