1 / 12

Data Abstraction

Data Abstraction. Object-Oriented Analysis and Design The analysis and design methodology used on most large systems. Gather Requirements They provide: Perception of what the client expcets Description of what a solution must do They do not provide: Design details Implementation details

Télécharger la présentation

Data Abstraction

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. Data Abstraction

  2. Object-Oriented Analysis and Design • The analysis and design methodology used on most large systems

  3. Gather Requirements • They provide: • Perception of what the client expcets • Description of what a solution must do • They do not provide: • Design details • Implementation details • Problem is expressed in terms of relevant objects and how they interact with one another Oblect Oriented Analysis

  4. Description of a high-level solution to the problem discovered during the analysis phase • Solution is expressed in terms of software objects and how they interact Object-Oriented Design

  5. A collection of attributes • Data members: what do I know • A collection of behaviors • Methods (or functions): what can I do • Each object (specified as a class) • Has a single, well-defined task • If a class/object has too many responsibilities, it should be split into multiple classes What are Software Objects?

  6. Encapsulation: Objects combine data and operations • Inheritance: Classes can inherit properties from another class • Polymorphism: Objects determine appropriate operations at run-time • CPSC 122: Encapsulation only OO Terms/Techniques

  7. Operation Contracts • Documents how a method can be used and what it’s limitations are • Does not specify how operations are completed • Summarized in • Task: what the method does • Precondition: statement of the conditions that must exist at the beginning of the function • Postcondition: statement of the conditions at the end of the function

  8. /* Task: Sorts and array Precondition: anArray is an array of num integers; num > 0. Postcondition: The integers in anArray are sorted */ Example

  9. Abstraction separates the purpose of a module from its implementation • If you used sqrt within cmath, you made use of abstraction • Abstraction presents a public face of the object to the user. The private implementation is left to the developer Abstraction

  10. Abstraction specifies a public view • It also implies a private view • In a nutshell • Your user doesn’t need to know how something is implemented to use it. • OO programming languages provide mechanisms to make implementation and data inaccessible to users • The Walls in the book’s title • User program on one side • Implementation on the other • Communication is through standard/principled channels: a slit in the wall • Prototype/declaration/header Data/Information Hiding

  11. Abstract Data Type • Basically an object without inheritance and polymorphism • Collection of data and operations on the data. • Consider ADT Bag • Software that collects things • Software that operates on the collection ADTs: Before Objects

  12. Do • How many items in bag • Is bag empty • Add item to bag • Remove item from bag • Remove everything from bag • How many times does a certain kind of item appear in the bag • Does the bag contain a specific object • Display all items in bag ADT Bag

More Related