Object Oriented Paradigm

Similar documents
Object Oriented Programming. Solved MCQs - Part 2

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

Data Abstraction. Hwansoo Han

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

CPS 506 Comparative Programming Languages. Programming Language

Object Oriented Programming with c++ Question Bank

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

Subtyping (Dynamic Polymorphism)

Lecture Notes on Programming Languages

COSC252: Programming Languages: Abstraction and OOP. Jeremy Bolton, PhD Asst Teaching Professor. Copyright 2015 Pearson. All rights reserved.

Concepts of Programming Languages

Lecture 15: Object-Oriented Programming

CSE 307: Principles of Programming Languages

Functional Programming. Ionut G. Stan - OpenAgile 2010

VALLIAMMAI ENGINEERING COLLEGE

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

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

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

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

CLASSES AND OBJECTS IN JAVA

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object-oriented Programming. Object-oriented Programming

Lecture 09. Ada to Software Engineering. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

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

G Programming Languages - Fall 2012

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

Programming Languages 2nd edition Tucker and Noonan"

Spring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques

Chapter 10 :: Data Abstraction and Object Orientation

Lecture 16: Object Programming Languages

B16 Object Oriented Programming

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

Chapter 9 :: Data Abstraction and Object Orientation

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

C++ Important Questions with Answers

M.C.A DEGREE EXAMINATION,NOVEMBER/DECEMBER 2010 Second Semester MC 9222-OBJECT ORIENTED PROGRAMMING (Regulation 2009)

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

Get Unique study materials from

Instantiation of Template class

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

COEN244: Class & function templates

Note 3. Types. Yunheung Paek. Associate Professor Software Optimizations and Restructuring Lab. Seoul National University

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

Chapter 12 Object and Object Relational Databases

Short Notes of CS201

A declaration may appear wherever a statement or expression is allowed. Limited scopes enhance readability.

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

CS201 - Introduction to Programming Glossary By

CMSC 330: Organization of Programming Languages

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

Ch02. True/False Indicate whether the statement is true or false.

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

Absolute C++ Walter Savitch

10. Abstract Data Types

Polymorphism. Contents. Assignment to Derived Class Object. Assignment to Base Class Object

Topics Covered Thus Far CMSC 330: Organization of Programming Languages

Today s lecture. CS 314 fall 01 C++ 1, page 1

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

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

RAJIV GANDHI COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY OBJECT ORIENTED PROGRAMMING QUESTION BANK UNIT I 2 MARKS

CGS 2405 Advanced Programming with C++ Course Justification

Purpose of Review. Review some basic C++ Familiarize us with Weiss s style Introduce specific constructs useful for implementing data structures

