OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.

Slides:



Advertisements
Similar presentations
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.
Advertisements

OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Fall 2006AE6382 Design Computing1 Object Oriented Programming in Matlab Intro to Object- Oriented Programming (OOP) An example that creates a ASSET class.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Classes & Objects Computer Science I Last updated 9/30/10.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Object-Oriented Analysis and Design
Page 1 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Chapter 7 Role-Based Component Engineering.
Chapter 1 Object-Oriented System Development
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
Fall 2007ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
Chapter 13: Object-Oriented Programming
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
C++ fundamentals.
BACS 287 Basics of Object-Oriented Programming 1.
TCU CoSc Introduction to Programming (with Java) Getting to Know Java.
Object Oriented Software Development
Chapter 11: Inheritance and Composition. Objectives In this chapter, you will: – Learn about inheritance – Learn about derived and base classes – Redefine.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 8: More About OOP and GUIs.
BCS 2143 Introduction to Object Oriented and Software Development.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
An Object-Oriented Approach to Programming Logic and Design
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
CONCEPTS OF OBJECT ORIENTED PROGRAMMING. Topics To Be Discussed………………………. Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Chapter 6 Programming Languages. © 2005 Pearson Addison-Wesley. All rights reserved 6-2 Chapter 6: Programming Languages 6.1 Historical Perspective 6.2.
Chapter 6 Programming Languages © 2007 Pearson Addison-Wesley. All rights reserved.
Modeling system requirements. Purpose of Models Models help an analyst clarify and refine a design. Models help simplify the complexity of information.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
Learners Support Publications Object Oriented Programming.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Object-Oriented Programming Chapter Chapter
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
ISBN Object-Oriented Programming Chapter Chapter
CSCI 383 Object-Oriented Programming & Design Lecture 3 Martin van Bommel.
Guide to Programming with Python Chapter Eight (Part I) Object Oriented Programming; Classes, constructors, attributes, and methods.
Introduction to OOP CPS235: Introduction.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
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.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
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)
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
ISBN Chapter 12 Support for Object-Oriented Programming.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Programming in Java: lecture 7
OOP - Object Oriented Programming
Programming paradigms
Visit for more Learning Resources
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Programming Logic and Design Seventh Edition
JAVA By Waqas.
Chapter 8: More About OOP and GUIs
OBJECT ORIENTED PROGRAMMING overview
Types of Programming Languages
Object Oriented Concepts
Workshop for Programming And Systems Management Teachers
Review of Previous Lesson
Presentation transcript:

OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage. The approach is based on the fact that one of the ways that we make sense of the actual world is by identifying perceived phenomena as separate objects; we also tend to class similar types of objects together - trees, animals, houses etc. The idea is that it is easier to understand the ‘virtual world’ of a program if it can be organised in a similar way to that in which we are used to making sense of the complexities of the actual world. Objects in OOP are often representations of things that we do perceive in the actual world, but they are also used to represent abstract ideas, including ideas developed in programming. Types of objects in the actual world: tree animal house vehicle person Abstract ideas: point vector surface sphere variable loop

OOP - Object Oriented Programming In programming languages, objects have to be described in code. The descriptions usually use similar syntaxes to other constructs in the language being used. Sometimes the syntax for using oop techniques looks exactly like that used for non-oop syntax. This can be confusing if you are unaware of what is going on. The syntax can vary from language to language, just as it can for loops and conditional statements, but once you understand the fundamental concepts of oop, it is relatively easy to recognise how oop techniques are used in different languages.

OOP - Object Oriented Programming OBJECT Properties (Data) Methods (Procedures) In oop, an object is a collection of related data and procedures. The data elements of an object are called properties. The procedures in an object are called methods.

OOP - Object Oriented Programming An example of an object in a program might be a human in a crowd animation. Or it might be a computer graphics primitive like a point, a cube etc.. For an object to be created it is first described in the declaration of a class. The class acts as a template from which an instance of the class - an object, can then be created. Any number of objects can be created based on the same class.

