Tuesday, June 26, 2007

Test Driven GUI Development

I read an interesting article today about test driven development and GUI applications. Unit testing is rarely seen in the context of user interfaces because the presentation and business logic are often tightly coupled. Many developers view the task as being too difficult or not worth the time. However, with the right tools and the right client architecture, test driven development is really quite simple and can help to build quality into your software.

Download one of the presenter first examples available from Atomic Objects and you'll quickly see just how easy test driven GUI development can be.  Also take a look at NMock.

Technorati Tags: ,

WPF Commands

Irena Kennedy has a WPF ApplicationCommands sample on her blog. The sample is very simple but shows how to hook cut/copy/paste/undo/redo commands for a textbox in WPF. However, there are some minor issues. The sample explicitly sets the command target which prevents each of the commands from targeting the control that has focus. A better approach is to add each of the commands to a toolbar or menu:

    <MenuItem Header="Edit">
        <MenuItem Command="ApplicationCommands.Cut" />
        <MenuItem Command="ApplicationCommands.Copy" />
        <MenuItem Command="ApplicationCommands.Paste" />
        <MenuItem Command="ApplicationCommands.Undo" />
        <MenuItem Command="ApplicationCommands.Redo" />

Menus have native support for ICommand.CanExecuteChanged so the MenuItems correctly reflect ICommand.CanExecute using Control.Enabled.

Have a look at the Commanding Overview in the MSDN for more detailed information.

Technorati Tags: , ,

Wednesday, June 20, 2007

Windows Live Writer

I'm testing out the latest beta for Windows Live Writer and so far it looks great. The main advantage is WYSIWYG editing of blog entries since Live Writer downloads style information from your blog. My only pain at the moment is that Blogger doesn't support image uploads!

Technorati Tags:

Zurich Airport

Check out the Zurich Airport XBAP. WPF really is a whole new world. Also take a look at Silverlight Surface.

Dominoken XBAP

I’ve been having a play with some WPF & XBAP code lately. If you haven’t heard of XBAP, it's a smart client technology that allows you to deliver rich WPF applications via web browser. Take a look at this impressive app I found courtesy of Bascule. Note that if you’re not running windows vista, you might need to install .NET Framework 3.0 but the XBAP will prompt you to install the bits.


Technorati Tags: , ,

Wednesday, June 6, 2007

Acropolis CTP

I've had an initial look at Acropolis and I must say that it's very interesting. It has a strong SCSF influence but the experience is simplified and improved. Acropolis provides a DSL to help you assemble the components in a module. With SCSF, you needed to assemble a module in code using a WorkItemController. Acropolis achieves the same result by providing a design surface with drag and drop to configure services, views, connection points etc.

Acropolis provides product line templates, targeting different application types. When you create an acropolis solution, you nominate the targeted product line, e.g. document based application, wizard based application, etc. You then use a wizard to configure the application workspace and user interface extension sites. For example, you could choose a document style application with tabbed workspace, a main menu bar and a status bar.

Inside your application, there is a very clear distinction between views and business logic. Acropolis provides a DSL for designing parts. A part is similar in concept to the view & presenter combination in SCSF. However, you use the part DSL to configure connection points between the view and presenter. In this context, a connection point could be a data provider, notification, property etc. The idea is that you can define the relationship between view and business logic in a very concise way.

WPF plays a pivotal role in Acropolis. Don Box wrote an interesting blog entry that highlights the role of WPF in separating model, view and presenter. Acropolis formalizes this approach by introducing a design surface and components that lead to clear MVP separation.

Remember that although XAML is the enabling technology for WPF, it is only mark-up and is ultimately used to generate code. With code and partial classes, you can write whatever rubbish you like under the bonnet. WPF and XAML are a great part of the overall solution but insufficient on their own to make sure that developers correctly follow the MVP pattern. The DSL introduced in Acropolis goes a long way towards bridging the gap.

Checkout the video introduction on Acropolis and if you're interested, download link for the Acropolis CTP.

Technorati Tags: ,