Classwide Programming 1

Similar documents
Chapter 5 Object-Oriented Programming

Object oriented programming Concepts

CPS 506 Comparative Programming Languages. Programming Language

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Object Orientated Analysis and Design. Benjamin Kenwright

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 13 Object Oriented Programming. Copyright 2006 The McGraw-Hill Companies, Inc.

CSE 452: Programming Languages. Previous Lecture. From ADTs to OOP. Data Abstraction and Object-Orientation

Java Object Oriented Design. CSC207 Fall 2014

CLASSES AND OBJECTS IN JAVA

Concepts of Programming Languages

Inheritance and Polymorphism

Design issues for objectoriented. languages. Objects-only "pure" language vs mixed. Are subclasses subtypes of the superclass?

From Module To Objects

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Inheritance -- Introduction

What is Inheritance?

Object-Oriented Concept

Objects and Classes. Basic OO Principles. Classes in Java. Mark Allen Weiss Copyright 2000

Data Abstraction. Hwansoo Han

CSC207H: Software Design. Java + OOP. CSC207 Winter 2018

Chapter 4 Defining Classes I

Software Development. Modular Design and Algorithm Analysis

ENCAPSULATION. private, public, scope and visibility rules. packages and package level access.

IT101. Inheritance, Encapsulation, Polymorphism and Constructors

Inheritance and Encapsulation. Amit Gupta

Inheritance and Polymorphism

CMSC 132: Object-Oriented Programming II

Object-Oriented Design

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

SEEM4570 System Design and Implementation. Lecture 11 From Design to Implementation

1. Software Systems Complexity, OO Paradigm, UML

CS200: Advanced OO in Java

Part 7 - Object Oriented Concepts Classes, Objects, Properties and Methods

10. Abstract Data Types

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Chapter 8: Class and Method Design

9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh

Programming II (CS300)

OBJECT ORIENTED PROGRAMMING USING C++

modeling essential properties treat what and how independently building complex structures from simpler ones identifying common elements

Design Strategies in OO Development

EXAM Microsoft MTA Software Development Fundamentals. Buy Full Product.

PROGRAMMING LANGUAGE 2

CHAPTER 5 GENERAL OOP CONCEPTS

CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards

C++ Important Questions with Answers

Complexity. Object Orientated Analysis and Design. Benjamin Kenwright

Topics. Modularity and Object-Oriented Programming. Dijkstra s Example (1969) Stepwise Refinement. Modular program development

CS304- Object Oriented Programming LATEST SOLVED MCQS FROM FINALTERM PAPERS. MC

CGS 2405 Advanced Programming with C++ Course Justification

ENCAPSULATION AND POLYMORPHISM

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes

Lecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance?

Visitor Pattern.» Represent an operation to be performed on all of the components of an object structure

Object-Oriented Design

CS304 Object Oriented Programming Final Term

Chapter 11. Abstract Data Types and Encapsulation Concepts

Microsoft Visual Basic 2005: Reloaded

CS313D: ADVANCED PROGRAMMING LANGUAGE

What are the characteristics of Object Oriented programming language?

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed

Enhanced Class Design -- Introduction

Lecture Notes on Programming Languages

Abstract Data Types and Encapsulation Concepts

QUESTIONS FOR AVERAGE BLOOMERS

1. Write two major differences between Object-oriented programming and procedural programming?

C++ Inheritance and Encapsulation

Fundamentals of Programming Languages

3. Object-Oriented Databases

HAS-A Relationship. Association is a relationship where all objects have their own lifecycle and there is no owner.

OBJECT ORİENTATİON ENCAPSULATİON

Value vs. Entity Objects, Information Hiding

Introduction to OOP. Procedural Programming sequence of statements to solve a problem.

Programming Languages 2nd edition Tucker and Noonan"

Object oriented aspects of Ada95

OOAD - OBJECT MODEL. The concepts of objects and classes are intrinsically linked with each other and form the foundation of object oriented paradigm.

CSI33 Data Structures

CMSC 132: Object-Oriented Programming II

Object Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance

CHAPTER 4 HEURISTICS BASED ON OBJECT ORIENTED METRICS

Back to ObjectLand. Contents at: Chapter 5. Questions of Interest. encapsulation. polymorphism. inheritance overriding inheritance super

