02-Chapter4 - Ch Chapter 4: Modularity and Data Abstraction...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 4: Modularity and Data Abstraction This material is based on contents of the book: “Data structures, Algorithms, and Software Principles in C”, from T.A. Standish. Parts also under permission from David McCaughan, University of Guelph, Canada. USF – COP4530 – Data Structures Summer 2009 1of45 o a d cCauga,U es t yoGuep,Caada
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Data Abstraction Recall definition Abstraction: reasoning about the essential properties of an object, ignoring unimportant details Consider going to a movie – what do you really need to know in order to “solve” this roblem? problem? – at what level of abstraction are these details? USF – COP4530 – Data Structures Summer 2009 2of45
Background image of page 2
Data Abstraction Steps 1 .e x a m ine complex problem distinguish between high-level information ull out the high level information 2. pull out the high level information 3. solve less complex problem Essential Unimportant USF – COP4530 – Data Structures Summer 2009 3of45
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Abstraction Example Four kitchen devices – cook must understand interface of a device before applying it To what extent has this interface been abstracted? – Abstract devices: interface understood in terms of input/output; cook can ignore internal details of the device – Non-abstract devices: require understanding of all details ote: abstract devices can be used even if the method used USF – COP4530 – Data Structures Summer 2009 Note: abstract devices can be used even if the method used to accomplish their task is a mystery 4of45
Background image of page 4
Abstraction Example Apple Corer – “A round metal devices that you place on top of an apple and push downward, splitting the apple into its core in slices” – No abstraction - must understand process to make it work icrowave Microwave – Completely abstract interface – input: food to be heated & setting --- output: hot food Barbeque – Would be convenient to have an abstract interface, however the reality is that the cook must understand process in detail Sink/Tap – completely abstract USF – COP4530 – Data Structures Summer 2009 – input: turn tap --- output: water 5of45
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Abstracting Data Recall: – specification (i.e. “what”) and implementation (i.e. “how”) For subroutines in code: – specification: method header + pre/post conditions – implementation: local variables + body of subroutine Extend this to data types: – specification: definition of data type + operations defined on that type – Implementation: in C - a header file containing type and function declarations together with a .c file in which they are implemented USF – COP4530 – Data Structures Summer 2009 6of45
Background image of page 6
Abstracting Data General Idea: – Data types/algorithms organized into modules – Module contains data structure + operations – Module exports (makes public) • A type (in an OO language this would be the class itself) • Methods that operate on instances of this type – User of the module can declare variables of this type, and manipulate them by calling the ADT’s operations USF – COP4530 – Data Structures Summer 2009 – NOTE: no need to know implementation details 7of45
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/28/2009 for the course COP COP 4350 taught by Professor Jimeno during the Summer '09 term at University of South Florida - Tampa.

Page1 / 45

02-Chapter4 - Ch Chapter 4: Modularity and Data Abstraction...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online