Presentation is loading. Please wait.

Presentation is loading. Please wait.

A means of graphically displaying a complicated programs 18-Mar-16 UML Thanks to Dave Matuczek, UPenn.

Similar presentations


Presentation on theme: "A means of graphically displaying a complicated programs 18-Mar-16 UML Thanks to Dave Matuczek, UPenn."— Presentation transcript:

1 A means of graphically displaying a complicated programs 18-Mar-16 UML Thanks to Dave Matuczek, UPenn

2 What is UML? 2 UML stands for Unified Modeling Language or Universal Modeling Language UML uses graphics to show the relationships between program classes and objects.

3 Design Patterns 3 Design Patterns common programming strategies Design Patterns are best described by UML We will learn some simple patterns in class

4 Classes 4 A class is drawn as a rectangle with three sections Name of the class Variables Methods

5 Variables 5 A variable is written as: domain name : type where: + means public - means private Example: +length:int

6 Variables 6 Static variables are underlined An initial value can be shown with =value Example: -numberOfEmployees:int=10 means numberOfEmployees is: private static integer and has 10 as its initial value

7 Methods 7 Methods are written as: domain name (parameters) : returnType where Domain uses the same syntax variables (+, -, blank) parameters are given as name:type if the returnType is void, it is omitted constructors are preceded by «constructor» interfaces are preceded by «interface»

8 Example of a class 8 Card +cardId:int -copy:boolean=false «constructor» Card( int id ) +isKind( desiredKind:int ) +isSharable( ):boolean +toString( ):String

9 Types of relationships 9 A B class B extends class A C D 1..4 “Is a”“Has a” Class C contains 1 to 4 objects of class D IGeometry Cube Implements

10 Example: Geometry program 10

11 Dependency "uses " No instantiation OBJECT new BankClass( );

12 Composition "has a" object instantiation public BankAccountClass myAccount; myAccount = new BankAccountClass( ….

13 Inheritance “is a” public class Clock extends JFrame

14 Realization interface implementation public class BankAccountClass implements IBankAccountClass

15 Association "knows a" object is passed public BankAccountClass( double money, int acct, PeopleClass person ) { balance = money; accountNumber = acct; member = person; }


Download ppt "A means of graphically displaying a complicated programs 18-Mar-16 UML Thanks to Dave Matuczek, UPenn."

Similar presentations


Ads by Google