Presentation on theme: "An Introduction to Object Modeling An Introduction to Object Modeling The approach of using object modeling during systems analysis and design is called."— Presentation transcript:
An Introduction to Object Modeling An Introduction to Object Modeling The approach of using object modeling during systems analysis and design is called object-oriented analysis. Object-oriented analysis (OOA) techniques are used to (1) study existing objects to see if they can be reused or adapted for new uses, and to (2) define new or modified objects that will be combined with existing objects into a useful business computing application. The object-oriented approach is centered around a technique referred to as object modeling. Object modeling is a technique for identifying objects within the systems environment, and the relationships between those objects.
System Concepts for Object Modeling Objects, Attributes, Methods, and Encapsulation The object-oriented approach to system development is based on the concept of objects that exist within a system’s environment. Objects are everywhere Webster’s Dictionary definition of an object. Something that is or is capable of being seen, touched, or otherwise sensed. In object-oriented approaches to systems development the definition of an object is as follows: An object is something that is or is capable of being seen, touched, or otherwise sensed, and about which users store data and associate behavior.
System Concepts for Object Modeling Objects, Attributes, Methods, and Encapsulation The types of objects may include a person, place, thing, or event. An employee, customer, vendor, and student are examples of person objects. A particular warehouse, regional office, building, and room are examples of place objects. A product, vehicle, equipment, video tape, or a window appearing on a users display monitor are examples of thing objects. An order, payment, invoice, application, registration, and reservation are examples of event objects.
System Concepts for Object Modeling Objects, Attributes, Methods, and Encapsulation In the object-oriented circles, the term “data” refers to what are called attributes. Attributes are the data that represent characteristics of interest about an object. Example attributes for the person object called customer: CUSTOMER NUMBER, FIRST NAME, LAST NAME, HOME ADDRESS, WORK ADDRESS, TYPE OF CUSTOMER, HOME PHONE, WORK PHONE, CREDIT LIMIT, AVAILABLE CREDIT, ACCOUNT BALANCE, and ACCOUNT STATUS. Each individual customer object is referred to as an object instance. An instance (or object instance) of an object consists of the values for the attributes that describe a specific person, place, thing, or event.
System Concepts for Object Modeling Objects, Attributes, Methods, and Encapsulation What is the “behavior” of an object. Behavior refers to those things that the object can do and which 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 or service. An object is solely responsible for carrying out any functions or behaviors that act upon its own data (or attributes). For example, only YOU (an object) may CHANGE (behavior) your LAST NAME and HOME ADDRESS (attributes about you).
System Concepts for Object Modeling Objects, Attributes, Methods, and Encapsulation Encapsulation, an important concept. Encapsulation is the packaging of several items together into one unit. Both attributes and behavior of the object are packaged together. The only way to access an object's attributes is through that object’s behaviors. No other object may perform that object’s behavior.
System Concepts for Object Modeling Classes, Generalization, and Specialization An important concept of object modeling is the concept of categorizing objects into classes. A class is a set of objects that share common attributes and behavior. A class is sometimes referred to as an object class. For example, textbook and workbook objects represent thing- objects that have some similar attributes and behavior and could be classified as BOOKs. A class may also have sub-classes of objects. For example, STUDENT and TEACHER object classes could be members of the class PERSON.
System Concepts for Object Modeling Classes, Generalization, and Specialization When levels of classes are identified, the concept of inheritance is applied. Inheritance means that methods and/or attributes defined in an object class can be inherited or reused by another object class. The approach that seeks to discover and exploit the commonalties between objects/classes is referred to as generalization/specialization. Generalization/specialization is a technique wherein the attributes and behaviors that are common to several types of an object classes are grouped into their own class, called a supertype. The attributes and methods of the supertype object class are then inherited by those object classes.
System Concepts for Object Modeling Classes, Generalization, and Specialization When levels of classes are identified, the concept of inheritance is applied. Inheritance means that methods and/or attributes defined in an object class can be inherited or reused by another object class. In the object class PERSON, STUDENT and TEACHER example, PERSON is referred to as a supertype (or generalization class) whereas STUDENT and TEACHER are referred to as subtypes (or specialization class). A class supertype is an entity whose instances store attributes that are common to one or more class subtypes. A class subtype is an object class whose instances inherit some common attributes from a class supertype, and then add other attributes that are unique to an instances of the subtype.
System Concepts for Object Modeling Classes, Generalization, and Specialization The class supertype will have one or more one-to-one relationships to object class subtypes. These relationships are sometimes called “IS A” relationships (or “WAS A”, or “COULD BE A”) because each instance of the supertype “is also an” instance of one or more subtypes. Using OMT notation, classes are represented on an object model as a rectangle. The rectangle is divided into three portions. The top portion contains the name of the class. The middle portion contains the name of the common attributes of interest. The lower portion contains the common behavior (or methods).
System Concepts for Object Modeling Object/Class Relationships Objects and classes do not exist in isolation. The things they represent interact with, and impact one another to support the business mission. Thus there is an object/class relationship. An object/class relationship is a natural business association that exists between one or more objects/classes. For example, consider the object classes customer and order that may exist in a typical information system and how they interact. a CUSTOMER PLACES zero or more ORDERs an ORDER IS PLACED BY one and only one CUSTOMERs
System Concepts for Object Modeling Object/Class Relationships We graphically illustrate the association(relationship) between two classes as a connecting line. A verb phrase describes the relationship. All relationships are implicitly bi-directional, meaning that they can interpreted in both directions. What is multiplicity? Multiplicity defines the minimum and maximum number of occurrences of one object/class for a single occurrence of the related object/class. Because all relationships are bi-directional, multiplicity must be defined in both directions for every relationship.
System Concepts for Object Modeling Object/Class Relationships What are aggregation class relationships? Sometimes objects/classes are made up of other objects/classes. This type of relationship is called aggregation. It is also sometimes referred to as “whole-part” or “part-of” relationships. For example, the TEXTBOOK object may contain several objects, including: COVER, TABLE OF CONTENTS, CHAPTER, and INDEX objects. The CHAPTER object contains PAGE objects, which in turn contain PARAGRAPH objects, which in turn contain WORD objects, and so forth.
System Concepts for Object Modeling Object/Class Relationships By identifying aggregation relationships we can partition a very complex object and assign behaviors and attributes to the individual objects within it. Multiplicity is also specified for aggregate relationships.
System Concepts for Object Modeling Messages and Message Sending Objects/Classes interact or "communicate" with one another by passing messages. A message is passed when one object invokes another object's method (behavior) to request information or some action An object sending a message does not need to know how the receiving object is organized internally or how the behavior is to be accomplished, only that it responds to the request in a well- defined way.
System Concepts for Object Modeling Messages and Message Sending Polymorphism - What is it? Polymorphism means “many forms”. Applied to object- oriented techniques, it means that a behavior may be completed differently for different objects/classes. The requesting object knows the what service (or behavior) to request and from which object. However, the requesting object does not need to worry about how a behavior is accomplished.
The Process of Object Modeling Performing Object Oriented Analysis (OOA) The purpose of OOA is to gain a better understanding of the system and its functional requirements. OOA requires that we identify the objects, their data attributes, associated behavior, and relationships which support the required business system functionality. We perform object modeling to document the identified objects, the data and behavior they encapsulate, plus their relationships with other objects. Two general activities when performing object oriented analysis: Finding and identifying the business objects. Organizing the objects and identifying their relationships.
The Process of Object Modeling Finding And Identifying The Business Objects In trying to identify objects, many methodology experts recommend the technique of searching the requirements document or other associated documentation and underline the nouns which may represent potential objects. This could be a monumental task! There are just too many nouns. One of the more popular and successful approaches for finding and identifying objects, is a technique called Use Case Modeling developed by Dr. Ivar Jacobson. Use Case Modeling is the process of identifying and modeling business events, who initiated them, and how the system responds to them.
The Process of Object Modeling Finding And Identifying The Business Objects Use case modeling breaks down the entire scope of system functionality into many smaller statements of system functionality called use cases or business events. A use case a behaviorally related sequence of steps (a scenario), both automated and manual for the purpose of completing a single business task. This smaller format simplifies and makes more efficient the technique of underlining the nouns. It identifies and describes the system functions from the perspective of external users.
The Process of Object Modeling Finding And Identifying The Business Objects Use Cases are initiated by users or systems called Actors. An actor represents anything that needs to interact with the system to exchange information. An actor is a user, a role, which could be an external system as well as a person. An actor initiates system activity, a use case, for the purpose of completing some business task. An actor represents a role fulfilled by a user interacting with the system and is not meant to portray a single individual or job title. For events that are triggered by time called temporal events, the actor is the system itself.
The Process of Object Modeling Finding And Identifying The Business Objects Use cases provide the following benefits: As a basis to help identify objects and their high level relationships and responsibilities. A view of system behavior from external person’s viewpoint. An effective tool for validating requirements. An effective communication tool. As a basis for a test plan. As a basis for a user’s manual.
The Process of Object Modeling Finding And Identifying The Business Objects Step 1: Identifying Actors and Use Cases. A good place to find potential actors and use cases is by analyzing the context model diagram of the system. If an external party initiates the input, it is considered an actor. Some of the inputs are self explanatory, but others may be misleading, it is always wise to confirm your findings with the system’s business analyst.
The Process of Object Modeling Finding And Identifying The Business Objects Step 3: Documenting the Use Case Course of Events For each use case identified, use case’s normal course of events must be documented. A use case’s normal course of events is a step by step description starting with the actor initiating the use case until the end of the business event. At this point we only include the major steps which happen the majority of the time (its normal course). Exception conditions or conditional branching logic will be documented in a later step.
A B C D E F
The Process of Object Modeling Finding And Identifying The Business Objects Step 4: Identifying Use Case Dependencies. Some use cases may be dependent on other use cases, with one use case leaving the system in a state that is a precondition for another use case. We use a diagram called the Use Case Dependency Diagram to model dependencies.
The Process of Object Modeling Finding And Identifying The Business Objects Step 4: Identifying Use Case Dependencies. The use case dependency diagram provides the following benefits: A graphical depiction of the system’s events and their states enhances the understanding of system functionality. It helps to identify missing use cases. A use case with a precondition that is not satisfied by the execution of any other use case may indicate a missing use case. Helps facilitate project management by depicting which use cases are more critical (have the most dependencies) and thus need to have a higher priority.
The Process of Object Modeling Finding And Identifying The Business Objects Step 5: Documenting the Use Case Alternate Course of Events A use case has one normal event course that was previously defined, and possibly many alternate courses. Alternate courses are deviations or branches, from the normal event course. Alternate courses are documented in a separate use case course.
The Process of Object Modeling Finding And Identifying The Business Objects Step 6: Finding The Potential Objects. This step is accomplished by reviewing each use case to find nouns that correspond to business entities or events. Step 7: Selecting The Proposed Objects. Not all the of the nouns represent good business objects. Remove the nouns that represent: Synonyms Nouns outside the scope of the system Nouns that are roles without unique behavior or are external roles Unclear nouns that need focus Nouns that are really actions or attributes
The Process of Object Modeling Organizing The Objects and Identifying Their Relationships Once the business objects of the system have been identified, it is time to organize those objects and document any major conceptual relationships between the objects. An Object Association Model is used to graphically depict the objects and their relationships. This diagram will also include multiplicity, generalization/specialization relationships and aggregation relationships.
The Process of Object Modeling Organizing The Objects and Identifying Their Relationships Step 1: Identifying Associations and Multiplicity In this step we need to identify relationships or associations that exists between objects/classes. Recall that a relationship between two objects/classes is what one object/class “needs to know” about the other. Once the relationship have been identified, the multiplicity that governs the relationship must be defined.
The Process of Object Modeling Organizing The Objects and Identifying Their Relationships Step 2: Identifying Generalization/Specialization Relationships Generalization/Specialization relationships may be discovered by looking at the object model association diagram. Do any associations exist between two objects that have a one-to- one multiplicity? Can you say the sentence “object X is a object Y” and it be true? Do two or more objects have common attributes and behaviors? Why do we want generalization/specialization relationships? It allows us to take advantage of inheritance which facilitates the reuse of objects and programming code.
The Process of Object Modeling Organizing The Objects and Identifying Their Relationships Step 3: Identifying Aggregation Relationships In this step we must determine if any aggregation or composition relationships exist. Aggregation relationships are asymmetric, in that object B is part of Object A but, object A is not part of object B. Aggregation relationships do not imply inheritance, in that object B does not inherit behavior or attributes from object A. Aggregation relationships propagate behavior in that behavior applied to the whole is automatically applied to the parts.
The Process of Object Modeling Organizing The Objects and Identifying Their Relationships Step 4: Preparing The Object Association Model In this step construct the object association model diagram which depicts how the objects are related to each other and what type the relationships are.
Summary Introduction An Introduction to Object Modeling System Concepts for Object Modeling The Process of Object Modeling