ADT data abstraction. Abstraction  representation of concepts by their relevant features only  programming has two major categories of abstraction process.

Slides:



Advertisements
Similar presentations
Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Advertisements

Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
CPS 506 Comparative Programming Languages Abstract Data Type and Encapsulation.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Introduction to Fortran Fortran Evolution Drawbacks of FORTRAN 77 Fortran 90 New features Advantages of Additions.
1) More on parameter passing: a) Parameter association b) Default parameters c) Procedures as parameters 2) Modules: Ada packages, C modules, C header.
Abstract data types & object-oriented paradigm. Abstraction Abstraction: a view of an entity that includes only the attributes of significance in a particular.
Lecture 9 Concepts of Programming Languages
Abstract Data Types and Encapsulation Concepts
Generic Subroutines and Exceptions CS351 – Programming Paradigms.
OOP Languages: Java vs C++
Chapter 11 Abstract Data Types and Encapsulation Concepts.
1 Chapter 11 Abstract Data Types and Encapsulation Constructs.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Ceg860 (Prasad)L6MR1 Modularity Extendibility Reusability.
CS 403 – Programming Languages Class 25 November 28, 2000.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Programming Languages and Paradigms Object-Oriented Programming.
Checking Equality of Reference Variables. Arrays and objects are both “reference” types n They are allocated a chunk of memory in the address space n.
Introduction to Object Oriented Programming CMSC 331.
Programming Languages by Ravi Sethi Chapter 6: Groupings of Data and Operations.
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
Chapter 11 Abstract Data Types and Encapsulation Concepts.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Chapter 10, Slide 1 ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:  process abstraction  data abstraction Both provide:  information.
Views of Data Data – nouns of programming world the objects that are manipulated information that is processed Humans like to group information Classes,
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Object-Oriented Programming Chapter Chapter
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
ISBN Object-Oriented Programming Chapter Chapter
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
1 Chapter 11 © 1998 by Addison Wesley Longman, Inc The Concept of Abstraction - The concept of abstraction is fundamental in programming - Nearly.
1 CS Programming Languages Class 22 November 14, 2000.
(1) ICS 313: Programming Language Theory Chapter 11: Abstract Data Types (Data Abstraction)
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
9 장 추상 데이터 타입 및 모듈 (Abstract Data Type & Module).
CSCE 240 – Intro to Software Engineering Lecture 3.
ISBN Chapter 12 Support for Object-Oriented Programming.
Mr H Kandjimi 2016/01/03Mr Kandjimi1 Week 3 –Modularity in C++
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.
Abstract Data Types and Encapsulation Concepts
ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:
11.1 The Concept of Abstraction
Lecture 9 Concepts of Programming Languages
Abstract Data Types and Encapsulation Concepts
Object Based Programming
Names, Binding, and Scope
Classes and Data Abstraction
Abstract Data Types and Encapsulation Concepts
Abstract Data Types and Encapsulation Concepts
Abstract Data Types and Encapsulation Concepts
Dynamic Data Structures and Generics
Introduction to Data Structure
Lecture 10 Concepts of Programming Languages
Oriented Design and Abstract Data Type
Subtype Substitution Principle
11.1 The Concept of Abstraction
Lecture 9 Concepts of Programming Languages
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

ADT data abstraction

Abstraction  representation of concepts by their relevant features only  programming has two major categories of abstraction process abstraction (procedures) data abstraction (abstract data types -> objects)

Process abstraction  external view: for caller of procedure – only the preconditions and effect of the process are relevant  internal view: for implementer of procedure – details of how to achieve effect starting from preconditions are important

Process abstraction  advantages reusable procedures revision of procedures independent of usage -> model for large programming projects – control of complexity, separation of tasks

Steps toward ADT  process abstraction inadequate – not enough organizing structure  modules group related procedures (and data) together  compilation units make groups as independent as possible (avoid recompilation – recall distinction of separate and independent compilation)

Steps toward ADT  encapsulation independently compilable units with support for internal structure visible interfaces for use by other units using them (types, procedure protocols, for error checking)

Abstract Data type (think Objects)  encapsulation for one data type (record?) and its operations e.g. complex number type with arithmetic ops user program can create instances and apply operations user program cannot manipulate (or even see) internal structure

Complex number ADT  ADT to represent and operate on complex numbers behaviour - external  representation of a complex number  operations on complex number objects implementation - internal  internal variables  methods code

Complex number ADT ADT Cpx  behaviour representation of a complex number  string: “3 - 4i” or “(5,pi/4)” operations on complex number objects  new(real, imaginary); new(magnitude, angle)  getReal, getImaginary, getMagnitude, getOrientation  add, subtract, multiply, divide, power e.g., function add(Cpx x,Cpx y)returns Cpx

Complex number ADT ADT Cpx  implementation - internal internal variables  double real  double im methods code  function add(Cpx x,Cpx y)returns Cpx z = new Cpx(x.real+y.real, x.im+y.im) return z

User defined ADTs  language capability for programmer to create, compile and use new ADTs the same way as built-in ADTs compile to make types, protocols visible with implementation invisible any built-in/”inherited” features for all ADTs?e.g. copy, compare, assign any restrictions on ADT types? simplicity/flexibility tradeoff e.g. parameterized ADTs, references only

AdaC++Java PackageClassPackage and class Specification package (interface info for independent compilation) And Body package (implementation of procedures) p. 480 Class with privacy controls for information hiding NO higher level structure like package Friend functions with access to private structure Class with privacy controls And Package for organizing and mutual access EVERYTHING is ADTs (no independent methods/functions)

AdaC++Java PackageClassPackage and class Template classes can be used with different types Instances of classes are allocated on run- time stack (may contain heap dynamic instance variables) Generic classes; Wrapper classes Object hierarchy provides same power (except for primitive types) Only references are on run-time stack – all instance objects on heap Contains (many) types and procedures NOT methods Parameterized e.g. collection package usable for different element types

Ada format  Specification package Types Procedure protocols Some are ‘private’ – invisible to user programs  Body package procedure code

Java abstraction concepts - ADTs and more --> objects  class  interface  abstract class  generic class  inheritance hierarchy  wrapper class