550 likes | 1.26k Views
Object Modeling OBJECT-ORIENTED ANALYSIS AND MODELING USING THE UML Read: Chapter 6. Dr Manolya Kavakli Department of Computing Macquarie University Sydney, Australia. Chapter Objectives . Explain how object-oriented analysis can be used to describe an information system
E N D
Object ModelingOBJECT-ORIENTED ANALYSIS AND MODELING USING THE UMLRead: Chapter 6 Dr Manolya Kavakli Department of Computing Macquarie University Sydney, Australia
Chapter Objectives • Explain how object-oriented analysis can be used to describe an information system • Define object modeling terms and concepts, including objects, attributes, methods, messages, classes, and instances • Explain relationships among objects and the concept of inheritance • Draw an object relationship diagram
Chapter Objectives • Describe Unified Modeling Language (UML) tools and techniques, including use cases, use case diagrams, class diagrams, sequence diagrams, state transition diagrams, and activity diagrams • Explain the advantages of using CASE tools in developing the object model • Explain how to organize an object model
Introduction • You learn about object-oriented analysis, which is another way to view and model system requirements • You use object-oriented methods to document, analyze, and model the information system
Introduction to Object Modeling Object-oriented analysis (OOA) an approach used to • study existing objects to see if they can be reused or adapted for new uses • define new or modified objects that will be combined with existing objects into a useful business computing application Object modeling – a technique for identifying objects within the systems environment and the relationships between those objects.
Overview of Object-Oriented Analysis • Object-oriented analysis is a popular approach • sees a system from the viewpoint of the objects themselves as they function and interact
Overview of Object-Oriented Analysis • Object-Oriented Terms and Concepts • Unified Modeling Language (UML) • Attributes • Methods • Message • Class • Instance
Objects, Attributes, & Instances Object – something that is or is capable of being seen, touched, or otherwise sensed, and about which users store data and associate behavior. • Person, place, thing, or event • Employee, customer, instructor, student • Warehouse, office, building, room • Product, vehicle, computer, videotape Attribute – the data that represent characteristics of interest about an object. Object instance – each specific person, place, thing, or event, as well as the values for the attributes of that object.
Overview of Object-Oriented Analysis • Objects
Overview of Object-Oriented Analysis • Objects
Overview of Object-Oriented Analysis • Objects
Overview of Object-Oriented Analysis • Objects
Overview of Object-Oriented Analysis • Attributes • If objects are similar to nouns, attributes are similar to adjectives that describe the characteristics of an object • Some objects might have a few attributes; others might have dozens • State: • Describes the objects current status
Overview of Object-Oriented Analysis • Methods • A method defines specific tasks that an object can perform • Just as objects are similar to nouns and attributes are similar to adjectives, methods resemble verbs that describe what and how an object does something
Method (Behavior) & Encapsulation Behavior – the set of things that the object can do that correspond to functions that act on the object’s data (or attributes). • In object-oriented circles, an object’s behavior is commonly referred to as a method, operation, or service. • For object “order”: • Addorder • Deleteorder • modifyorder
Overview of Object-Oriented Analysis • Polymorphism: • The same message to two different objects can produce`the same result. • Black box: • A messages triggers changes within the object without specifying how the changes must be carried out. • E.g., Gas pump • Blackbox is an example of Encapsulation: • All data and methods are self-contained. • The object prevents its internal code from being altered by another object.
Overview of Object-Oriented Analysis • Messages • A major advantage of O-O designs is that systems analysts can save time and avoid errors by using modular objects, and programmers can translate the designs into code, working with reusable program modules that have been tested and verified • These objects could be used by other schools
Overview of Object-Oriented Analysis • Classes • An object belongs to a group or category called a class • All objects within a class share common attributes and methods • Subclasses • Superclass
Overview of Object-Oriented Analysis • Classes
Relationships Among Objects and Classes • Inheritance: • enables a child object to derive attributes from a parent object. • Child • Parent
Relationships Among Objects and Classes • Object Relationship Diagram: • provides an overview of the system.
UML Unified Modeling Language (UML) – a set of modeling conventions that is used to specify or describe a software system in terms of objects. • The UML does not prescribe a method for developing systems— • only a notation that is now widely accepted as a standard for object modeling. • DFDs model data and processes • UML describes OO systems
Object/Class Relationships Object/classrelationship – a natural business association that exists between one or more objects and classes.
Aggregation Aggregation – a relationship in which one larger “whole” class contains one or more smaller “parts” classes. Conversely, a smaller “part” class is part of a “whole” larger class.
Composition Composition – an aggregation relationship in which the “whole” is responsible for the creation and destruction of its “parts.” If the “whole” were to die, the “part” would die with it.
Messages Message – communication that occurs when one object invokes another object’s method (behavior) to request information or some action
Object Modeling with the Unified Modeling Language • The UML uses a set of symbols to represent graphically the various components and relationships within a system • It mainly is used to support object-oriented systems analysis and to develop object models
Object Modeling with the Unified Modeling Language • Use Case Modeling • Actor • Symbol for a use case is an oval with a label that describes the action or event • Use cases also can interact with other use cases
Object Modeling with the Unified Modeling Language • Use Case Modeling • When the outcome of one use case is incorporated by another use case, we say that the second case uses the first case • Use case description • When you identify use cases, try to group all the related transactions into a single use case
Object Modeling with the Unified Modeling Language • Use Case Diagrams • Use case diagram • System boundary • After you identify the system boundary, you place the use cases on the diagram, add the actors, and show the relationships
Object Modeling with the Unified Modeling Language • Class Diagrams • Class Diagram • Evolves into a physical model and finally becomes a functioning information system • Each class appears as a rectangle, with the class name at the top, followed by the class’s attributes and methods • Cardinality
Object Modeling with the UML • Class Diagrams: represents a detailed view of a single use case • Show classes and their relationships
Object Modeling with UML • Sequence Diagrams: dynamic model of a use case, showing the interaction over time • Sequence diagram • Include symbols such as: • Classes • Lifelines: duration of interaction • X: end of lifeline • Messages • Focuses: indicate when an object sends/receives messages
Object Modeling with the Unified Modeling Language • State Transition Diagrams: show how an object changes from one state`to another, depending on events
Object Modeling with the Unified Modeling Language • State Transition Diagrams • The small circle to the left is the initial state, or the point where the object first interacts with the system • Reading from left to right, the lines show direction and describe the action or event that causes a transition from one state to another • The circle at the right with a hollow border is the final state
Object Modeling with the Unified Modeling Language • Activity Diagrams: resembles a horizontal flowchart that shows the actions and events as they occur
Object Modeling with the Unified Modeling Language • Activity Diagrams • Sequence diagrams, state transition diagrams, and activity diagrams are dynamic modeling tools that can help a systems analyst understand how objects behave and interact with the system
Object Modeling with the Unified Modeling Language • CASE Tools • Object modeling requires many types of diagrams to represent the proposed system • Creating the diagrams by hand is time-consuming and tedious, so systems analysts rely on CASE tools to speed up the process and provide an overall framework for documenting the system components
UML http://www.youtube.com/watch?v=2yoahl1Hf5U&feature=related • MicroSoft Visio • http://www.youtube.com/watch?v=gCMWCBLl7Q4&feature=related • http://www.youtube.com/watch?v=xmDjmm0btO8&feature=related
Organizing the Object Model • You should develop an object relationship diagram that provides an overview of the system • You should organize your use cases and use case diagrams so they can be linked to the appropriate class, state transition, sequence, and activity diagrams • It is much easier to repair a diagram now than to change the software later
Modeling the Functions of the System The following steps evolve the requirements use-case model into an analysis use-case model: • Identify, define, and document new actors. • Identify, define, and document new use cases. • Identify any reuse possibilities. • Refine the use-case model diagram (if necessary). • Document system analysis use-case narratives. System analysis use case – a use case that documents the interaction between the system user and the system. It is highly detailed in describing what is required but is free of most implementation details and constraints.
Modeling Use-Case Activities Activity diagram – a diagram that can be used to graphically depict the flow of a business process, the steps of a use case, or the logic of an object behavior (method). • One or more activity diagram can be constructed for each use case (more than one if use case is long or contains complex logic). • Solid dot represents the start of the process. • A rounded-corner rectangle represents an activity or task that needs to be performed. • Arrows depict triggers that initiate activities. • A solid black bar is a synchronization bar that allows you to depict activities that occur in parallel.
Finding and Identifying the Business Objects • Find the Potential Objects • Review each use case to find nouns that correspond to business entities or events. • Select the Proposed Objects • Not all nouns represent business objects. • Ask: • Is the candidate a synonym of another object? • Is the candidate outside the scope of the system? • Is the candidate a role without unique behavior, or is it an external role? • Is the candidate unclear or in need of focus? • Is the candidate an action or an attribute that describes another object?