OOP - Object Oriented Programming

Slides:



Advertisements
Similar presentations
When is Orientated Programming NOT? Mike Fitzpatrick.
Advertisements

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
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.
Object-Oriented Analysis and Design
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.
C++ fundamentals.
BACS 287 Basics of Object-Oriented Programming 1.
Object Oriented Software Development
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.
An Object-Oriented Approach to Programming Logic and Design
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Modeling system requirements. Purpose of Models Models help an analyst clarify and refine a design. Models help simplify the complexity of information.
Chapter 12 Object Oriented Design.  Complements top-down design  Data-centered view of design  Reliable  Cost-effective.
Chapter 12 Support for Object oriented Programming.
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
Introduction to OOP CPS235: Introduction.
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.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
 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.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Programming in Java: lecture 7
Object-Oriented Design
Programming paradigms
Object-Orientated Programming
Visit for more Learning Resources
Object Oriented Programming
OOP: Encapsulation &Abstraction
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING
Sachin Malhotra Saurabh Choudhary
Programming Logic and Design Seventh Edition
JAVA By Waqas.
The Movement To Objects
OBJECT ORIENTED CONCEPT
Intro to OOP with Java, C. Thomas Wu CHAPTER 2 Introduction to OOP
Chapter 8: More About OOP and GUIs
OOP What is problem? Solution? OOP
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
OBJECT ORIENTED PROGRAMMING overview
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Road Map Inheritance Class hierarchy Overriding methods Constructors
Object Oriented Concepts
OOP Paradigms There are four main aspects of Object-Orientated Programming Inheritance Polymorphism Abstraction Encapsulation We’ve seen Encapsulation.
The Object-Oriented Thought Process Chapter 07
Object-oriented Design in Processing
topics object oriented design objects and classes properties
Support for Object-Oriented Programming
Chapter 11: Inheritance and Composition
Workshop for Programming And Systems Management Teachers
Review of Previous Lesson
Review of Previous Lesson
Final and Abstract Classes
Object-Oriented Programming
C++ Object Oriented 1.
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

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

OOP - Object Oriented Programming 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. OBJECT Properties (Data) Methods (Procedures) OOP - Object Oriented Programming

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

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

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: 0-201-56358-4 Lafore, Robert., Object-Oriented Programming in Turbo C++, (Chapter 1), Waite Group Press, 1991 OOP - Object Oriented Programming