Download presentation
Presentation is loading. Please wait.
Published byBlanche Burns Modified over 8 years ago
1
03/12/2001 © Bennett, McRobb and Farmer 2002 Refining the Requirements Model Based on Chapter 8 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design Using UML, (2 nd Edition), McGraw Hill, 2002.
2
© Bennett, McRobb and Farmer 2002 2 In This Lecture You Will Learn: n What is meant by a component n How generalization and aggregation help to develop reusable components n How to identify generalization and composition n How to model generalization and composition n What is meant by the term pattern n What types of patterns can be used in software development
3
© Bennett, McRobb and Farmer 2002 Component-based Development n Component-based development means either: –Assembling software from pre-existing components, or –Building components for others to use n Why are components hard? –The NIH (Not-Invented-Here) syndrome –Model organization
4
© Bennett, McRobb and Farmer 2002 Component-based Development n The contribution of object-orientation: –Encapsulation of internal details makes it easier to use components in systems for which they were not designed –Generalization hierarchies make it easier to create new specialized classes when they are needed –Composition and aggregation structures can be used to encapsulate components
5
© Bennett, McRobb and Farmer 2002 Composition and Aggregation n Special types of association, both sometimes called whole–part n A campaign is made up of adverts: Campaign Advert 0..*1 Unfilled diamond signifies aggregation
6
© Bennett, McRobb and Farmer 2002 Composition and Aggregation n Aggregation is essentially any whole– part relationship n Semantics can be very imprecise n Composition is ‘stronger’: –Each part may belong to only one whole at a time –When the whole is destroyed, so are all its parts
7
© Bennett, McRobb and Farmer 2002 Composition and Aggregation n An everyday example n Clearly not composition –Students could be in several classes –If class is cancelled, students are not destroyed! Class Student 0..*1..*
8
© Bennett, McRobb and Farmer 2002 Composition and Aggregation n Another everyday example n This is (probably) composition –Ingredient is in only one meal at a time –If you drop your dinner on the floor, you probably lose the ingredients too Meal Ingredient 1..*1 Filled diamond signifies composition
9
© Bennett, McRobb and Farmer 2002 Adding Structure n Add generalization structures when –Two classes are similar in most details, but differ in some respects –May differ n In behaviour (operations or methods) n In data (attributes) n In associations with other classes
10
© Bennett, McRobb and Farmer 2002 Adding Structure n Two types of staff: Have qualifications recorded Can be client contact for campaign Bonus based on campaigns they have worked on Creative Admin Qualifications are not recorded Not associated with campaigns Bonus not based on campaign profits
11
© Bennett, McRobb and Farmer 2002 Adding Structure calculateBonus( ) StaffMember {abstract} staffName staffNo staffStartDate calculate Bonus( ) assignNewStaffGrade( ) getStaffDetails( ) CreativeStaff qualification assignStaffContact( ) AdminStaff calculateBonus( )
12
© Bennett, McRobb and Farmer 2002 Software Development Patterns A pattern n “describes a problem which occurs over and over again in our environment, and then describes the core of a solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” Alexander et al. (1977)
13
© Bennett, McRobb and Farmer 2002 Software Development Patterns n A pattern has –A context—a set of circumstances or preconditions for the problem to occur –Forces—the issues that must be addressed –A software configuration—that resolves the forces
14
© Bennett, McRobb and Farmer 2002 Software Development Patterns n Patterns are found at many points in the systems development lifecycle –Analysis patterns are groups of concepts useful in modelling requirements –Architectural patterns describe the structure of major components of a software system –Design patterns describe the structure and interaction of smaller software components
15
© Bennett, McRobb and Farmer 2002 Software Development Patterns n Patterns have been applied widely in software development –Organization patterns describe structures, roles and interactions in the software development organization itself n Antipatterns document bad practice –Mushroom Management is an organization antipattern
16
© Bennett, McRobb and Farmer 2002 6.2 The Abstraction-Occurrence Pattern –Context: n Often in a domain model you find a set of related objects (occurrences). n The members of such a set share common information –but also differ from each other in important ways. –Problem: n What is the best way to represent such sets of occurrences in a class diagram? – Forces: n You want to represent the members of each set of occurrences without duplicating the common information
17
© Bennett, McRobb and Farmer 2002 Abstraction-Occurrence Abstraction-Occurrence –Solution: TVSeries seriesName producer Episode number title storySynopsis ****** «Occurrence»«Abstraction» ****** Title name author LibraryItem barCodeNumber ****** isbn publicationDate libOfCongress
18
© Bennett, McRobb and Farmer 2002 Abstraction-Occurrence Abstraction-Occurrence n Antipatterns:
19
© Bennett, McRobb and Farmer 2002 Abstraction-Occurrence Abstraction-Occurrence n Square variant ScheduledTrain number SpecificTrain date ** * * ScheduledLegSpecificLeg actualDepTime * actualArrTime scheduledDepTime scheduledArrTime Station origindestination **
20
© Bennett, McRobb and Farmer 2002 Summary In this lecture you have learned about: n Components, and how generalization and aggregation help to model them n How to identify and to model generalization and composition n What is meant by ‘pattern’, and the types of pattern that can be used in software development
21
© Bennett, McRobb and Farmer 2002 References n Coad et al (1997) n Fowler (1997) (For full bibliographic details, see Bennett, McRobb and Farmer)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.