Рубрики

drawing

Quick and easy drawings with sequential instructions

From each of these steps, you can easily specify what messages should be exchanged between the objects in the sequence diagram. Once it’s clear, you can go ahead and start drawing the sequence diagram.


Keeping the Art Simple

Art can be complicated, and sequential art just makes it even more complicated. This is a way to make that a lot simpler.

D ifferent artists have different methods of drawing. Some prefer the block of wood method: They don’t know what they are going to draw, but they’ll know when they start drawing. Others take a more ordered approach and talk it out until they have an idea of what they want to do. And others just draw whatever they want, hoping it will fall into place. Some of these strategies are better than others, and you need to develop a strategy that works for you.

You’re going to find over time that the “art as improv” school sounds great but doesn’t really work. The charm of the school is that artists, especially younger artists, see themselves as people based solely on inspiration and that they should only draw whenever they are in the throes of inspiration. While this is a great aspiration, the problem with that is that the artist tends to go from inspiration to inspiration and sees dry spells as just part of the process.

Works if you’re only using your art to get into parties and bragging online, but it’s not conducive to an actual career.

If you want an actual career, then you need to develop actual strategies. This means that you need to develop some actual strategies. You should always be learning, trying new things (especially those that challenge you), and just drawing for fun, but you need to find ways of replicating your work and doing it quickly and efficiently. While it may sound like you are taking the soul out of your art, the reality is that by simplifying the process you don’t have to worry about the boring setting up the stage and get straight to the art.

That is, simplifying the process allows you to worry less about the soul-deadening boring stuff and worry about the fun stuff. Anything that allows you to do that will always be worth it.

Notebooks Are Good

Writers are told to have notebooks on hand at all times in case inspiration strikes. This applies just as much to illustrators. Sometimes you will be bored and want to try something. Or you’ll see something you just need to draw. You never know when inspiration is going to strike, so always carry a notebook, something to draw with, and maybe a pencil…





What is a Sequence Diagram?

Sequence diagrams, commonly used by developers, model the interactions between objects in a single use case. They illustrate how the different parts of a system interact with each other to carry out a function, and the order in which the interactions occur when a particular use case is executed.

In simpler words, a sequence diagram shows how different parts of a system work in a ‘sequence’ to get something done.

Sequence diagrams are commonly used in software development to illustrate the behavior of a system or to help developers design and understand complex systems. They can be used to model both simple and complex interactions between objects, making them a useful tool for software architects, designers, and developers.

Sequence Diagram Notations

A sequence diagram is structured in such a way that it represents a timeline that begins at the top and descends gradually to mark the sequence of interactions. Each object has a column and the messages exchanged between them are represented by arrows.

A Quick Overview of the Various Parts of a Sequence Diagram

Lifeline Notation

A sequence diagram is made up of several of these lifeline notations that should be arranged horizontally across the top of the diagram. No two lifeline notations should overlap each other. They represent the different objects or parts that interact with each other in the system during the sequence.

A lifeline notation with an actor element symbol is used when the particular sequence diagram is owned by a use case.

A lifeline with an entity element represents system data. For example, in a customer service application, the Customer entity would manage all data related to a customer.

A lifeline with a boundary element indicates a system boundary/ software element in a system; for example, user interface screens, database gateways or menus that users interact with, are boundaries.

And a lifeline with a control element indicates a controlling entity or manager. It organizes and schedules the interactions between the boundaries and entities and serves as the mediator between them.

Activation Bars

The activation bar is the box placed on the lifeline. It is used to indicate that an object is active (or instantiated) during an interaction between two objects. The length of the rectangle indicates the duration of the objects staying active.

In a sequence diagram, an interaction between two objects occurs when one object sends a message to another. The use of the activation bar on the lifelines of the Message Caller (the object that sends the message) and the Message Receiver (the object that receives the message) indicates that both are active/ are instantiated during the exchange of the message.

Message Arrows

An arrow from the Message Caller to the Message Receiver specifies a message in a sequence diagram. A message can flow in any direction; from left to right, right to left, or back to the Message Caller itself. While you can describe the message being sent from one object to the other on the arrow, with different arrowheads you can indicate the type of message being sent or received.

The message arrow comes with a description, which is known as a message signature, on it. The format for this message signature is below. All parts except the message_name are optional.

attribute = message_name (arguments): return_type