(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University

Evolution of Programming Languages

DATA TYPES. CS 403: Types and Classes DATA TYPES (CONT D)

Inheritance, Polymorphism and the Object Memory Model

Lecturer: William W.Y. Hsu. Programming Languages

CS304 Object Oriented Programming Final Term

Where do we go from here?

C++ (Non for C Programmer) (BT307) 40 Hours

Types. What is a type?

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism

Types and Classes. I II From predefined (simple) and user-defined (composite) types via Abstract data types

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Thanks! Review. Course Goals. General Themes in this Course. There are many programming languages. Teaching Assistants. John Mitchell.

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS:

AN OVERVIEW OF C++ 1

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Procedure and Object- Oriented Abstraction

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

Simula 67. Simula and Smalltalk. Comparison to Algol 60. Brief history. Example: Circles and lines. Objects in Simula

Method Resolution Approaches. Dynamic Dispatch

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

OBJECT ORIENTED PROGRAMMING

G Programming Languages Spring 2010 Lecture 9. Robert Grimm, New York University

System Analysis and Design. Introduction: Object Oriented Design

Lecture 23: Object Lifetime and Garbage Collection

Subprograms. Copyright 2015 Pearson. All rights reserved. 1-1

END TERM EXAMINATION

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

What are the characteristics of Object Oriented programming language?

Problem Solving with C++

Interview Questions of C++

Object oriented programming. Encapsulation. Polymorphism. Inheritance OOP

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

Chapter 11. Abstract Data Types and Encapsulation Concepts ISBN

CERTIFICATE IN WEB PROGRAMMING

Inheritance, and Polymorphism.

Object typing and subtypes

Transcription:

Object Oriented Paradigm History Simula 67 A Simulation Language 1967 (Algol 60 based) Smalltalk OO Language 1972 (1 st version) 1980 (standard) Background Ideas Record + code OBJECT (attributes + methods) (module) Software reuse & modification (extension or restriction) 1. Extension of data or operations 2. Redefinition of operations 3. Application Frameworks (redefinition for specific cases) 4. Abstraction (& re factoring) 5. Polymorphism: overloading & parametrised types E.g. sequence stack with add & remove at position 1 E.g. sequence deque (double ended queue) 1DFR - PL - OO Paradigm

Object Oriented Paradigm Smalltalk Concepts Class class attributes; object attributes; methods Object instance of a class (class attributes; methods) Messages request for a service; performed by a method may include parameters; may return a result mutators may change the state of the object Variable reference semantics (not value) ref to object Inheritance class hierarchy Polymorphism overloading (same name for similar services) Collection types (Object(Collection (Bag) (Indexed (FixedSize (Array) (String)) (Ordered (Sorted))) (Set (Dictionary))) No built in classes for stacks, queues, trees or graphs 2DFR - PL - OO Paradigm

Object Oriented Paradigm Java Concepts (C/C++ like syntax) Class class attributes; object attributes; methods (static) reference semantics BUT primitive types: int, float, char value semantics Object instance of a class (class attributes; methods) instance variables (usually private) self reference: this, self Method operation on an object; accessor (get), mutator (set) abstract signature(sub class implementation) access control: public; protected; private constructor (prologue) ; destructor (epilogue); Packages e.g. string Garbage Collection 3DFR - PL - OO Paradigm

Object Oriented Paradigm Java Collection Framework concepts Interfaces e.g. list, queue Generic collections type parameters Static Binding (compile time) & Dynamic Binding (run time) Map transform each element in a collection Filter select elements from a collection Reduce summarise information about a collection e.g. # these 3 ideas come from functional programming recall the remove if, count if in Lisp 4DFR - PL - OO Paradigm

Object Oriented Paradigm C++ Concepts Class class attributes; object attributes; methods similar to the struct in C Super class base class Sub class derived class Members instance variables data members methods member functions Access control public, protected, private Constructors & Destructors Generic Collection Template Class STL Standard Template Library Static Binding, Dynamic Binding Virtual Functions 5DFR - PL - OO Paradigm

Design Issues in OOPLs More dynamic operations (run time overhead) Classes versus Types Objects are typeless classes not type checked Classes are type constructors classes part of the type system Classes become the type system Classes versus Modules Implementation + interface not always well separated Extra module mechanism Java packages, C++ namespace C++ friend open access to external operations Inheritance versus Polymorphism Parametric polymorphism type parameters unspecified Overloading (ad hoc polymorphism) name overloaded Subtype Polymorphism all ops on one type applied to another Inheritance sub type / overloading 6DFR - PL - OO Paradigm

Implementation Issues in OOPLs Objects and Methods Objects implementation as record structures Methods implementation as functions (+ object ref param) Inheritance and Dynamic Binding Which method may not be known until run time Allocation (Heap/Stack) and Initialisation Stack allocation compiler generates constructor Initialisation of ancestor class scheduled by the compiler Garbage collection automatic or programmer controlled? FINAL COMMENTS Many of these issues are language dependent Although widespread, the OOP has received criticism! 7DFR - PL - OO Paradigm

Critique! Joe Armstrong, (Erlang), who is quoted as saying: [34] The problem with object oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle. https://en.wikipedia.org/wiki/object oriented_programming#criticism 8DFR - PL - OO Paradigm

Issues to explore! Definitions of OOP and OOPLs are they the same? Simula 67 & Smalltalk (history) C C++ Java C# development (pointers!!!) Class based versus Prototype based The ellipse circle criticism Complexity issues more design required Composition & Inheritance (single & multiple) Design patterns Application areas suitable / less suitable Relationship to other paradigms Learning overhead 9DFR - PL - OO Paradigm

Summary & Final Comments OO concepts existed already in the 1960s Historically Simula 67 the first OOPL, Smalltalk pure OOPL Developed during 1980s in use 1990s The application of the OOP was often not successful Programmers wrote code but did not always understand OOP!!! Can lead to more complexity if not understood The object oriented paradigm is NOT well defined Developed through languages e.g. C++ was C compatible C++ considered dangerous (pointers) Java (references) C++ / Java / C# are more used because of the syntax There is a substantial body of criticism on OOP There is no FORMAL base for OOP (cf functional / logic) DFR - PL - OO Paradigm 10