DOC PREVIEW
UT Dallas CS 6359 - Chapter_16a

This preview shows page 1-2-15-16-17-32-33 out of 33 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1What will we learn?IntroductionSlide 4UML: Design Class Diagram (DCD)Classifiers, AttributesUML: Notating AttributesAttributes As AssociationsUML: Attributes as AssociationsAttributes: Text versus AssociationsUML: Attributes as AssociationsAttributes: ListsOperations and MethodsMethod Notation in UMLKeywordsAbstract ClassesDependency in UMLDependency in UMLDependency in UMLDependency LabelsSlide 21Composition and AggregationComposition: ExampleComposition: ExampleConstraints and Qualified AssociationsQualified AssociationAssociation ClassesMore on UML DiagramsTemplatesSlide 30Slide 31Takeaways from Chapter 16Next …Object-Oriented Analysis and DesignC h a p t e r s 1 6 : U M L C l a s s D i a g r a m s1What will we learn?UML Class Diagrams – What are they, how to create them2IntroductionUML provides the tools for creating general class diagrams, i.e. static object modeling, that can be used to create Domain Models or software class diagramsWe will look in more detail at the UML notation that can be used, irrespective of the perspective (conceptual or software class)Note that UML provides a set of diagraming tools, most of which are optional to useStandardized diagram language, makes it easier to communicate designsThe next slide gives an overview of the concepts we will be discussing in this lecture34java.awt::Fontorjava.awt.Fontplain : Int = 0 { readOnly }bold : Int = 1 { readOnly }name : Stringstyle : Int = 0...getFont(name : String) : FontgetName() : String...«interface»Runnablerun()- ellipsis “…” means there may be elements, but not shown- a blank compartment officially means “unknown” but as a convention will be used to mean “no members”SubclassFoo...run()...SuperclassFooorSuperClassFoo { abstract }- classOrStaticAttribute : Int+ publicAttribute : String- privateAttributeassumedPrivateAttributeisInitializedAttribute : Bool = trueaCollection : VeggieBurger [ * ]attributeMayLegallyBeNull : String [0..1] finalConstantAttribute : Int = 5 { readOnly }/derivedAttribute + classOrStaticMethod()+ publicMethod()assumedPublicMethod()- privateMethod()# protectedMethod()~ packageVisibleMethod()«constructor» SuperclassFoo( Long )methodWithParms(parm1 : String, parm2 : Float)methodReturnsSomething() : VeggieBurgermethodThrowsException() {exception IOException}abstractMethod()abstractMethod2() { abstract } // alternatefinalMethod() { leaf } // no override in subclasssynchronizedMethod() { guarded } 3 common compartments1. classifier name2. attributes3. operationsinterface implementation andsubclassingFruit......PurchaseOrder......1association with multiplicitiesdependency officially in UML, the top format is used to distinguish the package name from the class nameunofficially, the second alternative is commonorderan interface shown with a keywordUML: Design Class Diagram (DCD)5Register...endSale()enterItem(...)makePayment(...)SaletimeisComplete : Boolean/totalmakeLineItem(...)Register...SaletimeisComplete : Boolean/totalCaptures111Domain Modelconceptual perspectiveDesign ModelDCD; software perspectivecurrentSaleClassifiers, AttributesA UML classifier is a model element that describes behavioral and structure features Think of classes or interfacesAttributes may also be called structural propertiesAttributes may be displayed in several ways in a UML diagram:Text in a class boxOn an association lineBoth of the aboveFull format for attribute text notation (note most items are optional):Visibility name : type multiplicity = default {property-string}Note that Visibility is the +- notation we saw earlier (+ public, - private)6UML: Notating Attributes7Register......Sale......1RegistercurrentSale : Sale...Sale......using the attribute text notation to indicate Register has a reference to one Sale instanceusing the association notation to indicate Register has a reference to one Sale instanceOBSERVE: this style visually emphasizes the connection between these classescurrentSaleRegistercurrentSale : Sale...Sale......1thorough and unambiguous, but some people dislike the possible redundancycurrentSaleAttributes As AssociationsNotice that there are subtle differences between the conceptual perspective (Domain Model) and software perspective (Design Model) for attributes that are defined as associationsFor DCDs, there is usually A navigability arrow A multiplicity at the target end, but not the sourceA role nameNo association name8UML: Attributes as Associations9the association name, common when drawing a domain model, is often excluded (though still legal) when using class diagrams for a software perspective in a DCDRegisterid: Int...Saletime: DateTime...1currentSaleRegisterid : IntSaletime : DateTimeCaptures-current-sale11UP Domain Modelconceptual perspectiveUP Design ModelDCDsoftware perspectiveAttributes: Text versus AssociationsWe explored the idea of data type objects earlier (Domain Models)Data types referred to objects for which individual identity is not importantRecall a Person object versus a Name data typeOne guideline is to use the text for data types (basically primitive types) and associations for more complicated classesNote that this is a diagram preference – does not matter in the final code10UML: Attributes as Associations11Registerid: Int...Saletime: DateTime...1applying the guideline to show attributes as attribute text versus as association linesStoreaddress: Addressphone: PhoneNumber...1Register has THREE attributes:1. id2. currentSale3. locationcurrentSalelocationAttributes: ListsHow do we notate a list of attributes, e.g. an ArrayList in Java?12“Note” Symbolnotice that an association end can optionally also have a property string such as {ordered, List}Saletime: DateTime...SalesLineItem......1..*lineItems{ordered, List}Saletime: DateTimelineItems : SalesLineItem [1..*] orlineItems : SalesLineItem [1..*] {ordered}...SalesLineItem......Two ways to show a collection attributeOperations and MethodsOperations are usually displayed in the class box with the notation:visibility name (parameter-list) {property-string}Sometime a return-type is value is addedAssume public if no visibility is shownAn operation is a declaration (name, parameters, return type, exceptions list)A method is an implementation of an operation in sequence diagrams, may show the details and sequence of messages In class diagram, usually include some pseudo-code in a note with the <<method>> tag13Method Notation in UML14 Often times constructors (if


View Full Document

UT Dallas CS 6359 - Chapter_16a

Documents in this Course
Lecture2

Lecture2

63 pages

Lecture3

Lecture3

49 pages

Lecture4

Lecture4

48 pages

Lecture5

Lecture5

47 pages

Lecture6

Lecture6

45 pages

Lecture7

Lecture7

63 pages

Lecture8

Lecture8

77 pages

Lecture9

Lecture9

48 pages

Lecture10

Lecture10

84 pages

Lecture11

Lecture11

45 pages

Lecture12

Lecture12

134 pages

Lecture13

Lecture13

62 pages

Lecture14

Lecture14

76 pages

Project

Project

2 pages

Chapter_1

Chapter_1

25 pages

Load more
Download Chapter_16a
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chapter_16a and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chapter_16a 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?