Presentation is loading. Please wait.

Presentation is loading. Please wait.

Jan 2005Ron McFadyen 92.39131 Qualified Associations ProductCatalogueProductDescription A one to many association can be altered in a diagram to a one.

Similar presentations


Presentation on theme: "Jan 2005Ron McFadyen 92.39131 Qualified Associations ProductCatalogueProductDescription A one to many association can be altered in a diagram to a one."— Presentation transcript:

1 Jan 2005Ron McFadyen 92.39131 Qualified Associations ProductCatalogueProductDescription A one to many association can be altered in a diagram to a one to one if there is an appropriate qualifier that identifies exactly one itemID is an attribute of ProductDescription that uniquely identifies an instance *1 ProductCatalogueProductDescription 1 1 itemID contains

2 Jan 2005Ron McFadyen 92.39132 Singleton Classes Random For some classes, it will be planned to only ever instantiate one object from that class Indicate this with a “1” in the upper righthand corner Later we will discuss the Singleton Pattern. 1

3 Jan 2005Ron McFadyen 92.39133 Interface classes AlarmClock An interface class is a collection of methods. We can use these to indicate that other classes implement the methods specified in the interface class attach() detach() notify() « interface » Subject

4 Jan 2005Ron McFadyen 92.39134 Aggregation and Composition both are associations used to denote that an object from one class is part of an object of another class HonoursProgrammeCourse An example of Aggregation: a course is part of an honours programme. The same module could be part of several honours courses “Software Engineering with Objects and Components” is part of both the “Software Engineering” and the “Computer Science” honours programmes **

5 Jan 2005Ron McFadyen 92.39135 Aggregation and Composition BoardSquare Composition is similar to, but stronger than aggregation. If you specify composition, then you are saying that one object owns its parts. A Board is made up of several Squares. A Square will belong to just one Board. If a Board is deleted, then its Squares are deleted too. What is the multiplicity at the composition end of the association? * Note: the 3 rd edition suggests not using Aggregation, instead us Composition if the business rules suggest it

6 Jan 2005Ron McFadyen 92.39136 Aggregation and Composition InvoiceInvoiceLine Consider Invoices and their Invoice Lines Question: Is the association aggregation or composition? ? ? *

7 Jan 2005Ron McFadyen 92.39137 Aggregation and Composition SaleSalesLineItem Consider Sales and their SalesLineItems Is the association an aggregation or a composition? ? ? *

8 Jan 2005Ron McFadyen 92.39138 Aggregation and Composition Consider the Product Catalogue and its Product Specifications. Is the association an aggregation or a composition? Consider the General Calendar and its Course Specifications. Is the association an aggregation or a composition?

9 Jan 2005Ron McFadyen 92.39139 Aggregation and Composition Hand Finger Palm Thumb 0..7 0..1 Several associations sharing the same aggregation/composition can be drawn with converging lines

10 Jan 2005Ron McFadyen 92.391310 Aggregation and Composition Suppose a document comprises a TOC, a preface, a number of sections, and possibly an index. composition or aggregation?

11 Jan 2005Ron McFadyen 92.391311 Association Class Business rule: a store has a different merchant ID for each service Association Class: a modeling element that is both an association and a class. It has attributes, operations, multiplicities, etc. It can participate in other relationships.

12 Jan 2005Ron McFadyen 92.391312 Many to many associations likely candidate for an Association Class Limitation !!! each company object can be associated to a person object only once. If we wanted to provide for a person to be employed by the same company more than once, we would need to promote Employment to be a regular class. How do we model this?

13 Jan 2005Ron McFadyen 92.391313 Reflexive Association An association involving the same class more than once. marries Person 1 1

14 Jan 2005Ron McFadyen 92.391314 Reflexive Association An association involving the same class more than once. marries Person * *

15 Jan 2005Ron McFadyen 92.391315 Contrasting two models Can be very accurate: one person plays more than one role More difficult to implement: may need to mutate an object from one class to another

16 Jan 2005Ron McFadyen 92.391316 Packages Packages are used to organize model elements. name


Download ppt "Jan 2005Ron McFadyen 92.39131 Qualified Associations ProductCatalogueProductDescription A one to many association can be altered in a diagram to a one."

Similar presentations


Ads by Google