1 / 80

OO CONCEPTS Gregory Bors - Tel Aviv Systems Inc.

OBJECT ORIENTED CONCEPTS. OO CONCEPTS Gregory Bors - Tel Aviv Systems Inc. OO Analysis & Design using UML 6/2001. OO Analysis and Design Using UML Subjects. Object Oriented Concepts Modeling & UML Use Case Modeling

michon
Download Presentation

OO CONCEPTS Gregory Bors - Tel Aviv Systems Inc.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OBJECT ORIENTED CONCEPTS OO CONCEPTSGregory Bors - Tel Aviv Systems Inc. OO Analysis & Design using UML 6/2001

  2. OO Analysis and Design Using UML Subjects • Object Oriented Concepts • Modeling & UML • Use Case Modeling • Responsibility Driven Design & CRC • The Static Model • Behavioral Modeling • Design Principles • Architecture

  3. OO - Concepts • History, Bibliography • OO - Challenges • Object • Class • Encapsulation • Messages • Inheritance • Polymorphism

  4. Milestones in SoftwareDevelopment Technologies Structured Programming 1970 Structured Design 1975 Structured Analysis 1978-1980 Data Modeling 1978-1980 4GL 1980 OOP 1986 CASE 1986 OOAD 1990 OOAD with UML 1997

  5. The Disadvantages of theStructured Technologies Focus onFunctions HighMaintenanceCosts HighDevelopmentCosts RigidArchitecture RippleEffect Very LittleReuse TechnicalCenteredand NotUser Centered No ContinuityAmongAnalysisDesignProgrammingTesting

  6. Bibliography • Object-Oriented Software Construction (second edition): Bertrand Meyer. (Prentice Hall) 1997 • The Unified Modeling Language User Guide: Grady Booch, James Rumbaugh, Ivar Jacobson (Addison Weley) 1998 • Designing Object-Oriented Software: Rebecca Wirfs-Brock, Brian Wilkerson, Lauren Wiener. (Prentice Hall) 1990 • Object-Oriented Modeling and Design: James Rumbough, Michael Blaha, William Permerlani, Frederick Eddy, William Lorensen. (Prentice Hall) 1991 • Object-Oriented Software Engineering - A Use Case Driven Approach: Ivar Jacobson, Magnus Christerson, Patrik Jonsson, Gunnar Overgaard. (Addison Wesley) 1992 • Applying UML and Patterns (second edition): Craig Larman (Prentice Hall) 2001 • Design Patterns - Elements of Reusable Object-Oriented Software: Erich Gamma, Richard Helm, Ralph Johnson, Johan Vlissides.(Addison-Wesley) 1994 • Analysis Patterns: Martin Fowler (Addison-Wesley) 1997 • Internet News Group: comp.object

  7. OO - Concepts • History, Bibliography • OO - Challenges • Object • Class • Encapsulation • Messages • Inheritance • Polymorphism

  8. Maintainability = Harmony of Cause and Effect • Small Change in RequirementsSmall Change in the Software • Small Change in the SoftwareSmall Test to Verify it • Local MishapLocal Effect

  9. To Understand the User • What does he/she really need now? • What is reasonable to expect he/shewill need in the future?

  10. Reuse • Reusing analysis and design concepts • Reusing implementations

  11. Seamless Development • Object orientation enables a smooth and continuous transition among all the development phases

  12. OO - Concepts • History, Bibliography • OO - Challenges • Object • Class • Encapsulation • Messages • Inheritance • Polymorphism

  13. ObjectExample • This glass is an object • It can be • Broken • Filled • Emptied • Its height is 20 cm • It has a leg • It is half full

  14. ObjectExample (cont'd) • This cat is an object • It can • Jump • Run • Say: "meow” • Its color is gray • Its weight is 8 kg • It is a male

  15. ObjectExample (cont'd) • This watch is an object • It can • Display time • Set time • Sound alarm • Set alarm • Its weight is 50 gr. • It is water resistant • Its color is gold

  16. Operation / Behavior • It can • Jump • Run • Say: "meow” • It can be • Broken • Filled • Emptied • It can • Display time • Set time • Sound alarm • Set alarm

  17. Operation/Behavior Operation • What the object can do or what can be done to the object • An operation is one of the featuresof an object Behavior • The behavior of an object: all its operations

  18. Attribute • Its color is . . . • Its weight is . . . • It is a male or female • Its height is . . . • It has / has not a leg • It is x % full . • Its weight is . . . • It is / it is not water resistant • Its color is . . .

  19. Attribute • An attribute of an object describes one of the characteristics of the object • Attributes are features of an object

  20. Value/State • Its color is gray • Its weight is 8 kg • It is a male • Its height is 20 cm • It has a leg • It is half full • Its weight is 50 gr. • It is water resistant • Its color is gold

  21. Value/State • For a particular object, at a specific time,every attribute has a uniquevalue • The state of an object: the values of itsattributes at a given time

  22. An Object - The Whole Story • An object has • Attributes and values of attributes = state • Operations = behavior • An object is characterized by • Its state and behavior

  23. An Object - The Whole Story (cont’d) X A Window _ Behavior MoveSize Minimize MaximizeClose

  24. An Object - The Whole Story (cont’d) Behavior PointLeft ClickLeft Double-ClickRight Click

  25. Kinds of Objects • There are different kinds of objects • Concrete • Conceptual • Event and State

  26. Concrete Objects • These are solid, tangible kinds of objects, things you can grab hold of (be careful how you do that with people objects!) • Concrete objects are easily understood by both analysts and users

  27. Conceptual Objects • These are intangible and often far more difficult to grasp or understand

  28. Event and State Objects These are also highly abstract in nature They are related; an event of significance causes state changes A state can be regarded as a condition or a situation

  29. Object Identity • Every object has an identity • An object’s identity has no meaning beyond the fact that it identifies the object (it is not a name, it is not a key) • Another name for it: a handle • An object’s identity is not a function of its state • If two objects have the same state, they are nevertheless, two objects having two identities

  30. Created State 1 State 2 State 3 Destroyed Object Lifecycle

  31. OO - Concepts • History, Bibliography • OO - Challenges • Object • Class • Encapsulation • Messages • Inheritance • Polymorphism

  32. Class • Class • A group of objects with the same attributes and the same behavior • A class has a name • Class • The abstraction of similar objects • Classification • A process of assigning objects to classes

  33. Examples • Employee Class • Employment Class • Customer Class • Project Class • Strategy Class • Usage Record Class

  34. Object and Class • Every object of a class has the same attributes and the same behavior • But, every object has its own identity and,at a particular moment, is in a state specific to it • An object may be thought of as an instanceof a class

  35. Book State Example

  36. The Class-Object Relationship • A class is a model of its objects • The object uses the functions and the definitions of the class • A class is a Software Factory

  37. Representing Classes and Objects in Software • The whole Software Developmment Life Cycle • We use classes & objects during all the phases of the system development life cycle • A class is a module which defines a specific set of data (attributes) and functions (behavior) • An object is an instance and concrete expression of a class, with a particular state (values of the attributes) at any given moment • There are objects whose existence is limited to that of the lifetime of a transaction (transient objects) and there are objects which are saved in files (persistent objects)

  38. OO-ConceptsQuestions About Objects and Classes • Identify 2 classes that define concrete objectsand 2 classes that define conceptual objectsfrom the domain worlds of your projects • Choose one of the above classes that defineconcrete objects and write down some of itsattributes and some of its operations • Find 2-3 objects of this class and describe their state

  39. OO-ConceptsQuestions About Objects and Classes (cont’d) • Choose one of the classes you identified earlier that defines conceptual objects and write down some of its attributes and some of its operations • Find 2-3 objects of this class and describe their state • Is it possible that a particular class has, as one of its characteristics, only one object? If so, give an example and describe the difference between the class and the object

  40. OO- Concepts • History, Bibliography • OO - Challenges • Object • Class • Encapsulation • Messages • Inheritance • Polymorphism

  41. Encapsulation • Information hiding • All information regarding a module must be private, unless explicitly declared otherwise • Encapsulation • Implementation of information hiding in the world of objects • It is one of the central conceptsof the theory of object orientation

  42. ClassEmployee UpdateAddress Pay IDFirst Name Last NameAddressSalary UpdateSalary Hire Promote Retrieve Fire

  43. Encapsulation • Absolute separation of the implementation (which is hidden) and the interface, i.e. the rules of usage (which is public) • The environment is only aware of the interface

  44. Object Definition An object is an encapsulation of data and processes in such a way that mimics the real world

  45. Encapsulation of Operations Method Operations / Services

  46. Encapsulation of Operations (cont'd) • Operation = Service • Known to the surroundings • Expresses what the object can do for its clients(which may be other objects or human clients) • Method • The implementation of the service • Expresses how the object carries out the service • Note • An object in software is “wiser” than an object in reality • In software it can actively do things relating to itself, which in reality it only passively endures(in software, a glass can fill itself)

  47. Encapsulation of Data Attributes

  48. Encapsulation of Data (cont'd) • The representation of the attributes is hidden • There is no direct access to data,only via operations • Clients of the object’s services only know the signature of the service: the syntax and the semantics of the interface

  49. OO-ConceptsQuestions About Encapsulation • Write down at least 3 advantages of encapsulation • Identify disadvantages and some problems • I have a class: Date • One of the services of this class: Show day in year • This service shows the date in the following format: yyddd • In what format does the class save the datein the database?

  50. OO-ConceptsQuestions About Encapsulation (cont’d) • One of the components of our software is a class named HumanResources • It has persistent objects, each one of them with data about the employees of the company • I was asked to produce an urgent report for management regarding the number of employees below the age of 25 • The class has no service which can provide such an answer • The programmer in charge of the class is on vacation in Damascus • I found out the layout of the employees‘ file and wrote a little program of 15 instructions which reads the file sequentially and by looking at the date-of-birth of each employee produced the report for management • Am I OK? • Should I be promoted or fired?

More Related