COMPSCI 105 S2 2014 Principles of Computer Science 12 Abstract Data Type.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Lecture 12 – ADTs and Stacks.  Modularity  Divide the program into smaller parts  Advantages  Keeps the complexity managable  Isolates errors (parts.
Abstract Data Types (ADTs) An ADT consists of: –a set of values, and –a set of operations on those values. Example: rational numbers –some values: 15/7,
CMPT 225 Abstract Data Types.
Chapter 3 Data Abstraction: The Walls. © 2005 Pearson Addison-Wesley. All rights reserved3-2 Abstract Data Types Modularity –Keeps the complexity of a.
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chapter 1 Principles of Programming and Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
© 2006 Pearson Addison-Wesley. All rights reserved 4-1 Chapter 4 Data Abstraction: The Walls.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Language Evaluation Criteria
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
Introduction to Object-oriented programming and software development Lecture 1.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
CSCI-383 Object-Oriented Programming & Design Lecture 4.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
CSE 303 – Software Design and Architecture
Data Abstraction CS 201j: Engineering Software University of Virginia Computer Science Nathanael Paul
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Modular Programming. Modular Programming (1/6) Modular programming  Goes hand-in-hand with stepwise refinement and incremental development  Makes the.
Computer Science Department Data Structures and Algorithms Lecture 1.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Standard Template Library (STL)
1 CS 350 Data Structures Chaminade University of Honolulu.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Design.ppt1 Top-down designs: 1. Define the Problem IPO 2. Identify tasks, Modularize 3. Use structure chart 4. Pseudocode for Mainline 5. Construct pseudocode.
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
Chapter 4 Data Abstraction: The Walls. © 2004 Pearson Addison-Wesley. All rights reserved4-2 Abstract Data Types Modularity –Keeps the complexity of a.
Lecture 11 Data Structures, Algorithms & Complexity Introduction Dr Kevin Casey BSc, MSc, PhD GRIFFITH COLLEGE DUBLIN.
Frameworks CompSci 230 S Software Construction.
Data Abstaraction Chapter 10.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Abstraction ADTs, Information Hiding and Encapsulation.
Views of Data Data – nouns of programming world the objects that are manipulated information that is processed Humans like to group information Classes,
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Dr D. Greer, Queens University Belfast )Chapter Six 1 Software Engineering Chapter Six Software Design Quality Learning Outcomes.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
1 CS 311 Data Structures. 2 Instructor Name : Vana Doufexi Office : 2-229, Ford Building Office hours: By appointment.
COMPSCI 105 SS 2015 Principles of Computer Science 09 ADT & Stacks.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
(1) ICS 313: Programming Language Theory Chapter 11: Abstract Data Types (Data Abstraction)
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
Abstract Data Type EnhanceEdu.
Topic 2 Collections. 2-2 Objectives Define the concepts and terminology related to collections Discuss the abstract design of collections.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
CSCI 383 Object-Oriented Programming & Design Lecture 4 Martin van Bommel.
Chapter 2 Principles of Programming and Software Engineering.
CSC 205 Java Programming II Abstract Data Type. Abstraction The meaning of abstraction Abstraction arises from a recognition of similarities between certain.
Prof. I. J. Chung Data Structure #1 Professor I. J. Chung.
Advanced Data Structures Lecture 1
Introduction toData structures and Algorithms
Principles of Programming & Software Engineering
CompSci 280 S Introduction to Software Development
Data Abstraction: The Walls
CSCI 104 Abstract Data Types
Data Abstraction: The Walls
Principles of Programming and Software Engineering
Lecture 2 of Computer Science II
structures and their relationships." - Linus Torvalds
Stack ADT & Modularity 2 implementations of the Stack abstract data type: Array Linked List Program design: modularity, abstraction and information hiding.
Lecture 11 Abstract Data Type
Chapter 2. Problem Solving and Software Engineering
Information Hidding Dr. Veton Kepuska.
Data Abstraction: The Walls
structures and their relationships." - Linus Torvalds
Presentation transcript:

COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type

Agenda & Reading  Agenda  Some Software design Principles  Abstract Data Type (ADT)  What is an ADT?  What is a Data Structure?  Examples on ADT:  Integer, Set, and List  Reference:  Data Abstraction & Problem Solving with Java  Chapter 4 – Data Abstraction: The Walls  Textbook: Problem Solving with Algorithms and Data Structures  Chapter 3: Basic Data Structures Lecture 12COMPSCI1052

12.1 Software Engineering Design Principles Modularity  Modularity (divide a program into manageable parts)  Keeps the complexity of a large program manageable  Isolates errors  Eliminates redundancies  Encourages reuse (write libraries)  A modular program is  Easier to write / Easier to read / Easier to modify Lecture 12COMPSCI1053

12.1 Software Engineering Design Principles Information hiding  Hides certain implementation details within a module  Makes these details inaccessible from outside the module  Isolate the implementation details of a module from other modules Isolated tasks: the implementation of task T does not affect task Q Lecture 12COMPSCI1054