Object-Oriented Programming. Objects. Objects. Objects

Chapter 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 5: Classes and Objects in Depth. Information Hiding

Java. Classes 3/3/2014. Summary: Chapters 1 to 10. Java (2)

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

Computer Programming II Python

New Programming Paradigms

Inheritance. Benefits of Java s Inheritance. 1. Reusability of code 2. Code Sharing 3. Consistency in using an interface. Classes

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

JAVA OBJECT-ORIENTED PROGRAMMING

Classes, Objects, and OOP in Java. June 16, 2017

Transcription:

Classwide Programming 1 OO Definitions Type extension Tagged types 1

Object-Oriented Programming Method of program construction that facilitates: writing reusable software components supporting programming in the many and programming in the large modification and maintenance of existing programs Built around three concepts: data abstraction (including encapsulation and information hiding) inheritance polymorphism 2

Encapsulation Encapsulation is the concentration of all the program text dependent upon a particular design choice in one place. For the choice of a data structure to represent an ADT, this program text consists of the definition of the data structure and the implementation of operations in terms of the data structure. In Ada, this text is encapsulated in a package. 3

Information Hiding Information hiding is the use of programming language constructs that restrict the ways that information provided in part of the program can be used in other parts. Information provided in an Ada package can be hidden from other parts of the program by placing it in a package body or in the private part of a package declaration. Private types hide information about the data structure chosen to represent an ADT. 4

Inheritance Inheritance is the definition of a new type that is almost the same as some other, previously defined type. Properties of the new type that are identical to corresponding properties of the old type are automatically inherited and need not be specified again. Inheritance is achieved in Ada through derived types. 5

Polymorphism Polymorphism is the definition of operations that apply to more than one type. Polymorphic means having many forms. Polymorphic operations are defined for classes of types that have common properties. These common properties make it meaningful to define an operation applying to all types in the class. 6

Polymorphism /= Overloading Overloading is the definition of distinct operations, each applicable to a particular type, that have the same name. Overloading can create the illusion that a single operation applies to many different types. When a call to an overloaded program is compiled, the compiler determines which of the distinct operations is being called. In contrast, a program may execute the same call on a polymorphic subprogram several times using data of different types in each case. More on polymorphism next lesson. 7

Derived Types A derived type is a type declared to be similar to some previously declared type called the parent type of the derived type. A derived type automatically inherits the primitive operations of its parent type. If the operation of the parent type was a subprogram having one or more parameters of the parent type, a corresponding operation is automatically declared for the derived type. 8

Inheritance Hierarchy Triplet_Type + * Rescale Vector_Type overridden * Magnitude Deriver.adb 9

Type Extension The simple form of derived type declarations we have just worked through is rarely useful because the derived types have the same structure as the parent type. Extending the parent involves creating a derived type whose values contain all the information in the parent type plus additional information corresponding to the special characteristics of the derived type Only tagged types may be extended. 10

Tagged Types Type officer_record_type is tagged record Name: Unbounded_String; Rank: Rank_type; SSN: SSN_type; end record; Type aviation_officer_record_type is new officer_record_type with record Rating: Rating_type; Aircraft: Aircraft_type; end record; 11

Tagged Type Issues Type extension should be done to specialize the type not create a new type with a component of the parent type. Inheriting inapplicable operations is not worthwhile. Type conversions with extended derived types are one-way. 12

Extension Aggregates type officer_type is tagged record last_name: string(1..3); SSN: string(1..9); end record; type engineer_officer_type is new officer_type with record dive_qual: string(1..6); end record; engineer:officer_type:= engineer_officer_type'(last_name => "Ray", SSN => "123456789", dive_qual => "Master"); 13

Extension Aggregates type officer_type is tagged record last_name: string(1..3); SSN: string(1..9); end record; type engineer_officer_type is new officer_type with record dive_qual: string(1..6); end record; engineer:engineer_officer_type:= engineer_officer_type'( (officer_type'(last_name => "Ray", SSN => "123456789") ) with dive_qual => "Master"); 14

Tagged Private Types A type may be declared as an ordinary private type in the visible part of a package declaration. A type may be declared as a tagged private type in the visible part of a package declaration. There must be a corresponding full type declaration in the private part of the package declaration A type may be extended by declaring a private extension in the visible part of the a package declaration. 15