Home > Articles > Software Development & Management > Object Technology

3.6 Diagrams

UML diagrams are where it all comes together. As I already mentioned, in the UML there is no formal way of bounding or containing a diagram (that is, no notation for the diagram itself), so there are no relationships between diagrams. Instead, diagrams are the graphical presentation vehicles for aspects of a model. They don't stand alone, but are meant to be part of the textual narrative that provides the model specification.

The UML specifically includes nine different diagrams in its documentation, which I'll discuss briefly here. However, these diagram types are process-dependent and suggestive, rather than prescriptive. The UML allows the modeler to combine any and all elements into diagrams, depending on the modeling needs at hand. In practice, of course, only certain combinations of elements are sensible, and these nine types are pretty much the "canonical" ones for object-oriented programming.

However, all of this really needs to be considered in the context of the process and the tool being used. Although the RUP includes all of these diagrams, D'Souza and Wills' book (for example) doesn't.

Detailing these diagrams and the alternatives can be a book by itself. Most of the literature on the UML focuses on these diagrams, so there are already many good books to choose from. Because this book is as process-independent as the UML, I'll leave detailed discussions of these diagrams to the many other more programming-oriented, books out there and to come.

3.6.1 Class Diagram

For traditional object-oriented development, the class diagram is the keystone for the system model. In UML terms, it is a view of the static structural model. It is not a formal partitioning of the model; therefore, individual class diagrams "do not represent divisions in the underlying model" (Rational Software Corporation 1999, 3-33).

Aside from classes, a class diagram can also contain interfaces, packages, relationships, and instances (such as objects and links). The UML Specification suggests that "a better name would be static structural diagram," but bows to tradition and brevity in sticking with class diagram (1999).

The UML recognizes the distinction between class and type; the nature of what is meant by class changes conceptually, depending on the development stage that the modeling effort is in. For those interested, Martin Fowler, Kendall Scott, and Ivar Jacobson do an admirable job of capturing and explaining the modeling nuances of class, type and object in UML Distilled: Applying the Standard Object Modeling Language (Fowler, Scott, and Jacobson 1997).

3.6.2 Use Case Diagram

For use case-driven development, the use case diagram is the keystone of the modeling effort. Use case diagrams show actors and use cases, together with their relationships. These include the following:

  • Associations between the actors and the use cases

  • Generalizations between the actors

  • Generalizations, extends, and includes relationships among the use cases

The use cases may be enclosed by a rectangle to show the boundary of the containing system, and so on. As will be evident in the UML patterns, use case diagrams by themselves are essentially trivial. The real substance of a use case is in the text (narrative).

A use case captures the significant parts of an interaction with the system or some part of the system by the actor(s) defining the scope, context, and requirements. Use cases can be used in a variety of ways throughout the development effort (for example, as the basis for setting up the test environment and as a starting point for a user manual).

The following is an example of a basic use case, which describes making a phone call, in text format first and then the diagram (see Figure 3.29). The caller initiates the use case, and the receiver is a secondary actor. The system that the caller and actor interact with is, of course, the phone system. The alternate flows aren't completely described, but indicate the kind of conditions that alternate flows handle.

Actors:
Caller
Receiver
Normal Flow

The use case begins when Caller picks up the handset of telephone.

Caller listens for dial tone.
(Alternate flow: no dial tone)
Caller dials a phone number.
Phone System rings Receiver's phone.
(Alternate flow: Wrong number)
Receiver answers.
(Alternate flow: no answer)
Caller conducts conversation.

The use case ends when Caller hangs up phone.

Alternate Flows:
No dial tone
Wrong number
No answer

Figure 3.29 Telephone call use case diagram.

3.6.3 Interaction Diagrams

Interaction diagrams are used in the dynamic modeling of the system. There are two kinds: sequence diagrams and collaboration diagrams.

Sequence Diagram

A sequence diagram shows an interaction arranged in time sequence: the objects (not classes) and the messages that pass between them when an interaction occurs. These are what Ivar Jacobson used to call interaction diagrams.

A sequence diagram has a list of participating objects across its top, shown as rectangles. Each object rectangle contains at least a name, always underlined to indicate that the rectangle is an object and not a class. Below each object rectangle, shown with a dotted line, is the object lifeline, the time-ordered visual framework for message exchanges between the objects (and with the system). A narrow vertical rectangle called the activation represents the period of time an object is actually performing an action (directly or through an intermediary, such as another object). Object messages appear as arrows with a text description. Figure 3.30 shows the basic elements of a sequence diagram.

Figure 3.30 Simple sequence diagram.

Collaboration Diagram

