class diagrams tutorial. conceptual class diagram-online bookstore an informal description "the...
TRANSCRIPT
![Page 1: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/1.jpg)
Class Diagrams
Tutorial
![Page 2: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/2.jpg)
Conceptual class diagram-Online Bookstore
• An Informal Description "The system is an online, web-based bookstore. The
bookstore sells books, music CDs, and software. Typically, a customer first logs on to the system, entering a customer ID and password. The customer can then browse for items or search by keyword(title, Author , Publisher, ISBN). The customer puts some of the items into a "shopping cart" which keeps track of the desired items. When the customer is done shopping, he/she confirms the order, shipping address, and billing address. The bookstore system then issues a shipping order, bills the customer, and issues an electronic receipt. At the end of the transaction, the customer logs off."
![Page 3: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/3.jpg)
Online Bookstore• A Scenario1. User logs on. 2. System displays welcome message and requests customer ID and password. 3. User enters customer ID and password. 4. System validates the ID and password. 5. User searches for a items by browsing or keyword search 6. System displays information about the title. 7. User selects a title to buy 8. System adds items to the customer's shopping cart 9. [Repeat 5-8 until done] 10. User is done with shopping 11. System displays shopping cart, shipping address, and billing address 12. User confirms order and payment method. 13. System processes order, notifies warehouse for shipping, and issues an electronic
receipt. 14. User logs
![Page 4: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/4.jpg)
Identify the classes
• Look for important nouns: Objects, people, organizations, places, events, concepts.
From the given scenario• OnLineBookstore, Customer, Book, MusicCD,
Software, order, shoppingCart are the classes
![Page 5: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/5.jpg)
Class Attributes
• Analyze the requirements to find the attributes of each class
• A Customer has a name, customerID, password, shippingAddress, and billingAddress.An Address has a street, city, state, country, and postalCode.
![Page 6: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/6.jpg)
Relationships• Analyze the requirements to find relationships between classes.• Draw relationships as lines between class boxes.• Annotate the relationships: How many OrderItems for each Order
are possible? • Use symbols to indicate the kind of relationship: Generic,
aggregation (has-a or owns-a), inheritance (is-a). • For generic relationships, use an arrowhead to indicate whether the
relationship is navigable: Does the source object know about the destination object?
• After identifying candidate classes, see if there are any commonalities between them that might be an IS-A relationship. It may make sense to factor the common parts into a super class, and create an inheritance relationship:
![Page 7: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/7.jpg)
Finding Relationships
![Page 8: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/8.jpg)
Class diagram
![Page 9: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/9.jpg)
Conceptual class diagram-Programming Language
Based on the following description of part of the syntax of a programming language, construct a class diagram showing the structure of programs written in the language and show the types of associations between the classes.
- A module consists of a collection of features. A feature can either be a variable, a routine or a nested module. Routines consist of a declaration part and a statement part. Features
local to the routine can be declared in the declaration part, and the statement part consists of a non-empty sequence of statements. Statements can be loops, conditionals or assignments, and each assignment contains a reference to the variable which is being assigned to.
![Page 10: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/10.jpg)
Identify the classes• Feature• Variable• Routine• Module• DeclarationPart• Statement Part• Statement• Loop• Conditional• Assignment
![Page 11: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/11.jpg)
SolutionClass diagram
![Page 12: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/12.jpg)
Hospital Information System• Informal Description • "The system is a hospital information system. A
hospital has doctors and patients. Each patient is assigned to one doctor, but a doctor can have any number of patients. Patients check in to the hospital and assigned a doctor if they don't already have one. While in the hospital, doctors record various observations about each patient at various times. Examples of observations are blood pressure and temperature. The hospital keeps track of all the observations for a given patient until they check out of the hospital."
![Page 13: Class Diagrams Tutorial. Conceptual class diagram-Online Bookstore An Informal Description "The system is an online, web-based bookstore. The bookstore](https://reader033.vdocument.in/reader033/viewer/2022061605/56649ea15503460f94ba4a43/html5/thumbnails/13.jpg)
Scenario
• Patient checks in to hospital. • Hospital assigns doctor to the patient. • The doctor records a blood pressure
measurement for the patient. • The doctor records a temperature for the
patient. • The doctor prescribes medicine for the patient's
condition. • The patient checks out of the hospital.