a little UML
UML for the Java Associate
Oh my! Umm, hey, I‛m really not ready yet, OK?
UML is Cool.
Rumor has it there are some UML questions on Sun’s new
Java Associates exam. Sadly, the new Head First book on OO isn’t quite ready yet (be sure to check hfoobook.com toward the end of 2005!), but we’ve taken a few random pages (and parts of pages) from it and put them together here. So, if you don’t mind the lack of organization, you should find everything you need to know about UML (for the exam) in the following pages. Oh, and did we mention that the author of this book wrote most of the UML questions for the exam? :-)
this is a new chapter
1
www.hfoobook.com
What’s with all the rectangles?
NOTE: The “facing page” is not included in this little UML booklet!
The four boxes full of text over there on the facing page are our first examples of UML. UML stands for Unified Modeling Language, and it’s the most common notation used for creating diagrams that describe object-oriented systems. It’s beyond the scope of this book to teach you everything there is to know about UML. However, we’ll be sprinkling in a lot of the really critical stuff throughout the course of the book. If you’re going to be moving to Objectopia, you should definitely have a reasonable understanding of UML. In this, our first look at UML, we’ll look at the notation used to represent classes (probably the single most commonly used aspect of UML) as well as the notation used to represent individual objects.
UML
101
Objects
Classes
A class is drawn as a rectangle with three sections. The name of the class (in bold) goes in the first section. attribute types
Book
title : String
It’s less common to draw object diagrams than it is to draw class diagrams. But they can be useful for describing specific examples or complex relationships between objects. class name object name hfJava : Book title = “HF Java” author = “K & B” pages = 619
The 2nd section