OOP - Object Oriented Programming e.g. A Virtual Actor Object The actor has various characteristics, e.g. speed, wit, health etc.. These can be represented by variables. The actor can exhibit a number of behaviours, e.g. moving from one place to another, picking things up, interacting with other actors. These would be represented by methods. CLASS Properties speed wit health location Methods move pick up meet kiss

OOP - Object Oriented Programming e.g. A Virtual Actor Object During the game the actor can carry out various methods, changing its variables as appropriate. Everything the actor ‘knows’ is represented by its variables; everything it can do is expressed in its methods.

OOP - Object Oriented Programming Messages Objects interact with each other by sending messages to each other, asking them to carry out their methods. A message consists of: The name of an object, followed by the name of a method that the object can execute, followed by any parameters (additional information needed). The object that initiates a message is called the sender and the one that receives the message is called the receiver.

OOP - Object Oriented Programming Classes A class is a template that defines the methods and variables to be included in a particular type of object. The objects that belong to that class are called instances of the class.

OOP - Object Oriented Programming Inheritance Is a way in which one class of objects can be defined as a special case of a more general class, they automatically inherit the methods and variables of the general class. Special cases of a class are called subclasses of that class; the general class is called the superclass of its special cases.

OOP - Object Oriented Programming Inheritance As well as inheriting the methods and variables of their superclass, subclasses may define their own methods and variables and may override aspects of their inheritence.

OOP - Object Oriented Programming Class hierarchy Classes can be nested to any degree, inheritence automatically accumulates down the levels. The resulting tree-like structure is called a class hierarchy.

OOP - Object Oriented Programming Encapsulation Keeping related data and procedures together is called encapsulation. Encapsulation is an extension of the strategy called information-hiding used in structured programming. In object oriented programming the data inside an object can only be accessed by that object’s methods. Objects can’t read each other’s data directly they can only send each other messages (which may include information about their data).

OOP - Object Oriented Programming Variables and data abstraction Most languages have built-in data types. In many languages it is possible to build new data types (called abstract data types) by combining existing data types in new ways. The object oriented approach treats abstract types as if they were part of the original language.

OOP - Object Oriented Programming Composite Objects Variables can contain other objects. This makes it possible to build more complicated objects out of simpler components. Objects that contain other objects are called composite objects.

OOP - Object Oriented Programming Example messages ogre15.turn(90) Is how a message to an object named ogre15 asking it to use its turn method with a parameter of 90 degrees might look in C++. age + 10 In this case and object named ‘age’ is being asked to use the method ‘+’ with the parameter 10. In this case ‘age’ is an instance of the class ‘number’ and numbers know how to carry out simple arithmetic methods.

OOP - Object Oriented Programming Returned responses A sender may request that the receiver return a message, perhaps a confirmation that the task could be carried out. This response is called a return value.

OOP - Object Oriented Programming Overloading Using a technique called overloading it is possible for different classes to have different methods which share the same name. For example, there may be several classes of monster each of which have a method named ‘attack’; each method can be different, but it can be referred to by the same name. This makes it simpler for objects to send messages to each other, as the same name can be used when sending similar messages to different classes.

OOP - Object Oriented Programming Virtual or Abstract Classes A class that represents a high level object that is used as a parent to other classes but is not used to make an instance is called an abstract or virtual class. An example would be ‘vehicle’ - in which a vehicle describes an abstract class that might have subclasses (such as car, lorry, hovercraft) that would be used to create objects - you would not actually have an instance of the class ‘vehicle’.

OOP - Object Oriented Programming Multiple Inheritance Multiple inheritance allows an object to have more than one superclass. There are however problems of complexity as, for example, the two superclasses may have methods with the same name.

OOP - Object Oriented Programming References Taylor, David A., Object Oriented Technology: A Manager’s Guide, Addison-Wesley, 1990 ISBN: Lafore, Robert., Object-Oriented Programming in Turbo C++, (Chapter 1), Waite Group Press, 1991