April 15, 2008
Unit Testing User Interfaces - Presentation Model
As mentioned in the introduction, I'm going to attempt to unit test my presentation model example application first. Of all the presentation patterns I've looked at, I'm expecting the presentation model to be the easiest to unit test.
Challenges
By extracting view state and logic from the view, presentation model classes do not have any dependencies on view classes. They do sometimes have dependencies on each other, so test doubles may be required to isolate the functionality in one presentation model from functionality in another.
Continue reading "Unit Testing User Interfaces - Presentation Model"
Posted by paulw at 02:54 PM
| Comments (1)
| TrackBack (0)
March 24, 2008
Unit Testing User Interfaces - Introduction
You may have caught my last series in which I looked at six different patterns for organising view logic in a Flex client. In this series I'm going to take the demonstration applications for three of those patterns and look at the changes required to effectively unit test them. The aim of the exercise is to gain an insight into how amenable each pattern is to unit testing and hopefully wrestle with some common unit testing challenges along the way.
Continue reading "Unit Testing User Interfaces - Introduction"
Posted by paulw at 01:25 PM
| Comments (0)
| TrackBack (0)
February 03, 2008
Presentation Patterns - Conclusions
Towards the end of last year I took a look at six contrasting patterns for organising presentation logic. Some of these patterns are well known and popular in the Flex community, others are very rarely discussed. If you know of any other presentation patterns that you feel are worth looking at more closely it would be great to hear about them.
Continue reading "Presentation Patterns - Conclusions"
Posted by paulw at 11:55 PM
| Comments (2)
| TrackBack (0)
November 29, 2007
Presentation Patterns - Passive View
Like the Supervising Presenter, the Passive View pattern is a derivative of Model View Presenter (MVP). Martin Fowler split MVP into separate patterns to highlight two common approaches for realising MVP.
The Passive View pattern also has some similarities with Code Behind since both achieve a complete separation of ActionScript and MXML.
Continue reading "Presentation Patterns - Passive View"
Posted by paulw at 07:20 AM
| Comments (2)
| TrackBack (0)
November 15, 2007
Presentation Patterns - Code Behind
Code Behind is a somewhat vague term that means different things to different people. I believe it was originally coined by Microsoft to describe any strategy for separating logic from content in ASP pages. Using this broad definition it could be argued that the Supervising Presenter, Presentation Model and even the View Helper are all examples of the technique. So this interpretation of code-behind lacks the sort of precision we require to discuss it as a pattern.
However, one of the most common methods for achieving code-behind in ASP and .NET uses inheritance: Presentation logic is extracted out of the view class, and into the view's superclass. The technique has been brought over to the Flex world and is arguably one of the most talked-about and advocated presentation patterns. It is this "code-behind pattern" that I am going to look at today.
Continue reading "Presentation Patterns - Code Behind"
Posted by paulw at 07:04 AM
| Comments (9)
| TrackBack (0)
November 05, 2007
Presentation Patterns - View Helper
While looking at the Supervising Presenter and Presentation Model patterns it occurred to me that some people may find these concepts reminiscent of the View Helper pattern that enjoyed a spell of popularity in some Cairngorm architectures. Since the View Helper is now regarded as 'not recommended', I want to take a closer look at the pattern and try to understand why it may have fallen from favour.
Continue reading "Presentation Patterns - View Helper"
Posted by paulw at 09:32 AM
| Comments (1)
| TrackBack (0)
October 22, 2007
Presentation Patterns - Presentation Model
The next pattern I want to look at goes a step further than the Supervising Presenter by moving logic and state out of the view. Once again discussed by Martin Fowler, the Presentation Model has its roots in the Model-View-Controller (MVC) pattern.
A presentation model is an ‘abstraction’ of a view. In other words, the model represents the behaviour and state of a view, without getting involved with any of that messy graphical stuff. The view represents a projection or rendering of the model onto the screen. When changes occur in the presentation model, the view updates itself on-screen.
Continue reading "Presentation Patterns - Presentation Model"
Posted by paulw at 08:15 AM
| Comments (2)
| TrackBack (0)
October 13, 2007
Presentation Patterns - Supervising Presenter
Like the Autonomous View, this is another one of Martin Fowler's patterns. He calls it Supervising Controller, but suggests the alternative name of Supervising Presenter. I'm voting for the latter for the following reasons:
- This pattern is a derivative of the Model-View-Presenter pattern rather than Model-View-Controller, so 'Supervising Presenter' seems a more suitable name.
- Due to excessive overloading, the meaning of the term 'controller' in UI architecture discussions has become somewhat vague.
- The 'Presenter' object is neither a controller in the J2EE / Model-2 / Cairngorm sense of the word, nor does it have much in common with the controllers from the original Smalltalk-MVC architecture.
Continue reading "Presentation Patterns - Supervising Presenter"
Posted by paulw at 09:10 AM
| Comments (5)
September 30, 2007
Presentation Patterns - Autonomous View
So as I mentioned in the introduction, the first pattern I'm going to look at is known as 'Autonomous View'. Of all the patterns I'll cover, this one is likely to be the most familiar to Flex developers. Although Martin Fowler coined the name, the idea behind the Autonomous View pattern has been around for quite some time. For the Flex framework, the Autonomous View represents the de facto architectural pattern. If you're building your first Flex application, you'll probably be following the Autonomous View pattern without even knowing it.
Continue reading "Presentation Patterns - Autonomous View"
Posted by paulw at 09:11 AM
| Comments (2)
September 23, 2007
Presentation Patterns - Introduction
A recurring theme on forums like flexcoders is the issue of user interface architecture within Flex applications. Rich-client applications developed using frameworks like Flex are something of a departure from 'traditional' web applications, so the architectures employed for such applications will inevitably differ. But not so long ago we were comparing the new concept of web-application development with that of 'traditional' rich-client applications and arriving at very similar conclusions. We have come full circle, from rich-clients to web-clients and back again. So what lessons can we learn from the 20 or so years of rich-client development preceding Web 1.0? And are there web-application patterns that translate across to the rich-client world?
Continue reading "Presentation Patterns - Introduction"
Posted by paulw at 12:25 PM
| Comments (1)