DOC PREVIEW
UMD CMSC 132 - Unified Modeling Language 2

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 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 40 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 40 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 40 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 40 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 40 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 40 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 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Unified Modeling Language 2UML Class DiagramsRelationships Between ClassesAssociationAssociation w/ NavigationSlide 6Slide 7Multiplicity of AssociationsSlide 9DependencySlide 11Slide 12Dependency ExampleGeneralizationImplementationUML ExamplesUML Example – Veterinary SystemSlide 18UML Example – Computer SystemSlide 20UML Example – Library SystemSlide 22UML Example – Banking SystemSlide 24UML Example – Home Heating SystemSlide 26UML Class Diagrams  JavaUML  Java : Veterinary SystemSlide 29Java  UML : Veterinary SystemSlide 31Slide 32UML  Java : Computer SystemSlide 34Slide 35Slide 36Java  UML : Printing SystemSlide 38Slide 39UML SummaryUnified Modeling Language 2Nelson Padua-PerezChau-Wen TsengDepartment of Computer ScienceUniversity of Maryland, College ParkUML Class DiagramsRepresent the (static) structure of the systemGeneral In JavaName NameState VariablesBehavior MethodsRelationships Between ClassesAssociationPermanent, structural, “has a”Solid line with arrowheadDependencyTemporary, “uses a”Dotted line with arrowheadGeneralizationInheritance, “is a”Solid line with open triangular arrowheadImplementationDotted line with open triangular arrowheadORAssociationDenotes permanent, structural relationship Occurs when state of class A contains class BView as a “has a” relationship between classesRepresented by solid line (with arrowhead)ExampleClass Car { Class Engine {Engine myEngine; …} }Car “has a” EngineAssociation w/ NavigationNavigation informationRelationship between classes may be directionalArrowhead indicates direction of relationshipCar class knows about Engine class Engine class doesn’t know about CarAssociation w/ NavigationOne-way associationOnly one class contains other classUse arrowhead to indicate direction of relationshipPoint to class contained in 2nd classExampleClass Car { Class Engine {Engine myEngine; …} }Association w/ NavigationBi-directional associationBoth classes contain object of other classUse undirected solid edge (no arrowheads)ExampleClass Car { Class Engine {Engine myEngine; Car myCar;} }Multiplicity of AssociationsSome relationships may be quantifiedMultiplicity denotes how many objects the source object can legitimately referenceNotation*  0, 1, or more5  5 exactly5..8  between 5 and 8, inclusive5..*  5 or moreMultiplicity of AssociationsMany-to-oneBank has many ATMs, ATM knows only 1 bankOne-to-manyInventory has many items, items know 1 inventoryDependencyDenotes dependence between classesAlways directed (Class A depends on B)Represented by dotted line with arrowheadA depends on B A BDependencyCaused by class methodsMethod in Class A temporarily “uses a” object of type Class BChange in Class B may affect class AA uses object of class B A BDependencyDependence may be caused byLocal variableParameterReturn valueExampleClass A { Class B {B Foo(B x) { … B y = new(); … return y; …} } }Dependency ExampleClass Driver depends on Class CarGeneralizationDenotes inheritance between classesCan view as “is-a” relationshipRepresented by line ending in (open) triangleLaptop, Desktop, PDA inherit state & behavior from ComputersImplementationDenotes class implements Java interface Represented by dotted line ending in (open) triangleA implements interface B A «B»UML ExamplesRead UML class diagramTry to understand relationshipsExamplesPets & ownersComputer disk organizationLibrary booksBanking systemHome heating systemPrinting systemUML Example – Veterinary SystemTry to read & understand UML diagramUML Example – Veterinary SystemTry to read & understand UML diagram• 1 or more Pets associated with 1 PetOwnerUML Example – Computer SystemTry to read & understand UML diagramUML Example – Computer SystemTry to read & understand UML diagram• 1 CPU associated with 0 or more Controllers• 1-4 DiskDrives associated with 1 SCSIController• SCSIController is a (specialized) ControllerUML Example – Library SystemTry to read & understand UML diagramUML Example – Library SystemTry to read & understand UML diagram• 1 or more Book associated with 1 or more Pages• Patron & Shelf temporarily use (depend on) BooksUML Example – Banking SystemTry to read & understand UML diagramUML Example – Banking System• 1 Bank associated with 0 or more Accounts• Checking, Savings, MoneyMarket are AccountsUML Example – Home Heating SystemTry to read & understand UML diagramUML Example – Home Heating System• Each Thermostat has 1 Room • Each Thermostat associated with 0 or more Heaters• ElectricHeater is a specialized Heater• AubeTH101D is a specialized ThermostatUML Class Diagrams  JavaDifferent representation of same informationName, state, behavior of classRelationship(s) between classesPractice deriving one from the other Accurately depicting relationship between classesUML  Java : Veterinary SystemUMLJavaUML  Java : Veterinary SystemUMLJavaclass Pet {PetOwner myOwner; // 1 owner for each pet}class PetOwner {Pet [ ] myPets; // multiple pets for each owner}Java  UML : Veterinary SystemJavaclass Pet {PetOwner myOwner; // 1 owner for each pet}class PetOwner {Pet [ ] myPets; // multiple pets for each owner}UMLJava  UML : Veterinary SystemJavaclass Pet {PetOwner myOwner; // 1 owner for each pet}class PetOwner {Pet [ ] myPets; // multiple pets for each owner}UMLUML Class Diagrams  JavaUMLJavaclass Pet {PetOwner myOwner; // 1 owner for each pet}class PetOwner {Pet [ ] myPets; // multiple pets for each owner}UML  Java : Computer SystemUMLJavaUML  Java : Computer SystemUMLJavaclass Controller {}class SCSIController extends Controller {}UML  Java : Computer SystemUMLJavaDesign code using all available information in UML…UML  Java : Computer SystemJavaclass CPU {Controller [ ] myCtlrs;}class Controller {CPU myCPU;}class SCSIController extends Controller {DiskDrive [ ] myDrives = new DiskDrive[4];}Class DiskDrive { SCSIController mySCSI;}Java  UML : Printing SystemJavaclass Registry {PrintQueue findQueue();}class PrintQueue {List printJobs;Printer myPrinter;Registry myRegistry;void newJob();int length();Resources getResource();}Java  UML : Printing SystemJavaClass Printer {Resources myResources;Job curJob;void print();boolean busy();boolean on();}class Job {Job(Registry r) {…}}Java  UML : Printing SystemUML SummaryGraphics modeling languageVisually represents design of software systemWe focused on class diagramsContents


View Full Document

UMD CMSC 132 - Unified Modeling Language 2

Documents in this Course
Notes

Notes

8 pages

Recursion

Recursion

12 pages

Sorting

Sorting

31 pages

HTML

HTML

7 pages

Trees

Trees

19 pages

HTML

HTML

18 pages

Trees

Trees

19 pages

Honors

Honors

19 pages

Lecture 1

Lecture 1

11 pages

Quiz #3

Quiz #3

2 pages

Hashing

Hashing

21 pages

Load more
Download Unified Modeling Language 2
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 Unified Modeling Language 2 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 Unified Modeling Language 2 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?