Object-Oriented (Real World Case) Object-Oriented Analysis CIM2566 Bavy LI.

Slides:



Advertisements
Similar presentations
Design by Contract.
Advertisements

By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
UMBC 1 Static and Dynamic Behavior CMSC 432 Shon Vick.
Object-Oriented Application Development Using VB.NET 1 Chapter 8 Understanding Inheritance and Interfaces.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
1 Chapter 6 Object-Oriented Software Design and Implementation.
L3-1-S1 OO Concepts © M.E. Fayad SJSU -- CMPE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
Inheritance. In this chapter, we will cover: The concept of inheritance Extending classes Overriding superclass methods Working with superclasses that.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Object-Oriented Thinking Chapter 1, Object-Oriented Programming in Java, Timothy Budd, 1998 ICS102 Semester
1 Chapter 6 Inheritance, Interfaces, and Abstract Classes.
Lecture 2 Object Concepts I Object Oriented Analysis and Design K268 SENG2100 Pat Browne
Object-oriented Programming Concepts
Polymorphism. Lecture Objectives To understand the concept of polymorphism To understand the concept of static or early binding To understand the concept.
Object Oriented Concepts. Movement toward Objects Instead of data-oriented or process-oriented Analysis, many firms are now moving to object-oriented.
Object-Oriented Application Development Using VB.NET 1 Chapter 8 Understanding Inheritance and Interfaces.
Sharif University of Technology Session # 7.  Contents  Systems Analysis and Design  Planning the approach  Asking questions and collecting data 
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
Introduction to Object-oriented Programming Introduction to Object-oriented Programming CMPS 2143.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
(c) University of Washington03-1 CSC 143 Java Inheritance Reading: Ch. 10.
Introduction To System Analysis and design
Inheritance One of the biggest advantages of object-oriented design is that of inheritance. A class may be derived from another class, the base class.
CSCI-383 Object-Oriented Programming & Design Lecture 2.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Object Oriented Programming with JAVA Arash N. Kia AlZahra University Definitions – Part 1.
CSSE501 Object-Oriented Development. Chapter 11: Static and Dynamic Behavior  In this chapter we will examine the differences between static and dynamic.
CSCI-383 Object-Oriented Programming & Design Lecture 3.
1 OBJECT-ORIENTED THINKING Ziya Karakaya Atılım University Tel: (312) / 5345 Faks: (312) E-posta:
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
Object-Oriented Programming. An object is anything that can be represented by data in a computer’s memory and manipulated by a computer program.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
More on Polymorphism. Ever have one of those days?
OOAD Unit – I OBJECT-ORIENTED ANALYSIS AND DESIGN With applications
Object-Oriented Programming with Java Lecture 1: Introduction Autumn, 2007.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
CSSE501 Object-Oriented Development. Chapter 13: Multiple Inheritance  In this chapter we will investigate some of the problems that can arise when a.
Chapter 1: OO Thinking Not just learn Java, but also understand why it is the way it is Learn the OO worldview.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
1 CMIS301 O-O Thinking Understanding O-O Programming by T Budd.
Basic Concepts of Object Orientation Object-Oriented Analysis CIM2566 Bavy LI.
Salman Marvasti Sharif University of Technology Winter 2015.
More Design Patterns From: Shalloway & Trott, Design Patterns Explained, 2 nd ed.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
CSCI 383 Object-Oriented Programming & Design Lecture 3 Martin van Bommel.
JAVA Programming (Session 4) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
1 Software Engineering Lecture 15 Object Oriented Software Design in Java.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
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)
3/1/01H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
Sadegh Aliakbary Sharif University of Technology Fall 2010.
CHAPTER 6 OBJECT ANALYSIS.
BY:- TOPS Technologies
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
OOP - Object Oriented Programming
JAVA By Waqas.
The Movement To Objects
OOP What is problem? Solution? OOP
Chapter 1: Object-Oriented Thinking
Java Programming, Second Edition
Workshop for Programming And Systems Management Teachers
Presentation transcript:

Object-Oriented (Real World Case) Object-Oriented Analysis CIM2566 Bavy LI

Prepared by: Bavy LIOO (Real World Case)2 A way of viewing the world Suppose I wish to send flowers to a friend (Sally) who lives in a city many miles away. Solution 1: Pick up flowers and carry them to Sally ’ s door. (might be romantic, but not practical) Solution 2: I can go to Flora (my local florist), tell her the variety and quantity of flowers I wish to send, and give her Sally ’ s address.

Prepared by: Bavy LIOO (Real World Case)3 Agents and Communities The mechanism I used to solve my problem was to find an agent (Flora), and to pass to her a message containing my request. It is the responsibility of Flora to satisfy my request. There involves some methods (some algorithms or a set of operations) used by Flora to do this.

Prepared by: Bavy LIOO (Real World Case)4 Agents and Communities - 2 I do not need to know the particular method Flora will use to satisfy my request. This information is hidden from my inspection. If I investigated, however, I might discover that Flora delivers a slightly different messages to another florist in Sally ’ s city. That florist, in turn, perhaps has a subordinate who makes this “ floral arrangement ”.