A collaboration diagram also shows the passing of messages between objects, but focuses on the objects and messages and their order instead of the time sequence. The sequence of interactions and the concurrent threads are identified using sequence numbers. A collaboration diagram shows an interaction organized around the roles in the interaction and their links to each other, and shows the relationships among the objects playing the different roles. The UML Specification suggests that collaboration diagrams are better for real-time specifications and for complex scenarios than sequence diagrams.

Figure 3.31 shows the telephone call example expressed as a collaboration diagram.

Figure 3.31 Collaboration diagram showing static structure of objects and messages flowing between them.

3.6.4 State Diagrams

State diagrams show the states, events, transitions, and activities for the system, depicted as state machines. They're part of dynamic modeling rather than structural modeling. They are used to describe the behavior of a model element such as an object or an interaction, describing "possible sequences of states and actions through which the element can proceed during its lifetime as a result of reacting to discrete events (for example, signals, operation invocations)" (Rational Software Corporation 1999, 3-131).

The official name in the UML is statechart diagram, but state diagram pops up all over the place in the UML Specification and in much of the literature. The term statechart reflects its origins in Harel Statecharts, a long-used tool for modeling real-time systems, which the UML has modified to fit object-oriented development.

A state diagram is typically used to model the behavior of an object that needs a complete description of its discrete states. Many objects in standard business systems may not have significant states, in which case they will not need state diagrams. (On the other hand, for those developing real-time systems, a discussion of state diagrams and state modeling can be a book by itself.) A state diagram is typically associated with one and only one class, and lists all the states that a particular object can have during system operation.

Each rounded rectangle represents one state that an object can be in. A state diagram must represent all the states in which an object can find itself, as well as define an initial state the object will be in. An initial state is shown as a filled-in black circle. The final state of an object is not required if the object has no final state, such as in a system that is always running.

An object passes from one state to another following a transition triggered by an event within the system (typically, a method invocation). A transition is shown by drawing an arrow from one state to another and is associated with an event that triggers the transition.

Figure 3.32 shows the state diagram for a light switch that shows both transition lines and events.

Figure 3.32 State diagram showing the two states of a light switch.

3.6.5 Activity Diagrams

An activity diagram is a "special case of a state diagram in which all (or at least most) of the states are action or subactivity states and in which all (or at least most) of the transitions are triggered by completion of the actions or subactivities in the source states" (Rational Software Corporation 1999, 3-151). In fact, they're basically sophisticated versions of flowcharts. They're intended to cover workflows and processes, and have much of the flavor of flowcharts without the negative "baggage." Their depiction as versions of state diagrams is subject to much criticism, but at least it helps to make them a consistent member of the UML family.

An activity diagram is attached to a class (which includes a use case for the UML), to a package, or to the implementation of an operation. The UML Specification says that they "focus on flows driven by internal processing (as opposed to external events)" (1999, 3-151). It recommends using them where the events involved represent the completion of internally generated actions (for procedural flow of control).

In an activity diagram, swimlanes are used to package the organizational boundaries within an activity model: they are used to show who is doing what in an activity model.

When it is necessary to indicate that two or more actions occur in parallel, a line called a synchronization bar shows where each thread in the parallel actions halts, waiting until the other threads reach the same point.

Figure 3.33 shows an activity model for the workflow of an order system. Organized around the responsibilities of the customer, sales, and the warehouse, swimlanes are the vertical lines partitioning the diagram and identifying the responsibilities for each activity.

Figure 3.33 An order process with three swimlanes, each showing the responsibility of the business unit during the process.

3.6.6 Implementation Diagrams

Implementation diagrams model implementation artifacts and considerations, including how the source code is structured and how (and where) the executables are made available. The UML Specification suggests that they also can be applied in a broader sense to business modeling. Components are the business procedures and documents, and the run-time structure is the organization units and resources (human and other) of the business (1999, 3-165). There are two types of implementation diagrams: component diagrams and deployment diagrams.

Component Diagrams

Component diagrams show the structure of the code (see Figure 3.34). According to the UML Specification, they are "the dependencies among software components, including source code components, binary code components, and executable components" (1999). The nuances of component are such that it seems to be as malleable a term as architecture and abstraction.

Figure 3.34 Component diagram showing the dependencies between components of a payment-processing system

Deployment Diagrams

Deployment diagrams show the structure of the runtime system (see Figure 3.35), including the "configuration of runtime processing elements and the software components, processes, and objects that live on them" (Rational Software Corporation 1999, 3-166). For business modeling, the UML Specification says runtime elements include workers and organizational units, and the software components include procedures and documents used by the workers and organizational units.

Figure 3.35 Deployment diagram showing run-time nodes and components for a browser-based three-tier account management system

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020