Output42 was recently contracted to create a line-of-business application by one of its largest customers. When we saw the spec we knew this was going to be a difficult one. The task was to replace a spreadsheet-based system. One of those, which users would have pried from their dead, cold hands before they gave them up. When faced with such a challenge the only way to succeed is to outdo the competition in every possible way. At the same time it is important to deliver a clean, well engineered solution that will be easy to maintain and extend in the future.

The customer had a strong preference for the user interface to be implemented as as Windows desktop application. After much deliberation we decided to give WPF a try. Some of the principles behind make it easy to design an application well. That’s of course if you follow the recommended design pattern: Model-View-ViewModel. It is a concept which derives from the ages-old Model-View-Controller pattern, and modifies it to work with perhaps the most important new concept in WPF: the binding.

If you delve deeper into the WPF design concept, you will find out that it is significantly different from Microsoft’s previous UI frameworks. Or anybody else’s for that matter. Whether you’re coming from the MFC or Windows Forms world you need completely change you way of designing desktop applications if you want to use WPF’s new capabilities efficiently. Ivan Towlson probably describes it best:

Windows Presentation Foundation isn’t just a new control library – it’s a radically new architecture.

The other very important concept, which builds on top of binding, is commands. Granted, there are many other important concepts in WPF, like events, triggers, resources, etc. In fact Christopher Estep has got them nicely catalogued for you. But between binding and commanding WPF helps to solve the most important problems of business software design: clean design, clear interfaces, separation of concerns and encapsulation. It does that mostly by making it easy to separate the UI design from the underlying business logic.

In fact not only do WPF and MVVM facilitate clean design. They encourage it. To me as a developer it is a big deal. It allows me to design well and use the the UI framework the way it was intended to be used, rather than work against. It also directly affects hundreds of tiny decisions we make each day as developers when we write code, steering us towards a better design and better software in the end. Very much the way Jeff Attwood and Brad Abrams talk about it as the “pit of success”.

Next time: is it really all sunshine and roses?

 

Comments are closed.