Prepared by: Bavy LIOO (Real World Case)5 Agents and Communities - 3 The florist (in Sally ’ s city) then passes the flowers along with another message to a delivery person and so on. Earlier, the florist in Sally ’ s city had obtained her flowers from a flower wholesaler who, in turn, had interactions with the flower growers, each of whom had to manage a team of gardeners.

Prepared by: Bavy LIOO (Real World Case)6 The solution to my problem required the help of many other individuals. Without their help, my problem could not be easily solved. Me Flora Sally Delivery person Flower arranger Gardeners Growers Wholesaler Sally’s florist Agents and Communities - 4

Prepared by: Bavy LIOO (Real World Case)7 Agents and Communities - 5 An object-oriented program is structured as a community of interacting agents, called objects. Each object has a role to play. Each object provides a service, or performs an action, that is used by other members of the community.

Prepared by: Bavy LIOO (Real World Case)8 Messages and Methods My request to Flora initiated a chain reaction of requests until my flowers ultimately reached my friend. We see that members of this community interact with one another by making requests. Action is initiated (in object-oriented programming) by the transmission of a message to an agent (an object) responsible for the action.

Prepared by: Bavy LIOO (Real World Case)9 Messages and Methods - 2 The message encodes the request for an action and is accompanied by an additional information (arguments) needed to carry out the request. The receiver is the object to whom the message is sent.

Prepared by: Bavy LIOO (Real World Case)10 Messages and Methods - 3 If the receiver accepts the message, it accepts the responsibility to carry out the indicated action. In response to a message, the receiver will perform some methods to satisfy the request. The principle of information hiding: The client sending the request need not know the actual means by which the request will be honored.

Prepared by: Bavy LIOO (Real World Case)11 Messages and Methods - 4 A message has a designated receiver; the receiver is a particular object to which the message is sent. The interpretation of the message (the method used to respond to the message) is dependent on the receiver and can vary with different receivers. If I ask Kenneth, my dentist, to send flowers to my friend, he may not have a method for solving that problem. If he understands the request at all, he will probably issue an appropriate error diagnostic.

Prepared by: Bavy LIOO (Real World Case)12 Classes and Instances I have a rough idea of the behavior I can expect when I walk into Flora ’ s shop and present my request. I am able to make certain assumptions because I have general information about florists in general, and I expect that Flora (being an instance of this category) will fit the general pattern. We can use the term Florist to represent the category (or class) of all florists.

Prepared by: Bavy LIOO (Real World Case)13 Classes and Instances - 2 All objects are instances of a class. The method invoked by an object in response to a message is determined by the class of the receiver. All objects of a given class use the same method in response to similar messages.

Prepared by: Bavy LIOO (Real World Case)14 Class Hierarchies (Inheritance) I have more information about Flora because she is a shopkeeper. I know for example that I probably will be asked for money as part of the transaction, and in return for payment I will be given a receipt. These actions are true for other shopkeepers. Since the category Florist is a more specialized form of the category shopkeeper, any knowledge I have on Shopkeepers is also true of florists (and hence of Flora).

Prepared by: Bavy LIOO (Real World Case)15 Class Hierarchies (Inheritance) - 2 One way to think about how I have organized my knowledge of Flora is in terms of a hierarchy of categories: Flora is a Florist. Florist is a specialized form of Shopkeeper. Shopkeeper is a human, etc.

Prepared by: Bavy LIOO (Real World Case)16 Florist Flora Shopkeeper Human Class Hierarchies (Inheritance) - 3 The principle that knowledge of a more general category is also applicable to a more specific category is called inheritance. We say that the class Florist will inherit attributes of the class (or category) Shopkeeper.

Prepared by: Bavy LIOO (Real World Case)17 Mammal Human Artist Potter Liz Shopkeeper Florist Flora Dentist Kenneth Animal Plant Flower Carnation Sally’s flowers Material Object We can create a hierarchical tree-like structure, with more abstract Classes (such as Material object, or Animal) listed near the top of the tree. More specific classes, and finally individuals, are listed near the bottom. Flora (instance of Human) is also applicable to Liz. Duck Bobo

Prepared by: Bavy LIOO (Real World Case)18 Class Hierarchies (Inheritance) - 4 Information about all members of Material Object is equally applicable to Flora and to her Flowers. The idea of inheritance: Classes can be organized into a hierarchical inheritance structure. A child class (or subclass) will inherit attributes from a parent class (or superclass) higher in the tree. An abstract parent class (or interface) is the one (such as Mammal) for which there are no direct instances; it is used only to create subclasses.

Prepared by: Bavy LIOO (Real World Case)19 Method Binding, Overriding, and Exceptions Although Bobo is a Mammal, it presents a problem for our organizing structure, as Bobo lays eggs. To accommodate this variation, we need to find a technique to encode exceptions to a general rule. Information contained in a subclass can override information inherited from a parent superclass.

Prepared by: Bavy LIOO (Real World Case)20 Polymorphism and Information Hiding That my friend (Liz) and Flora will respond to my message by different methods is an example of polymorphism. That I do not, and I need not, know exactly what method Flora will use to honor my message is an example of information hiding.