Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 51 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
51
Dung lượng
725 KB
Nội dung
Object Modeling Introduction The chapter will address the following questions: What is object modeling and what are its benefits? What are the basic concepts and constructs of an object model? How you read and interpret an object model? What is data modeling in the context of systems analysis? How you discover objects and classes, and their relationships? How you construct an object model? Object Modeling An Introduction to Object Modeling An Introduction to Object Modeling The approach of using object modeling during systemsanalysisanddesign 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 Object Modeling 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 Object Modeling 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 Object Modeling 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 Object Modeling 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 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) Object Modeling 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 Object Modeling 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 thingobjects 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 Object Modeling 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 andmethods of the supertype object class are then inherited by those object classes Object Modeling 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 10 Object Modeling Member Services System Use Case Dependency Diagram depends on Send Subscription Renewal Offer depends on Create New Subscription Program Subscription Renewal depends on Request Membership Rpts depends on Send New Subscription Offer Submit New Subscription Request Promotion Rpts Request Sales Rpts Create New Seasonal Promotion depends on depends on OR depends on Send Club Promotion Submit Promotion Order Create New Monthly Promotion 37 Submit Regular Order Object Modeling 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 38 Object USE Modeling CASE Author: L Bentley USE CASE NAME: ACTOR: DESCRIPTION: NORMAL COURSE: Date:_ 10/02/96 Submit Promotion Order Club Member Describes the process when a club member submits a club promotion order to either indicate the products they are interested in ordering or declining to order during this promotion This use case is initiated when the club member submits the promotion order to be processed The club member’s personal information such as address is validated against what is currently recorded in member services The promotion order is verified to see if product is being ordered The club member’s credit status is checked with Accounts Receivable to make sure no payments are outstanding For each product being ordered, validate the product number For each product being ordered, check the availability in inventory and record the ordered product information which include “quantify being ordered” and give each ordered product a status of “open” Create a Picking Ticket for the promotion order containing all ordered products which have a status “open” Route the Picking Ticket to the Warehouse ALTERNATE COURSE: PRE-CONDITION: POST-CONDITION: If the club member has indicated an address or telephone number change on the promotion order, update the club member’s record with the new information If the club member is not ordering product at this time, modify the promotion order’s status to be “closed” and modify the selection of the month ordered product’s record to have a status of “rejected”, then cancel the transaction If Accounts Receivable returns a credit status that the customer is in arrears, invoke abstract use case Send Order Rejection Notice Modify the promotion order’s status to be “on hold pending payment” 5a If the product number is not valid, create an Order Error Report containing the club member’s information, the promotion order information and the product number in error Each completed report will be routed to a Member Services clerk for resolution 5b If the club member is not ordering the selection of the month, modify the ordered product’s record to have a status of “rejected” If the product being ordered is not available, record the ordered product information which include “quantify being ordered” and give a status of “backordered” If there are no ordered product records with a status of “open”, cancel the transaction Use case Send Club Motion has been processed Promotion order has been recorded and the Picking Ticket has been routed to the Warehouse ASSUMPTIONS: 39 Object Modeling 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 40 ObjectUSEModeling CASE Author: L Bentley USE CASE NAME: ACTOR: DESCRIPTION: NORMAL COURSE: Date: 10/05/96_ Submit Promotion Order Club Member Describes the process when a club member submits a promotion order to either indicate the products they are interested in ordering or declining to order during this promotion This use case is initiated when the club member submits the promotion order to be processed The club member’s personal information such as address is validated against what is currently recorded in member services The promotion order is verified to see if product is being ordered The club member’s credit status is checked with Accounts Receivable to make sure no payments are outstanding For each product being ordered, validate the product number For each product being ordered, check the availability in inventory and record the ordered product information which include “quantify being ordered”, and give each ordered product a status of “open” Create a Picking Ticket for the promotion order containing all ordered products which have a status “open” Route the Picking Ticket to the Warehouse ALTERNATE COURSE: PRE-CONDITION: POST-CONDITION: If the club member has indicated an address or telephone number change on the promotion order, update the club member’s record with the new information If the club member is not ordering product at this time, modify the promotion order’s status to be “closed” and modify the selection of the month ordered product’s record to have a status of “rejected”, then cancel the transaction If Accounts Receivable returns a credit status that the club member is in arrears, invoke abstract use case Send Order Rejection Notice Modify the promotion order’s status to be “on hold pending payment” 5a If the product number is not valid, create an Order Error Report containing the club member’s information, the promotion order information and the product number in error Each completed report will be routed to a Member Services clerk for resolution 5b If the club member is not ordering the selection of the month, modify the ordered product’s record to have a status of “rejected” If the product being ordered is not available, record the ordered product information which include “quantify being ordered” and give a status of “backordered” If there are no ordered product records with a status of “open”, cancel the transaction Use case Send Club Motion has been processed Promotion order has been recorded and the Picking Ticket has been routed to the Warehouse ASSUMPTIONS: 41 Object Modeling POTENTIAL OBJECT LIST Club Member Potential Member Past Member Member Services Department Marketing Department Member Services System Member Address Promotion order Product Product Inventory Order Quantity Ordered Product Credit Status Payments Ordered Product Status Picking Ticket Warehouse Member Telephone Number Selection Of Month Transaction Accounts Receivable Promotion Order Status Order Error Report Member Services Clerk 42 Object Modeling POTENTIAL OBJECT LIST Club Member Potential Member Past Member Member Services Department Marketing Department Member Services System Member Address Promotion order Product Product Inventory Order Quantity Ordered Product Credit Status Payment Ordered Product Status Picking Ticket Warehouse Member Telephone Number Selection Of Month Transaction Accounts Receivable Promotion Order Status Order Error Report Member Services Clerk REASON Type of “MEMBER” Type of “MEMBER” Type of “MEMBER” Not relevant for current project Not relevant for current project Not relevant for current project Attribute of “MEMBER” Result of an event named “PROMOTION” Type of “MEMBER ORDER” “PRODUCT” Attribute of “PRODUCT” Attribute of “MEMBER ORDER” “PRODUCT ON ORDER” Attribute of “MEMBER” Out of Scope Attribute of “PRODUCT ON ORDER” Potential interface item Not relevant for current project Attribute of “MEMBER” Type of “TITLE” Not relevant for current project Not relevant for current project Attribute of “MEMBER ORDER” Potential interface item Not relevant for current project 43 Object Modeling PROPOSED OBJECT LIST MEMBER MEMBER ORDER PRODUCT PRODUCT ON ORDER TITLE PROMOTION PLUS MERCHANDISE AUDIO TITLE VIDEO TITLE GAME TITLE CLUB CLUB MEMBERSHIP AGREEMENT 44 Object Modeling 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 45 Object Modeling 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 46 Object Modeling 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-toone 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 we want generalization/specialization relationships? • It allows us to take advantage of inheritance which facilitates the reuse of objects and programming code 47 Object Modeling 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 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 48 Object Modeling 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 49 Object Modeling MEMBER SERVICES INFORMATION SYSTEM HIGH LEVEL OBJECT MODEL PRODUCT ON ORDER MEMBER ORDER sells MEMBER placed 1+ sold as enrolls in 1+ PRODUCT CLUB MEMBERSHIP sponsors binds is a MERCHANDISE TITLE PROMOTION CLUB sponsors generates AGREEMENT establishes 1+ is a AUDIO TITLE VIDEO TITLE GAME TITLE 50 Object Modeling Summary Introduction An Introduction to Object Modeling System Concepts for Object Modeling The Process of Object Modeling 51 ... 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... 0256102219 type = workbook title = Projects and Cases to Accompany SADM copyright = 1996 ISBN = 0256101329 type = textbook title = Systems Analysis & Design Methods copyright = 1996 (b) Person Class... identifying objects within the systems environment, and the relationships between those objects Object Modeling System Concepts for Object Modeling Objects, Attributes, Methods, and Encapsulation