Skip to Content
Java Pocket Guide, 4th Edition
book

Java Pocket Guide, 4th Edition

by Robert Liguori, Patricia Liguori
August 2017
Intermediate to advanced
290 pages
4h 10m
English
O'Reilly Media, Inc.
Content preview from Java Pocket Guide, 4th Edition

Appendix C. UML Basics

Unified Modeling Language (UML) is an object-modeling specification language that uses graphical notation to create an abstract model of a system. The Object Management Group governs UML. This modeling language can be applied to Java programs to help graphically depict such things as class relationships and sequence diagrams. The latest specifications for UML can be found at the OMG website. An informative book on UML is UML Distilled, Third Edition, by Martin Fowler (Addison-Wesley).

Class Diagrams

A class diagram represents the static structure of a system, displaying information about classes and the relationships between them. The individual class diagram is divided into three compartments: name, attributes (optional), and operations (optional). See Figure C-1 and the example that follows it.

jpg4 ac01
Figure C-1. Class diagram
// Corresponding code segment
class Orchestra { // Class Name
  // Attributes
  private String orch Name;
  private Integer instrCount = 7;
  // Operations
  public void setOrchName(String name) {...}
  public Boolean play(Score s) {...}
}

Name

The name compartment is required and includes the class or interface name typed in boldface.

Attributes

The attributes compartment is optional and includes member variables that represent the state of the object. The complete UML usage is as follows:

visibility name : type [multiplicity] = defaultValue ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 8 Pocket Guide

Java 8 Pocket Guide

Robert Liguori, Patricia Liguori
Java 11 Cookbook - Second Edition

Java 11 Cookbook - Second Edition

Nick Samoylov, Mohamed Sanaulla

Publisher Resources

ISBN: 9781491938683Errata Page