As shown in the activation bars example, a synchronous message is used when the sender waits for the receiver to process the message and return before carrying on with another message. The arrowhead used to indicate this type of message is a solid one, like the one below.

An asynchronous message is used when the message caller does not wait for the receiver to process the message and return before sending other messages to other objects within the system. The arrowhead used to show this type of message is a line arrow as shown in the example below.

A return message is used to indicate that the message receiver is done processing the message and is returning control over to the message caller. Return messages are optional notation pieces, for an activation bar that is triggered by a synchronous message always implies a return message.

Tip: You can avoid cluttering up your diagrams by minimizing the use of return messages since the return value can be specified in the initial message arrow itself.

Objects do not necessarily live for the entire duration of the sequence of events. Objects or participants can be created according to the message that is being sent.

The dropped participant box notation can be used when you need to show that the particular participant did not exist until the create call was sent. If the created participant does something immediately after its creation, you should add an activation box right below the participant box.

Likewise, participants when no longer needed can also be deleted from a sequence diagram. This is done by adding an ‘X’ at the end of the lifeline of the said participant.

When an object sends a message to itself, it is called a reflexive message. It is indicated with a message arrow that starts and ends at the same lifeline as shown in the example below.

Comment

UML diagrams generally permit the annotation of comments in all UML diagram types. The comment object is a rectangle with a folded-over corner as shown below. The comment can be linked to the related object with a dashed line.

Note: View Sequence Diagram Best Practices to learn about sequence fragments.

Sequence Diagram Best Practices

  • Manage complex interactions with sequence fragments

A sequence fragment is represented as a box that frames a section of interactions between objects (as shown in the examples below) in a sequence diagram.

It is used to show complex interactions such as alternative flows and loops in a more structured way. On the top left corner of the fragment sits an operator. This – the fragment operator – specifies what sort of a fragment it is.

Alternatives

The alternative combination fragment is used when a choice needs to be made between two or more message sequences. It models the “if then else” logic.

The alternative fragment is represented by a large rectangle or a frame; it is specified by mentioning ‘alt’ inside the frame’s name box (a.k.a. fragment operator).

To show two or more alternatives, the larger rectangle is then divided into what is called interaction operands using a dashed line, as shown in the sequence diagram example above. Each operand has a guard to test against and it is placed at the top left corner of the operand.

Options

The option combination fragment is used to indicate a sequence that will only occur under a certain condition, otherwise, the sequence won’t occur. It models the “if then” statement.

Similar to the alternative fragment, the option fragment is also represented with a rectangular frame where ‘opt’ is placed inside the name box.

Unlike the alternative fragment, an option fragment is not divided into two or more operands. Option’s guard is placed at the top left corner.

(Find an example sequence diagram with an option fragment in the Sequence Diagram Templates and Examples section).

Loops

Loop fragment is used to represent a repetitive sequence. Place the words ‘loop’ in the name box and the guard condition near the top left corner of the frame.

In addition to the Boolean test, the guard in a loop fragment can have two other special conditions tested against. These are minimum iterations (written as minint = [the number] and maximum iterations (written as maxint = [the number]).

If it is a minimum iterations guard, the loop must execute not less than the number mentioned, and if it is a maximum iterations guard, the loop mustn’t execute more than the number indicated.

(Find an example of a loop fragment below in the sequence diagram templates and example section)

Reference Fragment

You can use the ref fragment to manage the size of large sequence diagrams. It allows you to reuse part of one sequence diagram in another, or in other words, you can reference part of a diagram in another diagram using the ref fragment.

To specify the reference fragment, you have to mention ‘ref’ in the name box of the frame and the name of the sequence diagram that is being referred to inside the frame.

For more sequence fragments refer to Beyond the Basics of Sequence Diagrams: Part 1,Part 2 and Part 3.

  • Draw smaller sequence diagrams that capture the essence of the use case

Instead of cluttering your sequence diagram with several objects and groups of messages that will confuse the reader, draw a few smaller sequence diagrams that aptly explain what your system does. Make sure that the diagram fits on a single page and leaves space for explanatory notes too.

Also instead of drawing dozens of sequence diagrams, find out what is common among the scenarios and focus on that. And if the code is expressive and can stand on its own, there’s no need to draw a sequence diagram in the first place.

Colin Wynn
the authorColin Wynn

Leave a Reply