Exploring quality in software architecture

Strength, utility and beauty.  Here we will be exploring a number of the traditional “ilities” of software architecture and seeing how they can be related to these three architectural qualities.  These three qualities have been around for quite a while, under their Latin names of firmitas, utilitas and venustas, and were first written about by Vitruvius.

Now architecture is always created with the intention of supporting something, e.g. an application (in the case of application architecture) or a business (in the case of enterprise architecture).  For brevity, I’ll refer to “the thing which the architecture supports” as “the system”, although I believe that my points here relate to all types of software architecture.

Utilitas, or Utility: Functional and behavioural aspects of the architecture

The architecture needs to guarantee that the system can perform operations in a certain manner.  Architectural aspects which achieve this are:

·         Availability – expected levels of uptime that the architecture can provide

·         Auditability – keeping a log of changes and operations within the system.

·         Correctness and verifiability – sometimes operations within the system can be externally verified.  The architecture needs to support and pass such verification.

·         Environmental compatibility – the architecture needs to fit into its environment, e.g. there may be a high latency network which needs to be considered

·         Performance – how quickly operations can be performed

·         Security and confidentiality – authentication and authorisation

·         Transactionality – the architecture needs to ensure that operations are atomic

A person can only really be called an architect if they can design an architecture that works, i.e. displays these aspects.

Firmitas, or Strength: Non-functional aspects of the architecture

In addition to supporting the operations of the system, there are a number of further considerations for architecture:

·         Adaptability – how well the architecture can cope to evolving situations without being changed

·         Efficiency – how well does the architecture use its resources such as CPU, memory, bandwidth, etc

·         Extensibility – how easily can the architecture be extended and changed

·         Maintainability – this is really just a combination of extensibility and understandability.  If an architecture is easy to understand and easy to change, then it is easy to maintain.

·         Recoverability – is it possible to reconstitute the state of the system after a disaster

·         Reliability – how stable is the architecture under normal circumstances

·         Resiliance – how stable is the architecture under abnormal circumstances

·         Scalability – can the throughput of the system be increased without requiring changes

·         Understandability – how easy is it to comprehend the architecture

Really good architects manage to incorporate these aspects into architecture they design.

Venustas, or Beauty: Aesthetic aspects of the architecture

Beauty, as a quality, is practically impossible to define objectively.  “Beauty is in the eye of the beholder”, as the saying goes.  However, you do know beauty when you see it.  Here are some points which I think contribute to making architecture beautiful:

·         Conceptual integrity – sometimes called the principle of least surprise, there should be an underlying theme or vision that unifies the design of the architecture at all levels

·         Elegance – closely related to simplicity, elegance implies a certain understated effortlessness

·         Simplicity – an architecture should be as simple as possible, but not simplistic

An architect that can incorporate these aspects into a design that also displays utility and strength, is really one of the greats.

And so what?

And so we have a bit of a framework for inspecting the quality of architecture.  I don’t regard all of these aspects as quantitative, but at least we can discuss architecture in qualitative terms.  In my next post, I’ll be discussing some of the specific considerations of iterative development of software and how these points here should influence that process.

October 19 2007

What makes a good (software) architecture

Lately I've been investigating software architecture with regard to how it can impact on an agile development project. I recently read (here) a very short list that resonated really powerfully with me and describes key architectural virtues (explanations are mine):

  • Strength - reliable, secure, resilient to change
  • Utility - must deliver either business value or (more likely) developer productivity
  • Beauty - easy to understand and communicate, clean design, minimal

It turns out that these ideas have been around for quite a while, under their Latin names of firmitas, utilitas and venustas.

I hope to produce a series of blog posts detailing my thoughts and expanding on some of these points, including why I think this question is especially relevant to iterative development.

September 11 2007

SAPI: Speech synthesis on Vista

The MIX07 Keynote includes a brief screen capture from the Daily Mail eReader and reminded me that I had meant to blog about the speech synthesis portion of the app.  It's something which many users might not have seen, because it's only available on Windows Vista.  Vista includes the Speech API (SAPI) version 5.3 which provides a text-to-speech (TTS) engine which is greatly superior to SAPI 5.2 which shipped with Windows XP.


