UT Dallas CS 4337 - #Sebesta ch11 abstraction & encapsulation - shorter to use (27 pages)

Previewing pages 1, 2, 3, 25, 26, 27 of 27 page document View the full content.
View Full Document

#Sebesta ch11 abstraction & encapsulation - shorter to use



Previewing pages 1, 2, 3, 25, 26, 27 of actual document.

View the full content.
View Full Document
View Full Document

#Sebesta ch11 abstraction & encapsulation - shorter to use

31 views


Pages:
27
School:
University of Texas at Dallas
Course:
Cs 4337 - Organization of Programming Languages

Unformatted text preview:

Chapter 11 Abstract Data Types and Encapsulation Concepts Chapter 11 Topics The Concept of Abstraction Introduction to Data Abstraction Design Issues for Abstract Data Types Language Examples Parameterized Abstract Data Types Encapsulation Constructs Naming Encapsulations Copyright 2012 Addison Wesley All rights reserved 1 2 The Concept of Abstraction An abstraction is a view or representation of an entity that includes only the most significant attributes The concept of abstraction is fundamental in programming and computer science Nearly all programming languages support process abstraction with subprograms Nearly all programming languages designed since 1980 support data abstraction smalltalk common lisp C etc Copyright 2012 Addison Wesley All rights reserved 1 3 Introduction to Data Abstraction An abstract data type is a user defined data type that satisfies the following two conditions 1 The representation of objects of the type is hidden from the program units that use these objects so the only operations possible are those provided in the type s definition 2 The declarations of the type and the protocols of the operations on objects of the type are contained in a single syntactic unit Other program units are allowed to create variables of the defined type e g an object contains data and its method Copyright 2012 Addison Wesley All rights reserved 1 4 Advantages of Data Abstraction Advantages the first condition hidden Reliability security by hiding the data representations user code cannot directly access objects of the type or depend on the representation allowing the representation to be changed without affecting user code Reduces the range of code and variables of which the programmer must be aware Name conflicts are less likely Advantages of the second condition Unit Provides a method of program organization Aids modifiability everything associated with a data structure is together Separate compilation Copyright 2012 Addison Wesley All rights reserved 1 5 Language Requirements for ADTs A syntactic unit in which to encapsulate the type definition A method of making 1 type names and 2 subprogram headers visible to clients while hiding actual definitions Some primitive operations must be built into the language processor Copyright 2012 Addison Wesley All rights reserved 1 6 Design Issues What is the form of the container for the interface to the type Can abstract types be parameterized What access controls are provided Is the specification of the type physically separate from its implementation Copyright 2012 Addison Wesley All rights reserved 1 7 Language Examples C Based on C struct type and Simula 67 classes The class is the encapsulation device A class is a type All of the class instances of a class share a single copy of the member functions Each instance of a class has its own copy of the class data members Instances can be static stack dynamic or heap dynamic Copyright 2012 Addison Wesley All rights reserved 1 8 Language Examples C



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view #Sebesta ch11 abstraction & encapsulation - shorter to use and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view #Sebesta ch11 abstraction & encapsulation - shorter to use and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?