St. Ambrose CSCI 275 - LECTURE NOTES

Unformatted text preview:

Search for: within All of dW Search help IBM home | Products & services | Support & downloads | My account developerWorks > Rational > UML basics: The class diagramAn introduction to structure diagrams in UML 2 Donald Bell IBM Global Services, IBM 15 Sep 2004 from The Rational Edge: As the most important example of the new structure diagram type in UML 2, the class diagram can be used by analysts, business modelers, developers, and testers throughout the software development lifecycle. This article offers a comprehensive introduction. This is the next installment in a series of articles about the essential diagrams used within the Unified Modeling Language, or UML. In my previous article on sequence diagrams, I shifted focus away from the UML 1.4 spec to OMG's Adopted 2.0 Draft Specification of UML (a.k.a. UML 2). In this article, I will discuss Structure Diagrams, which is a new diagram category that has been introduced in UML 2. Because the purpose of this series is to educate people about the notation elements and their meanings, this article focuses mainly on the class diagram. The reason for this will soon become clear. Subsequent articles will cover other diagrams included in the structure category. I also want to remind readers that this series is about UML notation elements, and that these articles are not meant to provide guidance on the best approach for modeling, or how to determine what things should be modeled in the first place. Instead, the purpose of this article and of the series in general is to help with a basic understanding of notation elements -- their syntax and their meanings. With this knowledge you should be able to read diagrams and create your own diagrams using the proper notation elements. This article assumes you have a rudimentary understanding of object-oriented design. For those of you who need a little assistance with OO concepts, you might try the Sun brief tutorial about Object-Oriented Programming at http://java.sun.com/docs/books/tutorial/java/concepts/. Reading the sections "What Is a Class?" and "What Is Inheritance?" should give you enough understanding to make this article useful. In addition, David Taylor's book, Object-Oriented Technologies: A Manager's Guide, offers an excellent, high-level explanation of object-oriented design without requiring an in-depth understanding of computer programming. The yin and yang of UML 2 In UML 2 there are two basic categories of diagrams: structure diagrams and behavior diagrams. Every UML diagram belongs to one these two diagram categories. The purpose of structure diagrams is to show the static structure of the system being modeled. They include the class, component, and or object diagrams. Behavioral diagrams, on the other hand, show the dynamic behavior between the objects in the system, including things like their methods, collaborations, and activities. Example behavior diagrams are activity, use case, and sequence diagrams. Structure diagrams in general As I have said, structure diagrams show the static structure of the system being modeled. focusing on the elements of a system, irrespective of time. Static structure is conveyed by showing the types and their instances in the system. Besides showing system types and their instances, structure diagrams also show at least some of the relationships among and between these elements and potentially even show their internal structure. Contents:The yin and yang of UML 2Structure diagrams in generalThe basicsBeyond the basicsUML 2 additionsConclusionNotesAbout the authorRate this articleRelated content:UML basics: Part I: An introduction to the Unified Modeling LanguageUML basics: Part II: The activity diagramUML basics: Part III: The class diagramUML's sequence DiagramSubscriptions:dW newslettersdW Subscription (CDs and downloads)The Rational EdgeLevel: AdvancedPage 1 of 16UML basics: The class diagram9/17/2004© Copyright IBM Corporation 2004. http://www-106.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.htmlStructure diagrams are useful throughout the software lifecycle for a variety of team members. In general, these diagrams allow for design validation and design communication between individuals and teams. For example, business analysts can use class or object diagrams to model a business's current assets and resources, such as account ledgers, products, or geographic hierarchy. Architects can use the component and deployment diagrams to test/verify that their design is sound. Developers can use class diagrams to design and document the system's coded (or soon-to-be-coded) classes. The class diagram in particular UML 2 considers structure diagrams as a classification; there is no diagram itself called a "Structure Diagram." However, the class diagram offers a prime example of the structure diagram type, and provides us with an initial set of notation elements that all other structure diagrams use. And because the class diagram is so foundational, the remainder of this article will focus on the class diagram's notation set. By the end of this article you should have an understanding of how to draw a UML 2 class diagram and have a solid footing for understanding other structure diagrams when we cover them in later articles. The basics As mentioned earlier, the purpose of the class diagram is to show the types being modeled within the system. In most UML models these types include: z a class z an interface z a data type z a component. UML uses a special name for these types: "classifiers." Generally, you can think of a classifier as a class, but technically a classifier is a more general term that refers to the other three types above as well. Class name The UML representation of a class is a rectangle containing three compartments stacked vertically, as shown in Figure 1. The top compartment shows the class's name. The middle compartment lists the class's attributes. The bottom compartment lists the class's operations. When drawing a class element on a class diagram, you must use the top compartment, and the bottom two compartments are optional. (The bottom two would be unnecessary on a diagram depicting a higher level of detail in which the purpose is to show only the relationship between the classifiers.) Figure 1 shows an airline flight modeled as a UML class. As we can see, the name is Flight, and in the middle compartment we see that the Flight class has three attributes: flightNumber,


View Full Document

St. Ambrose CSCI 275 - LECTURE NOTES

Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?