When to ask users to use their eyes to reason by omission?

August 19th, 2011 Simon Segal No comments

An interesting discussion on UI layout came up the other day regarding when / where / how it was appropriate for business rules to surface to the User Interface . The topic of the discussion was based around the value of consistently and explicitly directing user attention to an entities state on a User interface versus omitting information to infer its meaning, where the inference (by way of omission) was extracted from a break to the repetition of the layout. Phew, a mouthful I know but bear with me for just a moment longer!

It would be helpful to the discussion at this point to display the UI in question and then pick it ascompleteapart. I am showing only the relevant portion of the screen that was subject to the discussion, in this case the twenty four hour digital clock. Each line item in this dashboard contains a due time and indication as to the amount of days or months passed or to follow. The screen shot shows three line items where:

  1. Is due in 10 days at 5:38 PM
  2. Is due today at 5:26 PM
  3. Is due in 10 days at 4:16 PM

    Things to note: the ‘number of days indicator’ (below) numberofdaysand digital clock are both right aligned, placed in close proximity to each other and each element is repeated regardless of their values, establishing a unified consistent layout.


    The Debate

    To understate the debate better there is one feature of the underlying business logic that trappedspace_lostrepeatshould be understood first; a high percentage of jobs are turned around in the same day, meaning the ‘number of days indicator’ will exhibit the value of “TODAY” at a high frequency. 

One suggestion in the discussion was that given that the large percentage of due dates would evaluated as “TODAY” then it would make sense to omit it. The logic behind this is that most jobs get done “TODAY” making it almost a default value.  Here (to the left) is what it would look like if we enacted the business logic on the layout of he user interface and looking at the result the converse arguments become clear:

  1. It creates trapped whitespace.
  2. It is less organised through loss of repetition.
  3. It is less unified with the loss of proximity.

The other effect of removing the ‘number of days indicator’ is that users will have to be trained in the rule that the omission has a specific meaning. If most line items would show “TODAY” then its likely that the repetition of the text or trapped whitespace would make it possible to spot the exceptions, however the loss of organisation in the layout through the introduction of trapped whitespace makes it more difficult to discern, even with a ‘squint test’ where the user deliberately searches the screen for the items with an empty value in the ‘number of days indicator’.

In writing this post it also became clear that the upper case rendering of characters in the ‘number of days indicator’ needs to change with a view to making it less cluttered and achieving better contrast with the 24 hour clock.

All in all a very useful discussion where the debate continues testing the principles in place and highlights the need to retain some simple, subtle yet effective design choices that continue to be refactored through the iterations of the application.

Share/Save/Bookmark

Categories: Layout, UI, WPF Tags: , ,

Institutional Resistance to Document Databases

August 14th, 2011 Simon Segal No comments

Perhaps you’re the Development Manager or Architect with an ISV, where the commercial landscape plays into your technology choices constantly. Maybe your product roster is tied to a SQL vendor or possibly more than one. Meanwhile you keep hearing a nagging noise about NoSQL, its been circling the wagons for a while now and a few of the top flight developers in your team just wont stop talking about it. Until now it hasn’t been a fit, all your products are quite mature and well established, your customers are conveniently placated by your choice of SQL Server or Oracle; they too are invested in a particular database product, they have licenses, institutional skill set and divisional product and platform proliferation choices have been made on the theme of unification. Oh, and as far as your product is concerned next generation planning doesn’t seem close at hand.

Change starts within!

Eventually the CEO comes up with a new product idea that has him so excited that your team changesis whipped up to fever pitch on the promise of starting a new application from scratch, the time has come to start popping the greenfield champagne corks in the cubicles on the software development floor. In the earliest of design meetings the noise about NoSQL has picked up ferociously, the senior and junior developers are all beating their chests and pushing hard for the company to agree to adopt this new paradigm for data persistence but you have anticipated your bosses reaction, knowing full well he will have some serious commercial concerns about choosing a NoSQL platform to underpin your data storage; what about the clients and all their institutional dependency on SQL, what about all their quirky integration hacking between your system and someone else’s, imagine the new plethora of support requirements for clients that have barely heard of NoSQL let alone have a administrators with the capacity to manage it…the list goes on.

