Simple UMLWhat is UML?Design PatternsUML is complexClass diagramsClassesVariables IVariables IIMethodsExample of a classTypes of relationshipsExample: Secret Code programUML toolsTool linksThe EndJan 13, 2019Simple UML2What is UML?UML stands for Unified Modeling LanguageUML is a diagramming language designed for Object-Oriented programmingUML can be used to describe:the organization of a programhow a program executeshow a program is usedhow a program is deployed over a network…and more3Design PatternsDesign Patterns describe the higher-level organization of solutions to common problemsDesign Patterns are a current hot topic in O-O designUML is always used for Design PatternsDesign Patterns are used to describe refactoringsWe may discuss some Design Patterns later on in this course4UML is complexUML is a big, complicated diagramming languageUML comprises at least seven or eight different kinds of diagramsThis talk will cover just a tiny bit of one kind of diagram, the class diagramA class diagram is often all that is needed to describe a particular Design Pattern5Class diagramsA class diagram shows classes, interfaces, and their relationshipsWe’ll cover most of classes and interfaces, and a few of the most important relationships6ClassesA class is drawn as a rectangle with two or three compartments:Name of the classVariables [optional]Methods7Variables IA variable is written as: visibility name : typewhere:+ means public visibility# means protected visibility- means private visibility<blank> means default (package) visibilityExample: +length:int8Variables IIStatic variables are underlinedAn initial value can be shown with =valueExample: -numberOfEmployees:int=10means numberOfEmployees is:privatestaticintegerand has 10 as its initial value9MethodsMethods are written as: visibility name (parameters) : returnTypewherevisibility uses the same syntax variables (+, -, #, blank)parameters are given as name:typeif the returnType is void, it is omittedconstructors are preceded by «constructor»interfaces are preceded by «interface»an ellipsis (…) indicates omitted methods10Example of a classCardcardId:int-copy:boolean=false«constructor» Card(int id)+isKind(desiredKind:int)+isSharable():boolean+toString():String11Types of relationshipsABClass Bextendsclass ACD1..4Class Ccontains 1 to 4 objectsof class DFactoryProductcreatesOther kinds ofrelations12Example: Secret Code program13UML toolsRational Rose is the “real world” standard; full round-trip code generationRecently acquired by IBM (right under Microsoft’s nose!)Together (from Borland) is a lot like Rational RoseI haven’t used it in about five years (since before Borland bought it from TogetherSoft)ArgoUML looks interesting (and is open source)BlueJ, of course, displays simple UML diagramsDrawing programs with UML supportVisio is a Microsoft toolDia is a freeware clone of Visio14Tool linksRational Rosehttp://www-3.ibm.com/software/awdtools/developer/rosexde/Togetherhttp://www.borland.com/together/ArgoUMLhttp://argouml.tigris.orgVisioHard to find info on Microsoft’s site!http://msdn.microsoft.com/office/understanding/visio/Diahhttp://www.gnome.org/projects/dia/OmniGraffle 3 (Mac OS X)http://www.omnigroup.com/applications/omnigraffle/15The
View Full Document