Oriented Design and Abstract Data Type

Slides:



Advertisements
Similar presentations
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Advertisements

Software Engineering and Design Principles Chapter 1.
Classes. Object-Oriented Design Method for designing computer programs Consider “objects” interacting in the program –Example: a zoo, a gradebook.
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
Information Hiding and Encapsulation
Lecture 9 Concepts of Programming Languages
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Ranga Rodrigo. Class is central to object oriented programming.
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
An Object-Oriented Approach to Programming Logic and Design
Component Technology. Challenges Facing the Software Industry Today’s applications are large & complex – time consuming to develop, difficult and costly.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
CSE 425: Data Types I Data and Data Types Data may be more abstract than their representation –E.g., integer (unbounded) vs. 64-bit int (bounded) A language.
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
P Chapter 2 introduces Object Oriented Programming. p OOP is a relatively new approach to programming which supports the creation of new data types and.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
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.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Chapter 10, Slide 1 ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:  process abstraction  data abstraction Both provide:  information.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Object-Oriented Programming Chapter Chapter
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
ADT data abstraction. Abstraction  representation of concepts by their relevant features only  programming has two major categories of abstraction process.
1 Welcome  CSCI 3333 Data Structures Section 03 Thurs., 7:00–9:50 p.m.  Instructor: Charles Moen Web page –
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Defining Classes I Part B. Information hiding & encapsulation separate how to use the class from the implementation details separate how to use the class.
CPSC 252 ADTs and C++ Classes Page 1 Abstract data types (ADTs) An abstract data type is a user-defined data type that has: private data hidden inside.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
CSCE , SPRING 2016 INSTRUCTOR: DR. NANCY M. AMATO 1.
Object Based Programming Chapter 8. 2 Contrast ____________________ Languages –Action oriented –Concentrate on writing ________________ –Data supports.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
CH 1-4 : INTRODUCTION ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND.
Advanced Data Structures Lecture 1
Principles of Programming & Software Engineering
More Sophisticated Behavior
Types for Programs and Proofs
The Development Process of Web Applications
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Classes and OOP.
Object-Oriented Programming
Ch. 2 Object-Oriented Programming
ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:
11.1 The Concept of Abstraction
About the Presentations
Lecture 2 of Computer Science II
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Object-Oriented Programming
Object Oriented Analysis and Design
Lecture 9 Concepts of Programming Languages
Object Based Programming
CS148 Introduction to Programming II
Object-Oriented Programming
DEV-08: Exploring Object-oriented Programming
Defining Classes and Methods
Introduction to Computer Programming
Introduction to Data Structure
Defining Classes and Methods
Chapter 2. Problem Solving and Software Engineering
Chapter 9 Introduction To Classes
Information Hiding and Encapsulation Section 4.2
Data Structures and ADTs
Classes.
Abstract Data Types Abstraction is to distill a system to its most fundamental parts. Applying the abstraction paradigm to the design of data structures.
11.1 The Concept of Abstraction
Lecture 9 Concepts of Programming Languages
Abstract Types Defined as Classes of Variables
Presentation transcript:

Oriented Design and Abstract Data Type CSCI 3333 Data Structures Oriented Design and Abstract Data Type

Acknowledgement Dr. Bun Yue Mr. Charles Moen

OOD Goals Robustness Reusability Adaptability Software Engineering (Goodrich, 58)‏ OOD Goals Robustness “Capable of handling unexpected inputs” Correct and safe Reusability Code should be reusable in other applications Class libraries like the Java Collections Framework General purpose code helps rapid development Adaptability Able to evolve over time in response to changes Loosely connected classes Easy to maintain

OOD Principles Abstraction Encapsulation Information hiding Software Engineering (Goodrich, 59)‏ OOD Principles Abstraction Distill a complicated system into simple parts (objects) that can be easily described and understood e.g., a road map is an abstraction Encapsulation Data and the operations that can be performed with that data are kept in the same place – the objects Simplify a program by dividing it into distinct components or objects Information hiding Internal details of a class are not revealed We don’t need to know how it’s done We just need to know the “interface”

Data Type Defined by: Example: int data type A range of data values Software Engineering Data Type Defined by: A range of data values The operations that can be performed on the data Example: int data type Type of data: integer values from -231 to 231 - 1 Operations supported: arithmetic (+,–,*,/,%), assignment (=), equality (==, !=), relational (<,>,<=,>=), increment (++), decrement (––), etc.

Strongly-Typed Languages Strongly typed languages: more restrictive values, operations and type conversions. More compilation time checking More reliable More restrictive.

Data Value Examples: Ada’s subtypes: Perl: $i = 1; subtype Day is Integer range 1 . . 31; subtype Upper_Chars is Character range 'A' .. 'Z'; Perl: $i = 1; $i = “This is cool”;

Type Checking Strong type checking increases programming reliability. Example: consider the generic code for two int: if (p >= q) s = p; else s = q; t = p + q – s;

Problem with the Example Code Is it equivalent to t = min(p,q)? Poorly written. May have different results depending on languages.

Operation Examples Java’s and C++ classes: only methods defined in the class and super class or base class are available.

Type Conversion Examples int i = 10; unsigned int j = 20; i = j; // implicit type conversion Implicit type conversion is a frequent source of program errors.

Abstract Data Type A specification for a data structure that tells us The type of data stored The operations that are supported Specifies what the operations do, but not how they do it (Goodrich, p. 60)

Why ADT? Unexpected data values should be handled. Unexpected operations create problems.

Interface Specifies operations that are supported Software Engineering Interface Specifies operations that are supported Specifies what the operations do, but not how they do it We depend on the interface to tell us how to use a programming feature Example: API = Application Programming Interface An ADT specifies an interface

Classes Software Engineering In Java or C++, we implement an ADT by writing a class A class specifies allowed operations (methods) A class contains Data Called “instance variables” Usually private Operations Operations that can be performed on the data Called “methods” Usually public The public operations are considered the “interface”

Software Engineering Information Hiding Accomplished by keeping the instance variables private The user of an object in your program can change its data, but cannot change it directly Data members are manipulated only by accessor methods “set” methods “get” methods Advantage We can control how the data is changed We can control how the data is stored Other parts of the program don’t need to know how it’s done, they just need to know the “interface”

Questions and Comments?