12.1 Software Engineering Design Principles Isolation of modules  The isolation of modules is not total (otherwise module would be useless)  Methods’ specifications, or contracts, govern how they interact with each other  Similar to having a wall hiding details, but being able to access through “hole in the wall” Lecture 12COMPSCI1055

12.1 Software Engineering Design Principles Abstraction  Abstraction  The principle of ignoring those aspects of a subject that are not relevant to the current purpose in order to concentrate solely on those aspects which are relevant.  How do we achieve:  modularity,  information hiding,  isolation of modules  i.e. The abstraction of what from the how Lecture 12COMPSCI1056

12.1 Software Engineering Design Principles Abstraction  Separates the purpose and use of a module from its implementation  A module’s specifications should  Detail how the module behaves  Identify details that can be hidden within the module   Advantages  Hides details (easier to use)  Allows us to think about the general framework (overall solution) & postpone details for later  Can easily replace implementations by better ones Lecture 12COMPSCI1057

12.1 Software Engineering Design Principles Typical Operations on Data  What do we need in order to achieve the above Software Engineering design principles?  Typical operations on data  Add data to the database  Remove data from the database  Find data (or determine that it is not in the data base)  Ask questions about the data in a data collection  (e.g. how many CS105 students do stage 1 Math courses?)  Q: Do we need to know data structures used?  A: No, better make implementation independent of it! Lecture 12COMPSCI1058

12.1 Software Engineering Design Principles Data abstraction  Asks you to think what you can do to a collection of data independently of how you do it  Allows you to develop each data structure in relative isolation from the rest of the solution  A natural extension of procedural abstraction CAR: Start() Stop() TurnLeft() TurnRight() CAR: Start(){ Select first gear Release parking brake Bring clutch up to the friction point Press gas pedal Release clutch } NOTE: Implementation can be different for different cars, e.g. automatic transmission Lecture 12COMPSCI1059

12.2 ADT Abstract Data Types  An ADT is composed of  A collection of data  A set of operations on that data  Specifications of an ADT indicate  What the ADT operations do, not how to implement them  Implementation of an ADT  Includes choosing a particular data structure Lecture 12COMPSCI10510

12.2 ADT Data structure Vs ADT  An ADT is not the same with a Data Structure  Data structure  A construct that is defined within a programming language to store a collection of data  Example: arrays  ADT provides “data abstraction”  Results in a wall of ADT operations between data structures and the program that accesses the data within these data structures  Results in the data structure being hidden  Can access data using ADT operations  Can change data structure without changing functionality of methods accessing it Lecture 12COMPSCI10511

12.2 ADT Abstract Data Types  A wall of ADT operations isolates a data structure from the program that uses it Lecture 12COMPSCI10512

12.2 ADT Disadvantages & Advantages  Disadvantages of Using ADTs  initially there is more to consider:  design issues,  code to write and maintain,  overhead of calling a method to access ADT information,  greater initial time investment.  Advantages of Using ADTs:  A client (the application using the ADT) doesn't need to know about the implementation,  Maintenance of the application is easier,  The programmer can focus on problem solving and not worry about the implementation. Lecture 12COMPSCI10513

12.3 ADT Examples Designing an ADT  An abstract data type (ADT) is a specification of a set of data and the set of operations that can be performed on the data. Such a data type is abstract in the sense that it is independent of various concrete implementations.  Questions to ask when designing an ADT  What data does a problem require?  What operations does a problem require?  Examples:  Integers  Sets  Lists  Stacks, Queues, Trees … Lecture 12COMPSCI10514

12.3 ADT Examples Integers  Data  Containing the positive and negative whole numbers and 0  Operations which manipulate the data:  Such as addition, subtraction, multiplication, equality comparison, and order comparison  Methods for data conversion, output etc. Lecture 12COMPSCI10515

12.3 ADT Examples Sets  Data:  An unordered collection of unique elements.  Operations which manipulate the data:  add an element to a set,  remove an element from the set,  get the union, intersection, complement of two Set objects Lecture 12COMPSCI10516

12.3 ADT Examples Linear Structures  Linear structures are data collections whose items are ordered depending on how they are added or removed from the structure.  Once an item is added, it stays in that position relative to the other elements that came before and came after it.  Linear structures can be thought of as having two ends, top and bottom, (or front and end or front and back)  What distinguishes one linear structure from another is the way in which items are added and removed, in particular the location where these additions and removals occur, e.g., add only to one end, add to both, etc. Lecture 12COMPSCI10517

Summary  Solving a problem becomes easier by considering only relevant data and operations and ignoring the implementations (“abstraction”)  Abstract Data Types (ADTs) enable you to think what you can do with the data independently of how you do it  An abstract data type can be accessed by a limited number of public methods – often they are defined by using an interface  The implementation of the ADT (data structures and algorithms) can be changed without influencing the behaviour of the ADT. Abstract Data Type Abstract Data Structure Operations Interface Lecture 12COMPSCI10518