{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This preview shows pages 1–6. 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
Image of page 1

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

View Full Document Right 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
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.
Image of page 3

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

View Full Document Right 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
Image of page 4
COP 3330: Introduction To UML Page 5 © Dr. Mark Llewellyn UML Class Diagrams Person − name: String
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern