Feeds

In the beginning, there was the flowchart...

Software diagramming - a warning from history

  • alert
  • submit to reddit

Maximizing your infrastructure through virtualization

State of the art

From the foregoing, you may have formed the impression that I am against all diagrams. Not so. The moment is overdue for a mention for the queen of all software diagrams: the state transition.

Out of all the techniques I have described, only the state transition diagram really delivers. It alone can show compressed ideas that would otherwise be hard to express, and it is one of the few diagrams one can draw to design the program, rather than put together retrospectively to document a design one has conceived in another form.

Enough abstract discussion. As a concrete example, here is a state transition diagram I drew a few years ago, portraying the automatic call handling system of a customer care centre:

A large state transition diagram, implying that customer care centres never pick up the phone

I feel sure you agree that this diagram is a paragon of terse clarity.

In fact, equipped with the above, one has all the information needed to design the system's classes. An excellent opportunity to segue into another kind of diagram: the UML class diagram. To keep up the standards of good practice you expect from me, I will (of course) use the Gang of Four's famous State pattern to create my design. Here we go:

An animation of a UML diagram, suggesting that the classes are drawn too close together and are wriggling for more room

Those of you who are watching carefully will notice a slight drop in clarity of intention and available information between the state transition diagram and the class diagram derived from it.

To be fair - and with considerable reluctance - I admit that this is not really the fault of the UMLerites. It is an unhappy consequence of the way the State pattern works that the underlying design is buried in a blizzard of silly little classes. This difficulty is reflected in the production code.

Public Service Announcement: fellow programmers who experience this genuine problem in real life, and who code in C, C++, C#, Java or one of seven other languages, should urgently haul their sorry browsers down to smc.sourceforge.net and pull down a copy of Charles Rapp's splendid State Machine Compiler. This elegant utility, easily bodged into the build, allows you to work directly from your state transition design, without bothering your pretty head with the implementation of the State pattern. Once you have tried it, I promise you will never hand-code State again.

Now let us continue, while we bring the flowchart into the modern era...

The Power of One Infographic

Next page: OMG it's UML

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
DARPA-derived secure microkernel goes open source tomorrow
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Top 8 considerations to enable and simplify mobility
In this whitepaper learn how to successfully add mobile capabilities simply and cost effectively.
Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.