Object-Oriented Principals Dwight Deugo Nesa Matic

Slides:



Advertisements
Similar presentations
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Advertisements

Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Object-Oriented Application Development Using VB.NET 1 Chapter 8 Understanding Inheritance and Interfaces.
Classes & Objects Computer Science I Last updated 9/30/10.
Inheritance Java permits you to use your user defined classes to create programs using inheritance.
Object-Oriented Analysis and Design
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
Object-oriented Programming Concepts
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
Object Oriented Concepts. Movement toward Objects Instead of data-oriented or process-oriented Analysis, many firms are now moving to object-oriented.
© 2006 Pearson Addison-Wesley. All rights reserved9 A-1 Chapter 9 Advanced Java Topics CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck Spring 2007.
Chapter 7 - Generalization/Specialization and Inheritance1 Chapter 7 Generalization/Specialization and Inheritance.
State,identity and behavior of objects Sem III K.I.R.A.S.
(c) University of Washington03-1 CSC 143 Java Inheritance Reading: Ch. 10.
BACS 287 Basics of Object-Oriented Programming 1.
Object Oriented Software Development
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Introduction to Objects Adapted from “TEN STEPS TO OBJECT-SPEAK” a CPT Tech Talk by Joy Starks September 17, 1999.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Unified Modeling Language, Version 2.0
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
1 Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill Chapter 2: Object Basics Object-Oriented Systems Development Using the Unified Modeling.
Inheritance Dwight Deugo Nesa Matic
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
CSC480 Software Engineering Lecture 11 September 30, 2002.
Object-Oriented Design Justin Callanan CS 597. Object-Oriented Basics ● Data is stored and processed in “objects” ● Objects represent generalized real.
Chapter 12 Object Oriented Design.  Complements top-down design  Data-centered view of design  Reliable  Cost-effective.
CIS224 Software Projects: Software Engineering and Research Methods Lecture 1b Object concepts (Based on Stevens and Pooley (2006), Chapter 2) David Meredith.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Classes Dwight Deugo Nesa Matic
Object Oriented Programming
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
S.Ducasse Stéphane Ducasse 1 Essential OO Concepts Stéphane Ducasse.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Inheritance and Polymorphism
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Collections Dwight Deugo Nesa Matic
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)
Basic Characteristics of Object-Oriented Systems
Object Oriented Programming in Java Habib Rostami Lecture 2.
Java IDE Dwight Deugo Nesa Matic
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Object-Oriented Design
Sections Inheritance and Abstract Classes
Object-Oriented Programming Concepts
CHAPTER 5 GENERAL OOP CONCEPTS.
Systems Analysis and Design With UML 2
OOP What is problem? Solution? OOP
Object Oriented Concepts -I
Types of Programming Languages
Object Oriented Analysis and Design
Advanced Java Topics Chapter 9
Workshop for Programming And Systems Management Teachers
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Object Oriented Analysis and Design
Object-Oriented Programming
Presentation transcript:

Object-Oriented Principals Dwight Deugo Nesa Matic

2 © , Espirity Inc. Additional Contributors None as of Septembe, 2004

3 © , Espirity Inc. Module Overview 1.Object-Oriented Principals

4 © , Espirity Inc. Module Road Map 1.Object-Oriented Principals  Objects  Classes, instances, fields and methods  Encapsulation  Polymorphism  Inheritance  Dynamic binding

5 © , Espirity Inc. What is Object-Oriented Technology? It is a technology that allows modeling of software as the real world  This is achieved through objects and interactions between them It is a way of thinking of software as reusable components  Every object is a component on its own and could be reused in different context

6 © , Espirity Inc. Why Use Object-Oriented Systems? Benefits of Object-Oriented systems:  Greater flexibility  Reusability of objects  Higher quality control  Lower maintenance

7 © , Espirity Inc. Developing Object-Oriented Software Software is modeled by objects  Software objects represent real-world objects Each object contains:  State, i.e., data  Behavior, i.e., methods/functions

8 © , Espirity Inc. Object-Oriented Software Developing object-oriented software is identifying:  Objects  Characteristics of individual objects  Relationships between objects Objects interact by sending messages to each other  Interacting objects make an object-oriented system

