200 likes | 220 Views
310414 SOFTWARE ENGINEERING. OBJECT-ORIENTED MODELING WITH UML — QUESTIONS & EXAMPLES. QUESTION? . If you had to draw a map of the area around HKUST to explain to someone how to get to BUU from Chonburi , what is the one most important thing you would include?. roads.
E N D
310414SOFTWARE ENGINEERING OBJECT-ORIENTED MODELING WITH UML — QUESTIONS & EXAMPLES
QUESTION? If you had to draw a map of the area around HKUST to explain to someone how to get to BUU from Chonburi, what is the one most important thing you would include? • roads. • land topology (e.g., contours showing elevation above sea level. • historical sites to see (e.g., the BS beach). • the types and places of vegetation (i.e., trees and other types of plants). • location of hiking trails. • bus routes.
QUESTION? If you had to draw a map of the area around BUU to explain to someone how high the Academic Building is above sea level, what is the one most important thing you would include? • roads. • land topology (e.g., contours showing elevation above sea level. • historical sites to see (e.g., the HKUST beach). • the types and places of vegetation (i.e., trees and other types of plants). • location of hiking trails. • bus routes.
QUESTION? Consider the relationship between files and directories in a computer system. Which type(s) of abstraction models this relationship? • classification only • aggregation only • generalization only • classification and aggregation • aggregation and generalization • classification and generalization • classification, aggregation and generalization • none of the above
QUESTION? Which type of abstraction relates objects and classes? • classification only • aggregation only • generalization only • classification and aggregation • aggregation and generalization • classification and generalization • classification, aggregation and generalization • none of the above (this is not a type of abstraction)
QUESTION? Which type of abstraction relates objects and classes? • apply classification abstraction to objects to form classes IS_MEMBER_OF relationship
QUESTION? Which type of abstraction relates attributes and classes? • classification only • aggregation only • generalization only • classification and aggregation • aggregation and generalization • classification and generalization • classification, aggregation and generalization • none of the above (this is not a type of abstraction)
Course QUESTION? • apply aggregation abstraction to attributes to form classes Which type of abstraction relates attributes and classes? IS_PART_OF relationship course# name instructor prerequisite
The coverage of the generalization shown above is: • overlapping, complete • disjoint, complete • overlapping, incomplete • disjoint, incomplete Payment Cash CreditCard DebitCard QUESTION? What is the policy of the organization?
Customer Individual Company The coverage of the generalization shown above is: • overlapping, complete • disjoint, complete • overlapping, incomplete • disjoint, incomplete QUESTION?
QUESTION? Which type of abstraction relates links and associations? • classification only • aggregation only • generalization only • classification and aggregation • aggregation and generalization • classification and generalization • classification, aggregation and generalization • none of the above (this is not a type of abstraction)
University Person QUESTION? • apply classification abstraction to links to form associations Which type of abstraction relates links and associations? WorksFor
QUESTION? • apply aggregation abstraction to classes to form associations Which type of abstraction relates links and associations? WorksFor Person University
Has ServiceOrder ServiceCall Takes ServiceAgent ServiceOrder WaitsFor ServiceOrder Part ComposedOf Product Part QUESTION? What is the most likely multiplicity of the following associations? 1 0..* 1 0..* * * 1..* 1..*
Meets Day Course Classroom • for each (course, classroom) • for each (course, day) • for each (classroom, day) QUESTION? * 0..3 0..1 0, 1, 2 or 3 days 0 or 1 classrooms many courses
EXAMPLE The classes shown have some attributes that are internal object identifiers (OIDs) that should not appear at the conceptual level and should either be deleted or be replaced with relationships. All such attributes conveniently have names ending in ID. Some further information about the application follows. A person may work for any number of companies. Persons, companies, or banks may own cars. The car owner ID represents either the person, company, or bank who owns the car. A car may have only one owner (person, company, or bank). A car loan given by a bank is for the purchase of a car. A car may have multiple car loans. Prepare a class diagram in which the OIDs are either deleted or replaced with relationships. Use associations and generalizations as necessary. Show the most likely multiplicities for all associations and the final attributes for each class. Note: Your final class diagram should contain no OIDs.
Person Car CarLoan name age employer1ID employer2ID employer3ID personID address ownerID vehicleID ownerType model year vehicleID customerType customerID accountNumber bankID interestRate currentBalance Company Bank name companyID name bankID EXAMPLE
Owner 1 * Owns name 1 {disjoint, complete} Car model year WorksFor * * IsFor Company * CarLoan * {incomplete} Lends 1 accountNumber interestRate currentBalance Bank Person age address EXAMPLE SOLUTION It is important to realize that some IDs represent associations while others are simply internal OIDs and so should not appear as attributes at all.
EXAMPLE Construct a class diagram for the classes listed below. Use association, aggregation and generalization relationships as necessary. Show the multiplicity for all relationships. file system drive file directory sector ASCII file disk executable file track
EXAMPLE SOLUTION ResidesOn * 1..* File system Drive can also be aggregation (e.g., floppy, removable) 1..* 1..* * File Disk 1..* Track Directory Executable ASCII 1..* Sector