How it looks 

The way the UI works is pretty straightforward - it's meant to mimic an autocue.  So a user will trigger the functionality and the window you see on the right will appear.  As the user's computer begins speaking the news story, the text will slowly scroll up.  The word currently being spoken will always be bold and will always appear in the letterbox.

I'm personally a bit tickled that this bit of UI made it into Ray Ozzie's keynote presentation (even if it was only for about a quarter of a second) because I developed this part of the eReader and wrote this UI.

Getting SAPI to produce speech

The TTS functionality is actually quite easy to kick off.  All it takes is a call to the appropriate function, passing in a string holding the text to be read, and SAPI will begin to speak.  Specifically, .Net 3.0 provides a System.Speech assembly which does all the hard work for you.  This assembly includes the class System.Speech.Synthesis.SpeechSynthesizer which has a method public void Speak(string textToSpeak).  This is easy to use if all you want is text-to-speech.

The problem is that this is a synchronous call.  So the call will block until the speech rendering is complete.  To get around this, the SpeechSynthesizer class also includes a method SpeakAsync.  This does pretty much what you'd expect and runs the TTS activity on a background thread.

Getting updated with TTS progress

Now the SpeechSynthesizer class even provides some helpful events relating to the progress of the speech rendering.  However, it turns out that the SAPI libraries regard these events as sort of incidental to their main job - i.e. they will raise the events when they can.  So there is every possibility that these events will occur some time after the actual speech rendering of a word (or phoneme, etc) has started.  The SAPI library also seems to stop raising the events altogether, if the event handlers are consuming too much time.  This was probably a design decision made by Microsoft that the quality of the speech shouldn't be affected by calls to user code.

This last point means that you need to be very careful how you write your event handlers.  I suspect that a fair amount of time is consumed with the transition from the unmanaged SAPI libraries back into the System.Speech assembly, which doesn't leave much time for your C# code to do anything useful.  It certainly doesn't leave enough time to update a XAML UI.  The initial approach I used would update the UI with about 2 or 3 words and then UI updating would cease altogether.

The solution was (a) to be very, very careful to write efficient code; (b) use the Output window for debug info rather than trying to break into the running code; and (c) make good use of asynchronous delegates.  The SAPI events are called on a background thread, which means that a Dispatcher.Invoke call is needed before code can update the UI at all.  So the simplest solution was to replace this with a Dispatcher.BeginInvoke call which then updated the UI asynchronously to the event handler.

Constructing the UI

It took a little bit of trial and error to get a XAML UI that could efficiently update without continually doing a lot of layout work.  Ironically, the grey letterbox with its opacity and the opacity gradient of the textual content were the easy bits!  And getting a thick window border of Vista glass was also pretty trivial. The part which took some effort was working out that to display the content I needed to use a ScrollViewer control with three separate Run elements - one for the text which had been read, one for the text being read and one for the text which is still to be read.  The updates from the TTS engine can then simply be translated into shuffling characters between the various Run elements.

Getting the highlighted word to stay in the letterbox also took some trial and error.  The solution lay in the following line of code:

Rect screenPosition = CurrentlyReadingRun.ContentStart.GetCharacterRect(LogicalDirection.Forward);

This gave me the screen co-ordinates of the currently bold word, which I then used like so:

_scrollViewer.ScrollToVerticalOffset(screenPosition.Top + _scrollViewer.VerticalOffset - _paddingHeight);

May 10 2007

MOSS: Error "The handle is invalid" when starting Windows SharePoint Services (WSS) Search service

If you attempt to start Windows SharePoint Services Search service and receive the following message:


Try modifying the Log On Identity of the service.  In my case, it was setup to log on as "Local Service".  After I changed this to "Local System", the service started without any errors.

Note that this error message was received from the Services Administrative Tool.  The WSS web front-end simply hung when attempting to start the WSS Search service.

February 16 2007
Newer Posts Older Posts