9 © , Espirity Inc. Objects and Loose Coupling Changing an object’s data does not lead to changes in an object’s external behavior  An object’s external interface stays the same  Promotes loose coupling between objects state behavior object1 state behavior object2 state behavior object3

10 © , Espirity Inc. Objects Every object has:  State  Behavior State represents data - what an object knows, or what an object contains Behavior represents what an object can do

11 © , Espirity Inc. Person object  State: age, name, children  Behavior: addChild, getAge, setAge Object State and Behavior state behavior aPerson age name children getAge setAge addChild …

12 © , Espirity Inc. Interactions between Objects Object interact by sending messages to each other Objects and interactions between them make up an object-oriented system aPolicyFactory: createPolicy aBroker:aPerson: aPolicy: aPolicy new(“Joe Smith”, “35 years”) aPerson setOwner(aPerson) …

13 © , Espirity Inc. Messages There are two major terms in messaging:  Message sender  Message receiver Messages may have arguments getAge() sender receiver message aBroker:aPerson:

14 © , Espirity Inc. Methods Method is concrete implementation of a message When message is sent to a receiver:  Method is found by type of the receiver object and method signature  Method code is executed Method represents an object’s response to a message

15 © , Espirity Inc. Method Signature Method signature is unique identifier of the method It is used to distinguish methods with same name and same number of parameters It consists of:  Method name  Parameter name  Parameter type

16 © , Espirity Inc. Object’s Public Protocol Public protocol is set of messages that can be sent to an object It does not include messages that an object can send to itself  These are private aPerson age name children getAge setAge addChild … public protocol

17 © , Espirity Inc. Fields Fields represent characteristics of an object Fields are also known as attributes, or instance variables aPerson age name children getAge setAge addChild … fields

18 © , Espirity Inc. Object-Oriented Principal: Encapsulation Objects hide implementation of the messages behind their public protocols  Object’s internal implementation is accessed by that object only Encapsulation is also known as implementation hiding getName() aBroker:aPerson: getAge() Joe Smith 35

19 © , Espirity Inc. Classes Classes are:  Factories for creating objects  Template for the same kind of objects that describes their state and behavior  Code repository for objects Classes define objects (by defining their state and behavior) and their type Person age name children address getAge setAge addChild …

20 © , Espirity Inc. Instances Every object is an instance of some class All instances of same class have the same protocol  They have same fields and same methods that are defined by the class John Smith 35 John Smith Jimmy, Chloe Dad Smith 60 Dad Smith John, Tom class Person age name children address getAge setAge addChild …

21 © , Espirity Inc. Object-Oriented Principal: Inheritance Some classes may share commonalities  For example HomePolicy, AutoPolicy, LifePolicy classes may all have same state and behavior Instead of repeating commonalities in each class, we can abstract them in a common place  These commonalities can be stored in a super class  Each subclass inherits state and behavior from its superclass

22 © , Espirity Inc. Specialization and Generalization Policy client premium policyNumber getClient setClient … HomePolicy house getHouse setHouse AutoPolicy auto getAuto setAuto LifePolicy generalization specialization

23 © , Espirity Inc. Why Inheritance? Inheritance represents real-world modeling  Some objects are special cases of other objects Inheritance promotes reuse and extensibility  Same data and behavior is shared among objects of different types (different class)  New data and new behavior that is common for those objects is easier to add

24 © , Espirity Inc. Object-Oriented Principal: Polymorphism Polymorphism  different objects respond to the same message in different ways  For example when asked to talk a dog barks, and a cat meows It is often supported by method overriding  Overriding means that subclass may implement the same method as superclass, but with different code  toString() method in the Object class is an example of often overridden method

25 © , Espirity Inc. Overriding Example Consider Animal class:  Dog and Cat as subclasses All Animal objects should know how to talk aCat.talk(); aDog.talk(); meows barks Animal talk() Dog talk() Cat talk()

26 © , Espirity Inc. Dynamic Binding Dynamic binding represents runtime method binding  It is runtime binding of method invoked in the message to the method that implements that message  For example: anAnimal.talk(); aDog … talk aCat … talk

27 © , Espirity Inc. Labs! Lab: Object-Oriented Concept