OO in Context Lecture 13: Dolores Zage. Confused about OO Not alone, there is much confusion about OO many programs are claimed to be OO but are not really.

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Session 9 Course : T Programming Language Concept Year : February 2011.
Advertisements

Object Oriented Programming
EDUC4417 Senior Computers Dr. Mumbi Kariuki January 28, 2004 Object-Orientation David Cuillerier.
Overview of Data Structures and Algorithms
1 OBJECT-ORIENTED CONCEPTS. 2 What is an object?  An object is a software entity that mirrors the real world in some way.  A software object in OOP.
OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
CS 211 Inheritance AAA.
Inheritance Definition Relationships Member Access Control Data Encapsulation Overloading vs. Overriding Constructors & Destructors.
Inheritance Inheritance Reserved word protected Reserved word super
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
Abstract Data Types and Encapsulation Concepts
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
Chapter 12: Adding Functionality to Your Classes.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Chapter 11: Inheritance and Composition. Objectives In this chapter, you will: – Learn about inheritance – Learn about derived and base classes – Redefine.
Introduction to Object-oriented programming and software development Lecture 1.
An Object-Oriented Approach to Programming Logic and Design
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Stephenson College DP 96 1 Object-Orientation by Derek Peacock.
1 Inheritance. 2 Why use inheritance?  The most important aspect of inheritance is that it expresses a relationship between the new class and the base.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
9-Dec Dec-15  INTRODUCTION.  FEATURES OF OOP.  ORGANIZATION OF DATA & FUNCTION IN OOP.  OOP’S DESIGN.
Object-Oriented Programming Chapter Chapter
1 OOP - An Introduction ISQS 6337 John R. Durrett.
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Methodology First and Language Second -A Way to Teach Object-Oriented Programming Haibin Zhu, PhD Department of Computer Science and Mathematics Nipissing.
ISBN Object-Oriented Programming Chapter Chapter
OOP (Object Oriented Programming) Lecture 1. Why a new paradigm is needed? Complexity Five attributes of complex systems –Frequently, complexity takes.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 – 9.4.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 13: Inheritance and Composition.
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 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
Object Oriented Paradigm OOP’s. Problems with Structured Programming As programs grow ever larger and more complex, even the structured programming approach.
1 C++ Classes & Object Oriented Programming Overview & Terminology.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
 By the end of this lecture, you should …  Understand the three pillars of Object- Oriented Programming: Inheritance, Encapsulation and Polymorphism.
ISBN Chapter 12 Support for Object-Oriented Programming.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
Object Oriented Programming
11.1 The Concept of Abstraction
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Chapter 11: Inheritance and Composition
Object-Oriented PHP (1)
Object-Oriented Programming
Lecture 10 Concepts of Programming Languages
11.1 The Concept of Abstraction
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

OO in Context Lecture 13: Dolores Zage

Confused about OO Not alone, there is much confusion about OO many programs are claimed to be OO but are not really different from those of yesteryear. Many programmers think they understand OO programming but do not. –For many, the term has become synonymous with the concept of encapsulation. However OO means more than just combining data and subprograms into a single module. Many non-programmers are held hostage to the OOP mystique

Introduction What is object-orient programming really? Is it any good? Is it really good? Is it difficult? How will you know it when you see it? Is OO programming a single thing, or does it come in stages?

First Fundamental Types are first fundamental notion for OOP. A type denotes a kind of “noun”, and OOP is about nouns or things rather than verbs. That is where the word “object” comes in.

Second Fundamental A type definition is a means of defining new kinds of types, or if you like, new kinds of objects. A programming language has a fixed number of built-in types, and a type definition is a way of introducing new kinds of objects that are more related to an application at hand

Third Fundamental To define a new type we usually need to define what kinds of actions we can do with new kinds of objects These “operations” go with that type To write an OO program, we need to group everything about a new type together.

Fourth Fundamental We would like to able to say that a given section of a program defines everything about type. We would also like to able to define as many objects of the type as we want. This means we would like to have a special kind of program unit just for objects of a given type

Fifth Fundamental We need to deal with growth and change with OOP it is important to able to extend a program in a convenient way. This leads to inheritance Inheritance is a key issue in reusing and adapting existing software It is also the greatest source of errors in OO programs according to recent research

Series of Ideas As we have seen through the 5 fundamentals, OOP can be viewed as a series of ideas that relate to a certain approach to programming We do NOT need to have these ideas explicitly in language to achieve OOP

A Systematic Presentation of OOP Types Private Types Abstraction Composite Types Type Definitions OperationsOverloadingEncapsulation Information Hiding Abstract Data Types Classes StateInheritanceDynamic Binding PolymorphismRelated Issues

OO Type Terms Type - a set of objects and the operations on the objects Composite Type - A type whose values have components Class - A type (period). Instance - An object, - a member of a class or type Overloading - use of the same operator with different types (or number) of arguments

Programming Language Types Provide a few basic types that the programmer must use to define meaningful computations on a class of real world object How would you represent a phone number? As a float? Note that this is only used for identification and operations such as +-/* are meaningless Then what? How would you represent a deck of cards?

OO Module Terms Encapsulation - Grouping of essential characteristics, e.g., all about commands or all about decks of cards Abstraction - Hiding of details that do not contribute to essential characteristics Information Hiding - Restricting the visibility of an object, variable, or an operation to the implementation part of a module

The Package Stack Encapsulation and Abstraction Package Stack is const Max_Stack_Size :=100 type stack_structure is record … procedure INITIALIZE_STACK(S: stack_structure); procedure Push(S:stack_structure; item:integer); procedure Pop(S:stack_structure; item:integer); Information Hiding Package Stack is procedure INITIALIZE_STACK; procedure Push(item:integer); procedure Pop(item:integer); Encapsulation - group all the stuff that pertains to a stack together Abstraction - only the header is given, the code is defined elsewhere (body) we are abstracting out the the essential properties Stack is not even visible to the user!

Software Reuse - Inheritance Constructor - a procedure that initializes an object, e.g. by allocating storage or setting a local state Destructor- a procedure that cleans up after an object is no longer used Inheritance - deriving a new type or class form an existing types or class multiple inheritance - deriving a type from more than one parent type polymorphism - use of the same name for an operation whose meaning depends upon the types of its arguments, e.g. procedure draw to draw various kinds of shapes or objects. The term has an implication that the different types form a hierarchy.

OOP Designing good classes is hard because designing good types is hard What kind of abstractions might be suitable in order to make the solution object- oriented? There are many ways of defining an object, and the conventions used vary according to the particular PL and upon the application at hand and one’s individual judgement.

Questioning OOP Object orientation by classification - employee -> administrative employee (isa) Object orientation by composition - car ->engine -> body (hasa) How relevant is object orientation by classification? Is object orientation by composition more useful? Is inheritance really useful? Can inheritance lead to problems?