Channels ▼
RSS

Design

Event-Based Architectures

Source Code Accompanies This Article. Download It Now.


Wiring Diagrams

When you develop an EBA, most of the exchanges between the parts are based on notifications. Keep in mind that notifications can be exchanged between parts that don't reference each other. If you used a class diagram to describe this system, it would tell you little about how the system works, because there would be few or no associations between the classes. You would essentially end up with a diagram just listing all the classes, with no lines connecting them. A better way to document EBAs is to use "Signal Wiring Diagrams" (usually just called "Wiring Diagrams") which show who sends signals (notifications) to whom. I developed wiring diagrams several years ago to better model EBAs; see Figure 2.

The large boxes in Figure 2 denote objects. The names in the boxes show the object types. The small black boxes on the object borders are pins. Pins are the inputs and outputs of an object, in terms of notification signals. Each signal has arrows to denote the direction of flow. A small label above the signal line indicates the name of the notification. In Figure 2, the signal Print is sent from PrintManager to DocumentPrinter. Input pins can also contain the name of the method they connect to. You may have noticed that there are no interfaces shown in the diagram. When notifications are sent using untyped calls, interfaces are not involved. PrintManager doesn't know anything about the DocumentPrinter type. Indeed, PrintManager need not even know that DocumentPrinter is handling its Print notifications.

[Click image to view at full size]

Figure 2: A simple wiring diagram showing untyped call notifications.

When notifications are sent using typed calls, interfaces are involved. In such cases, the interfaces are shown as gray boxes enclosing the pins that are associated with the interface methods; see Figure 3.

[Click image to view at full size]

Figure 3: A wiring diagram showing typed call notifications.

Signal wiring diagrams get their name because they look like hardware circuit diagrams used by electrical engineers. Software objects look like integrated circuits, with input and output pins. Notifications appear as interconnection wires. From a systems perspective, both hardware diagrams and signal wiring diagrams are representations of systems composed by parts wired together. Whether the boxes are implemented with hardware or software matters little, conceptually. The software objects might be replaced by hardware equivalents, with minimal changes to the overall diagram. Figure 4 shows the complete wiring diagram of SystemBrowser, a program I present in this article.

[Click image to view at full size]

Figure 4: The wiring diagram of SystemBrowser.

You can find a Visio stencil for wiring diagrams online (see www.ddj.com/code/ and www.faisoncomputing.com/samples/ EventBasedProgramming/VisioSignalWiringDiagramStencil.zip).


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video