8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 1/42
October 8, 2004 Software Design 1
Overview of Analysis Analysis is an iterative process« make a µfirstcut¶ conceptual model and then iteratively
refine it as your understanding of the problemincreases.Steps in the analysis process
1. Identifying the classes
2. Identifying the classes attributes andresponsibilities3. Identifying relationships and collaborationsbetween classes
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 2/42
October 8, 2004 Software Design 2
Couple of rulesgood classes provide adequateencapsulationresponsibilities should be well
distributed among all classes (thereshould not be one main class that doesalmost everything)
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 3/42
October 8, 2004 Software Design 3
Case study: a resort reservation
system [1]Design the software to handle reservations at BlueLake Resort. The resort comprises several
cottages and two meeting rooms. Cottages cancomprise from one to three beds. The firstmeeting room has a capacity of 20 persons, thesecond, 40 persons. Cottages can be booked bythe night; meeting rooms can be booked by thehour. Rates for cottages are expressed per person, per night; rates for meeting rooms areexpressed per hour.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 4/42
October 8, 2004 Software Design 4
Case study: a resort reservation
system [2]Clients can book cottages and meeting rooms inadvance by providing a phone number and a validcredit card information. Customers can expresspreferences for specific cottages. Cancellation of reservations is possible but requires 24 hoursnotice. An administrative charge applies to allcancellations. Every morning, a summary of the
bookings for the previous day is printed out andthe related information is erased from thecomputer; a list of the cottages and meeting roomsthat will require cleaning is printed.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 5/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 6/42
October 8, 2004 Software Design 6
Identification of Classes[2]Using the things to be mode l ed : identifyindividual or group things such as persons,roles, organizations, logs, reports« in theapplication domain that is to be modeled;map to corresponding classesUsing object decomposition (top-downapproach): treat everything as an aggregatethat can be decomposed into parts
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 7/42
October 8, 2004 Software Design 7
Identification of Classes[3]Using gener al iz a tion (bottom-upapproach): look for objects that havecommonalities, and generalize thecorresponding classesUsing previous experience : object-oriented domain analysis, applicationframework, class hierarchies, andpersonal experience
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 8/42
October 8, 2004 Software Design 8
Noun identificationIdentify candidate classes by extractingall nouns out of the requirements/specifications of the system.Don¶t be too selective at first; writedown every class that comes to mind. Aselection process will follow.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 9/42
October 8, 2004 Software Design 9
Noun identification: Case StudyDesign the software to handle reservations at B l ueLak e Resort . The resort comprises severalcottages and two meeting rooms . Cottages cancomprise from one to three beds . The firstmeeting room has a capacity of 20 persons , thesecond, 40 persons. Cottages can be booked bythe night ; meeting rooms can be booked by thehour . Rates for cottages are expressed per person, per night; rates for meeting rooms areexpressed per hour.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 10/42
October 8, 2004 Software Design 10
Noun identification: Case StudyClients can book cottages and meeting rooms inadvance by providing a phone number and a valid
credit card information . Customers can expresspreferences for specific cottages. Cancellation of reservations is possible but requires 24 hoursnotice . An administrative charge applies to allcancellations. Every morning , a summary of thebookings for the previous day is printed out andthe related information is erased from thecomputer; a list of the cottages and meeting roomsthat will require cleaning is printed.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 11/42
October 8, 2004 Software Design 11
Keeping the right candidate
classesHaving made a tentative list of classes, eliminate unnecessary or incorrect classes according to the following criteria:Redundant classes : nouns that express the same informationIrr elevant classes : nouns that have nothing to do with theproblemV ague classes : nouns with ill-defined boundaries or which are toobroadA tt rib utes : nouns referring to something simple with nointeresting behavior, which is simply an attribute of another classE vents o r ope r at ions : nouns referring to something done to thesystem (sometimes events or operations are to be kept: check if they have state, behavior and identity).O uts ide the scope of the system : nouns that do not refer tosomething inside the system
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 12/42
October 8, 2004 Software Design 12
Refined list: Case StudyG ood classes: C ott a ge, Meeting room, Cl ient B ad classes: S oftw a re, B l ue L ak e Resort, B ed,Ca p a city, Night, Hour, R a te, Phone number, C redit c a rd inform a tion, C ustomer, Preference,Ca nce lla tion, Notice, Administr a tive ch a rge, Morning,D a y, Inform a tion, C omputer
D on¶t know: Reserv a tion, Resort, S umm a ry, List
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 13/42
October 8, 2004 Software Design 13
More Class Identification Tips Adjectives can suggest different kinds of objects or different use of the same object. If the adjectives indicate different behavior thenmake a new class.Be wary of sentences in the passive voice, or those whose subjects are not part of thesystem. Recast the sentence in the active
voice and see if it uncovers other classes.e.g.: "a summary of the bookings for theprevious day is printed out". Missing from thissentence is the subject or who is doing theprinting.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 14/42
October 8, 2004 Software Design 14
More Class Identification TipsKeeping two lists (strong candidatesand weaker ones) is a useful techniqueto avoid losing information while stillsorting between things you are sureabout and things that have yet to besettled. Additional techniques in Step 2(identifying responsibilities andattributes) and Step 3(identifyingrelationships and attributes) will help.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 15/42
October 8, 2004 Software Design 15
Relationships Association : An Associ a tion is a bi-directional connection between classes
(e.g. the "hires/works for" relationshipbetween an "employee" class and a "boss"class). It is represented by a solid line. Thisline can be qualified with the type of relationship, and can also featuremultiplicity rules (eg. one-to-one, one-to-many, many-to-many) for the relationship.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 16/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 17/42
October 8, 2004 Software Design 17
RelationshipsC ompos it ion: If a class cannot exist byitself, and instead must be a member of
another class, then that class has aComposition relationship with thecontaining class. A Compositionrelationship is indicated by a line with afilled diamond.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 18/42
October 8, 2004 Software Design 18
RelationshipsD ependency: W hen a class uses another class,perhaps as a member variable or a parameter,and so "depends" on that class, a Dependency
relationship is formed. A D ependency is arelationship where the client does not havesemantic knowledge of the supplier. It can beused, for example to show the relationshipbetween an "encoder" class and a "generic
Algorithm" class that is inserted in runtime to helpit encode a stream. A dependency is shown as adashed line pointing from the client to the supplier.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 19/42
October 8, 2004 Software Design 19
Relationships
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 20/42
October 8, 2004 Software Design 20
Class notation
A class
ClassName
methods
attributes
A class diagram exhibits classes and their associations used in an application.
Contrast this with a conceptual model which shows domain concepts and their associations.
Note: you can include visibilit y attributes: + for public, ± for private, # for protected
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 21/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 22/42
October 8, 2004 Software Design 22
Building a class diagramOnce the interaction diagrams have beencompleted it is possible to identify the specificationfor the software classes and interfaces.The UML has notation to define design details instatic structure, or class diagrams.Conceptual model is also useful in deriving classesby addition of detail.
A class diagram differs from a domain model byshowing software entities rather than real-worldconcepts.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 23/42
October 8, 2004 Software Design 23
Building a class diagram
(cont.)Typical information in a class diagramincludes:
Classes, associations and attributesInterfaces (with operations and constants)
Attribute type informationMethodsnavigability
dependenciesThe class diagram depends upon the domainmodel and interaction diagrams.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 24/42
October 8, 2004 Software Design 24
Making class diagrams (1)Identify all classes by examining interactiondiagrams.
Draw them in a class diagram.Duplicate the attributes from the associatedconcepts shown in the conceptual model.
Add method names by examining interactiondiagrams. Add type information to the attributes andmethods.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 25/42
October 8, 2004 Software Design 25
Making class diagrams (2) Add the associations needed for visibility. Add navigability arrows to indicate thedirection of attribute visibility.
Add dependency relationships to indicatenon-attribute visibility.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 26/42
October 8, 2004 Software Design 26
ClassesClasses are the building blocks inobject-oriented programming.
Illustrate classes with rectanglesdivided into compartments. Placethe name of the class in the firstpartition (centered, bolded, andcapitalized), list the attributes in
the second partition, and writeoperations into the third.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 27/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 28/42
October 8, 2004 Software Design 28
V is ibi lityU se visibility markers tosignify who can access theinformation contained
within a class. Privatevisibility hides informationfrom anything outside theclass partition. Publicvisibility allows all otherclasses to view the markedinformation. Protectedvisibility allows childclasses to accessinformation they inheritedfrom a parent class.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 29/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 30/42
October 8, 2004 Software Design 30
Mul tip l icity (Cardina l ity)Place multiplicitynotations near the endsof an association. Thesesymbols indicate thenumber of instances of one class linked to one
instance of the otherclass. For example, onecompany will have oneor more employees, buteach employee worksfor one company only.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 31/42
October 8, 2004 Software Design 31
Place constraints inside curlybraces {}.
Constraint
Simpl e Constra i nt
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 32/42
October 8, 2004 Software Design 32
C ompos it ion and A gg r egat ionC omposition is a special type of aggregation that denotes a strongownership between C lass A, the
whole, andC
lass B, its part. Illustratecomposition with a filled diamond.U se a hollow diamond to represent asimple aggregation relationship, inwhich the "whole" class plays a moreimportant role than the "part" class,but the two classes are notdependent on each other. Thediamond end in both a compositionand aggregation relationship pointstoward the "whole" class or theaggregate.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 33/42
October 8, 2004 Software Design 33
G ene r al iz at ionG eneralization is anothername for inheritance or an"is a" relationship. It refersto a relationship betweentwo classes where oneclass is a specializedversion of another. Forexample, Honda is a typeof car. So the class Hondawould have ageneralization relationshipwith the class car.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 34/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 35/42
October 8, 2004 Software Design 35
Method names and
multiobjectsThe add() message tothe multiobject should
be interpreted as amessage to thecontainer/ collectionobject.
The add() method isnot part of class Book.
b: Book
2.1: create («)
2.2: add (b):Catalog
:Book
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 36/42
October 8, 2004 Software Design 36
Navigability and dependency
relationshipsNavigability is a property of the role implying visibility of thesource to target class.
Attribute visibility is implied.
Add navigability arrows to the associations to indicate thedirection of attribute visibility where applicable.Common situations suggesting a need to define anassociation with navigability from A to B:
A sends a message to B. A creates an instance of B. A needs to maintain a connection to B
Add dependency relationship lines to indicate non-attributevisibility.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 37/42
October 8, 2004 Software Design 37
Class diagram
LibraryClerk Accesses Captures
1 1 1 *
1
BookEntrySession
initiateBookEntrySession()makeNewBook()becomeComplete()
isComplete: Boolean;
Book
author titlepublisher
year
Accesses
Contained-in
1
1*
Catalog
makeNewBook()
books: vector;
Terminal
makeNewBookEntry()addBook()
endBookEntry()
Uses
1
1
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 38/42
October 8, 2004 Software Design 38
Conceptual model versus class diagrams
(1)
A S al e in a conceptual model represents asystem concept. A S al e in a class diagram
represents a software entity.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 39/42
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 40/42
October 8, 2004 Software Design 40
Class diagrams: notables (1)cre a te is a special language independentUML message to indicate instantiation and
initialization. As this is a common operation, itis often omitted from class diagrams.
Access methods for class attributes are alsoomitted from class diagrams to reduce clutter.Messages to a multiobject are not shown asmethods in the class whose objects arecontained in a multiobject.
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 41/42
October 8, 2004 Software Design 41
Class diagrams: notables (2)It is recommended that UML syntax be usedfor method naming. This will keep naming
language independent. UML format:methodN a me(p a r a meterList)
Should all type information be shown in aclass diagram?
If automatic code generation is desired then YES.If the sole purpose is to use the diagram as acommunication aid, then all type information is notof any significant value. ( S ee Fig 21.7 of T1 .)
8/6/2019 Noun Phrase Analysis
http://slidepdf.com/reader/full/noun-phrase-analysis 42/42
October 8, 2004 Software Design 42
Class diagrams: navigability (1)
captures1 1
POST
Date
isComplete:booleantime
Sale
DateisComplete:boolean
timemakeLineItem()
POST will likel y have anattribute pointing to Sale.
Navigabilit y arrow: POSTobjects are connected
uni-directionall y to Saleobjects.
No navigabilit y arrow.. Saledoes not have connection
to POST .