As a hands on kind of guy you also see the benefits of the NoSQL choice and if you have to write as much data access code as you have routinely over the years (regardless of your fancy dancy ORM) you might just loose interest in this new shiny project. At the end of the day the boss beats you down and the same old reliable safe choices get made for data access and storage, you are left wondering what has to change so this doesn’t become the default position until such time as you retire!

When you think about how long SQL has been ensconced on its throne, the ubiquity of the SQL language and its potential for universal tooling, then question begs, how long would it take to make NoSQL a transferable skill between jobs, enough to permeates IT and seep out of those cracks and into operational non IT staff skill set?

UnQL resume fodder?

The recent news on UnQL has tongues wagging about the potential for a universal language for document databases, should the vendors decide to implement it of course. Nobody in their right mind is expecting this to happen terribly quickly and even if it does eventuate and provide us with the basis of some equally powerful universal tooling that can be found in the SQL world, there is a deep drop between there and crossing the chasm of bureaucratic red tape and all the elements of resistance to change. I wonder how long it is till we see recruiters list UnQL in job ads?

Independent Software Vendors

Storage concerns that bleed into architecture choices as a direct result of commercial concerns can do so in ways that and in-house software team or web 2.0 vendor may not typically havedigital-signage-stock-ticker to consider. There is a degree of user data hacking that ISV’s need to consider upon servicing a wide range of clients who possess peculiar concerns and workflows. This can lead to any given client choosing to customise the software vendors product database. Some ISV’s encourage this behaviour and others don’t, opting for building points of extensibility. Making points of extension available is useful approach but it doesn’t eliminate client resistance when the only integration avenue open to them is constrained by their institutional dependency of SQL.

As a software developer / vendor I find myself often wanting to take advantage of a schema free database but in some instances it represents a potentially commercially damaging choice, one that simply cant be made. The exception might be ancillary tooling in a product suite, applications with small surface area as far as clients are concerned and any projects that fall outside of the scope of client SQL integration needs.

NOTE: I am fully aware that we haven’t yet discussed specialised reporting or BI tooling here in this post and that its more than possible to design an architecture where SQL products are used in conjunction with a Document Database.

Share/Save/Bookmark

Categories: ISV, NOSQL Tags: ,

Modelling Task based Smart Clients Explicitly–Part 1

August 11th, 2011 Simon Segal No comments

Some time ago when I looked into the MVVM pattern I decided it wasn’t the right choice for me, that hasn’t changed since and I don’t expect it to change anytime soon. The burning question for me was “will MVVM suit my needs”?…and the answer was simply no it wasn’t. I should say however that I do very much like the screen aggregator from the MVVM light libraries and consequently use those quite extensively.

So what were my requirements and how did we1 go about addressing them? I spend a considerable amount of my time building task based user interfaces in smart clients and I prefer to do it very explicitly, but lets break that somewhat fluffy abstract statement down a little with the specifics:

  • Explicitly Task Based means all the way from the XAML layout to the supporting C# code
  • Smart Clients commonly incorporate messaging and the use of durable queues.
  • I want to keep the queries and commands very separate in my code
  • I want a Pipeline for handling UI messages to the controllers (think Ruby or Smalltalk)
  • I’d like an environment where developers stay out of each others way.

Now lets pivot on those one at a time (not all here in part 1 however).

Task Based

Task based user interfaces offer the opportunity to model our screens sharply to the intent of codeadvisorythe user. Consider the example of a grid that allows users to change an employees details, such a grid might include property values such as the first name, last name all the way through to the employees position in the organisation. A ‘position’ of finance clerk might very well be organisationally subject to the concept of banding to determine pay scale.

If we provided this grid based screen for users to change an employees position, the grid cell containing the position might be populated by a combo box containing a list of positions defined by the organisation; a user would simply have to change the selection to affect a position move by an employee. But what is actually going on here in this example?…are we really just changing the employees position, or did something else occur in HR to warrant the position change? Lets say the employee was promoted and lets even assume that HR are interested in why the employee was promote…we can see we have a problem now.

