LO#1 Understand the purpose of structure models.
LO#2 Understand and apply the building blocks for UML Class (structure) Diagrams.
LO#3 Describe multiplicities for a UML Class Diagram.
LO#4 Understand how to implement a relational database from a UML Class Diagram.
LO#5 Describe business rules and various forms of rules.
21 trang |
Chia sẻ: thuychi11 | Lượt xem: 498 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Kế toán doanh nghiệp - Chapter 3: Data modeling, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Chapter 3Data ModelingCopyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.Learning Objectives3-2LO#1 Understand the purpose of structure models.LO#2 Understand and apply the building blocks for UML Class (structure) Diagrams.LO#3 Describe multiplicities for a UML Class Diagram.LO#4 Understand how to implement a relational database from a UML Class Diagram.LO#5 Describe business rules and various forms of rules.Structure ModelsDescribe the data and information structures inherent in a business process Create a blueprint for the development of a relational database to support the collection, aggregation, and communication of process informationFacilitate the use of databases after they are implemented3-3LO# 1Unified Modeling Language (UML)UML class diagram notation for structure modelsSpecifications for UML maintained by the Object Management Group, a not-for-profit consortium of computer industry membersUML also includes notation for several other types of diagrams, including several structure diagrams, behavior diagrams, and interaction diagramsClass diagrams describe the logical structure of a database system3-4LO# 2UML Class Diagram – Building BlocksClasses are separately identifiable collections of things about which the organization wants to collect and store informationAssociations depict the relationship between two classes.Multiplicities describe the minimum and maximum number of times instances of one class can be associated with instances in another class3-5LO# 2UML Class Diagram - Classes3-6LO# 2Classes can represent organization resources (e.g., trucks, machines, buildings, cash, investments)persons (e.g., customers, employees) events (e.g., sales, purchases, cash disbursements, cash receipts), and conceptual structures (e.g., accounts, product categories, budgets)UML Class Diagram - AssociationsAssociations depict the (business) relationship between two classes3-7LO# 2UML Class Diagram - Multiplicities3-8Each Person owns a minimum of 0 and a maximum of many Autos. Each Auto is owned by a minimum of 1 and a maximum of 1 PersonLO# 2Multiplicities describe the minimum and maximum number of times instances in one class can be associated with instances in another classAttributesAttributes are data elements that describe the characteristics of instances in a class (or rows in a table)The full specification of attributes, i.e., a data dictionary, would also include data type, default value (if any), constraints on the value (such as minimum and maximum possible values), and other descriptive informationAttributes include the primary keys that uniquely define instances of the class, foreign keys that support the links between classes shown in the associations, and other data elements for each classAttributes will be specified in a table listing that accompanies each class diagram3-9LO# 2Primary KeysAn attribute or combination of attributes that uniquely identifies each instance in a class or row in a tableA primary key cannot be NULL (blank)A primary key should be controlled by the organization that assigns it so it will not change over time3-10LO# 2Foreign Keys3-11LO# 2An attribute or combination of attributes that allows tables to be linked togetherImplements the link between classes (and resulting tables) shown by the associationsIn the following model, the primary key of the PERSON class would become a foreign key in the AUTO class to implement the associationTable Listing - Example3-12LO# 2Best Practices in Preparing Class DiagramsUse common terminology in the organization for class namesLink classes on the diagram only when there is a clear business purpose for the relationship. Avoid crossing lines where possibleUse consistently sized class rectanglesAvoid running association lines close togetherOpt for simplicityFocus first on the accuracy of the content, then address appearance.Use notes to explain more complex situations. 3-13LO# 2Implementing a Database from a Class DiagramMap classes to tablesMap class attributes to table fields and assign primary keys Map associations to foreign keysCreate new tables to implement many-to-many relationshipsImplement relationships among tables following the class diagram3-14LO# 41. Map Classes to Tables3-15LO# 42. Map Class Attributes to Table Fields and Assign Primary Keys3-16LO# 43. Map one-to-many associations to foreign keys3-17One-to-many associations are defined by the maximum multiplicity on each end of the association. The rule of thumb is to go toward the * to post the foreign key. So, in the model above, the primary key of STATE would be a foreign key in AUTO; the primary key of PERSON would be also be a foreign key in AUTO. See Table 1 in Chapter 3 for a listing of posting rules based on multiplicities. LO# 34. Create New Tables to Implement Many-to-Many Relationships3-18Many-to-many associations require the creation of a new, linking table to implement the association. So, in the model above, the association between DEALERS and AUTO would be implemented with a new table DEALER-AUTO with a primary key formed as the combination of primary keys from the two classes.LO# 35. Implement Relationships Among Tables3-19LO# 3Business RulesSuccinct statement of constraints on a business processTypically written in text not modeled; however, they influence the structure and flow of models. Establish multiplicities in class models and set criteria for branching in activity models. Stated in short sentencesThe Object Management Group maintains standards for Semantics of Business Vocabulary and Business Rules (SBVR) since 2008Make modeling business process easier since they limit the number of options allowed by business policy3-20LO# 4Types of Business RulesObligatory. This rule form states what should occur: payment should be made in U. S. dollars. Prohibited: This rule form states what should not occur: no payments by check. Allowed: This rule form says what is allowed under what conditions: credit card payments are allowed if the card is American Express.3-21LO# 5