Previous: , Up: The Alarm System   [Contents]


2.6.6 The Completed Alarm System

Below is the Dezyne-generated sequence diagram, and event trace listing, from simulating a complete round-trip exercise of the Controller component. Events included sounding the siren when the user did not enter a valid pincode soon enough after an alarm was triggered, and returning at the end to the disarmed state. (Screen shots were edited for better readability.)

images/sequence_1

We finish the alarm system by creating a top-level system component that shows how the other components interconnect through interfaces. This system component presents the iController interface to the yet larger software system into which it might be integrated. For this tutorial, the system component’s purpose is only to auto-generate the diagram shown below the code.

component AlarmSystem {
  provides IController iController;

  system {
    Controller controller;
    LED led;
    Sensor sensor;
    Siren siren;
    Timer timer;
    iController<=>controller.iController;
    controller.iLed<=>led.iLed;
    controller.iSensor<=>sensor.iSensor;
    controller.iSiren<=>siren.iSiren;
    controller.iTimer<=>timer.iTimer;
  }
}
images/system_3
Refactoring and Extending Dezyne Models

Dezyne models capture fundamental logical behaviour in perhaps a quarter of the lines it takes to write the same logic in compatible and usable C++. The five Dezyne models in the alarm system all have tens of lines of code each. Because Dezyne model representations are compact, easily edited and complete/compliant, they make refactoring ant extending as easy as it could possible be. Further, because Dezyne quickly verifies any change or addition to an existing model, the pace of refactoring and extending is as fast as it could possibly be.

Comparing Using Dezyne to Developing “By Hand”

Think about having to develop this system “in the other direction”. You’d likely start with sketched sequence diagrams, which are tedious and difficult to draw manually and modify. From there you would specify and write the C++ source code, and build and test is. Along the way you would almost certainly rebuild the sequence diagram by hand more than once.

Eventually a test/verification persom would have to manually generate event sequences to exercise paths through the system. That person could take weeks or months to do what Dezyne did in a few seconds: trace out every possible execution path through the system and ensure there are no race conditions, deadlocks, non-deterministic overlaps among guards, or other problems.

In fact, for anything but the smallest system, your test/verification staff will probably NEVER accomplish what Dezyne has done in seconds or minutes, which is attain 100% path coverage for the heart of the system, its core states-and communications logic. This is the power of Dezyne


Previous: , Up: The Alarm System   [Contents]