Introduction To UML (7) - COP 3330: Object-Oriented...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3330: Introduction To UML Page 1 © Dr. Mark Llewellyn COP 3330: Object-Oriented Programming Summer 2011 Introduction to Object-Oriented Programming and the Unified Modeling Language (UML) Department of Electrical Engineering and Computer Science Computer Science Division University of Central Florida Instructor : Dr. Mark Llewellyn [email protected] HEC 236, 407-823-2790 http://www.cs.ucf.edu/courses/cop3330/sum2011
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 3330: Introduction To UML Page 2 © Dr. Mark Llewellyn A Brief Introduction to UML It is not easy for software designers to keep in mind all of the important properties of classes and the relationships that exist between the classes as the number of classes and relationships grow in a system. To aid in visualizing the design, a diagram can be very helpful. The standard notation, or language, that is used for these diagrams is called the Unified Modeling Language , or UML for short. There are 13 different types of diagrams included in the UML 2.0 standard (the current standard adopted in 2003). Among the thirteen are class diagrams , state diagrams , and sequence diagrams . These three are the most useful types of diagrams for OO-program developers. For right now, we focus only on class diagrams. UML is not a Java-only modeling language, so its notations do not always correspond directly to Java notation or syntax. For example, a method named practice that takes an integer x as a parameter and returns a String is written in Java as: String practice (int x) but in UML is written as: practice (x: int): String
Background image of page 2
COP 3330: Introduction To UML Page 3 © Dr. Mark Llewellyn UML Class Diagrams A UML class diagram shows classes, interfaces and the relationships between them. A class diagram provides a static view of the classes and relationships rather than a dynamic view of the interactions among the objects of those classes. A class is represented by a rectangle (box) divided into three sections horizontally. The top section gives the name of the class. The middle section gives the attributes (fields) of the objects of the class. These fields are abstractions of the data or state of an object and as such are usually implemented as instance variables. However, class variables are also represented here. The bottom section gives the operations (“intelligence”) of the class, which corresponds to the constructors and methods in Java. The example on the next page shows the UML class diagram for the Person class we created in the previous set of notes.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 3330: Introduction To UML Page 4 © Dr. Mark Llewellyn UML Class Diagrams public class Person { private String name; private Date birthDate; public Person (String who, Date bday) { this.name = who; this.birthDate = bday; } public String getName() { return name; } public Date getBirthDate() { return birthDate; } } Person − name: String − birthDate: Date + Person (name: String, birthDate: Date): Person + getName (): String + getBirthDate (): Date UML Class Diagram The equivalent Java code
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/04/2011 for the course COP 3330 taught by Professor Staff during the Summer '08 term at University of Central Florida.

Page1 / 38

Introduction To UML (7) - COP 3330: Object-Oriented...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online