It would strike me as highly surprising if any reader hadn’t been ailed at some point with this syndrome, fumbling around in some legacy relational muck, desperately trying to find ways to reason about data in storage, where the meaning of the events in the system have been inexorably lost.

Explicitly

Being Explicit sounds odd at first blush I know, but consider the example of the employee position changing as discussed previously, certainly its an explicit requirement and event; the promoting of an employee may well require the changing of the position held, its a desirable effect of making the promotion, however there could be exceptions and that indicates even greater need to be explicit. What if I were to be promoted notionally?…let’s say a pay rise with no title bump? But still, how do I do that explicitly, sure it sounds explicit but at a code level what makes it explicit? When it comes right down to it its all about interfaces, in particular what Martin Fowler refers to as ‘role’ interfaces.

Roles

Tasks can be very neatly described in a system by defining a role interface, for example I might name the role in our example as IPromoteAnEmployee.

public interface IActInMakingPromotions: IRole {}

the Commands And Query for the Role

public interface ILoadEmployeePositions : IQuery<IActInMakingPromotions>{}

public interface IPromoteAnEmployee : ICommand<IActInMakingPromotions>{}

Executing this intent explicitly might look something like this:

Controller.Handle<IPromoteAnEmployee>();

OR

Controller.Query<ILoadEmployeePositions>();

At this point the controller knows what it needs to do, or at least a container or some reflection code should be able to locate the applicative handler that will execute the logic for this command.

Note: that there are no data arguments to this command and I haven’t yet said anything about queries, certainly many commands will require facilitating data that is supportive to executing a given command. For example, lets consider that in promoting an employee we may well be expecting access to a list of positions to which any given employee might ascend to (or in the case of demotion descend): enter Command Query Segregation (CQS).

CQRS

Some of the significant benefits of using these roles (interfaces) are that it allows you to vary many of the actors in your system concordantly and we can split the handlers for the commands and queries at a code level by leveraging the CQRS pattern. What about DDD then? Well keeping queries and commands separate is something that jives well with DDD, however I should make it clear that in the case of a smart client where messaging is predominant, many of these commands will most likely re-dispatch their intent from the UI controller to an endpoint where the business logic will be handled and in my case that’s usually an NServiceBus endpoint. In the case of queries we could have our handlers do straight up RPC to the data store or via some http API that acts as a facade to a data store.

Command

public class PromoteAnEmployeeHandler : IPromoteAnEmployee
{
    public void Execute()
    {
        var viewModel = Screen.ViewModel.etc;

        Bus.Send<IPromoteAnEmployee>(m =>
        {
           //…message properties set here using view model if required
        });

        //send a message to other views interested
        Messenger.Default.Send(new EmployeePromotionMade()
        {
            //…inter screen message properties set here
        });
    }

    public IScreen<IPromoteAnEmployee> Screen { get; set; }
    public IBus Bus { get; set; }
}

If this were a typical client server system we could also do straight up RPC with the data store if applicable however in the example above I have dispatched a message on a bus (NServiceBus) to some logical endpoint within the HR service.

Query

public class LoadEmployeePositionsHandler : ILoadEmployeePositions
{
    public void Execute()
    {
        var ctx = new EmployeeViewCache(connectionString);
        var employeePosDescriptions= from p in ctx.PositionDescriptions
                                    select new EmployeePosition()
                                    {
                                        Name = p.PositionName,
                                        Id = p.PositionId
                                    };

        var items = new ObservableCollection<EmployeePosition>();

        Screen.ViewModel.PositionDescriptions = items;
    }

    public IScreen<IPromoteAnEmployee> Screen { get; set; }
}

What’s next?

On the basis that brevity is the essence of wit and not wishing to overly tax the attention span of readers, part 2 & 3 will look at pipelines and how that becomes useful, how SOLID principles are served by such an approach, the multi threaded smart client story and why I am happy to accept lots of small chunks of code spread over many files, little islands of single responsibility as I have come to know them. Finally I will look at afferent and efferent coupling and finish up with testability.

1 Mark Harris and I are co directors of QCAT (an ISV) and Lextrico (a consulting business)

Share/Save/Bookmark

Creative Commons Attribution-ShareAlike 2.5 Australia
Creative Commons Attribution-ShareAlike 2.5 Australia