Presentation is loading. Please wait.

Presentation is loading. Please wait.

Abstraction A tool (concept) to manage complexity

Similar presentations


Presentation on theme: "Abstraction A tool (concept) to manage complexity"— Presentation transcript:

1 Abstraction A tool (concept) to manage complexity
Hide irrelevant details; focus on the features needed Examples Integer addition File deletion using icons The brakes on a car Television remotes Primitive date types are already abstracted from bits 0/1 7/4/2018 IT 179

2 Some here are primitive data types
Characterize data into different kinds for convenience Some here are primitive data types bit byte integer ascii character array string real record objects + operations 7/4/2018 IT 179

3 Data Type (how to view it)
Specification View of a data type Data values Operations defined on those values Abstract Data Type (ADT) –use of abstraction! Implementation View of a data type Language-specific representation for the values Implementation of the operations  Implementation of an ADT 7/4/2018 IT 179

4 Abstract model of Priority Queues
Abstract Data Type (ADT) Abstract model of Priority Queues (Specification View) insert one item Priority Queue Get the one with the highest priority the minimum one (or maximum) a black box 7/4/2018 IT 179

5 Abstract model of Priority Queues (Implementation View)
Abstract Data Type (ADT) Abstract model of Priority Queues (Implementation View) insert one item Binary Search Tree or Binary Heap? Get the one with the highest priority the minimum one (or maximum) 7/4/2018 IT 179

6 Collection is an ADT Typical Operations Add an element
Remove an element Replace an element Retrieve an element Determine if a collection contains an element Get the collection’s size Determine if a collection is empty Traverse a collection Determine if two collections are equal Clone a collection Serialize a collection 7/4/2018 IT 179

7 List is a Collection with extra two requirements
Homogenous Logical Order Student 1, Student 2, Student 3, Student 4 7/4/2018 IT 179

8 At the implementation level: Tow kinds of Lists
student 1 student 2 student 3 student 4 Linked List student 4 student 1 student 3 student 2 Array 7/4/2018 IT 179

9 Array Characteristics
student 1 student 2 student 3 student 4 The elements of an array are in adjacent memory locations An array is a random (direct) access data structure. A A[0] A[1] A[2] A[3] 7/4/2018 IT 179

10 The Java Collections Framework (JCF)
Queue List {interface} {interface} {interface} RandomAccess AbstractList {marker interface} {abstract} The Java Collections Framework (JCF) UML Class Diagram ArrayList Vector AbstractSequentialList {abstract} Java Provides a List interface for several implementations Stack LinkedList 7/4/2018 IT 179

11 Some typical operations on Lists
What can be done? What can be easily done? Some typical operations on Lists Array Linked List student 1 student 2 student 3 student 4 student 4 student 1 student 3 Random access Add/remove from the head Add/remove from the tail Add/remove from the middle Resize student 2 7/4/2018 IT 179


Download ppt "Abstraction A tool (concept) to manage complexity"

Similar presentations


Ads by Google