Wednesday, April 26, 2017

3 reasons to use the MVVM pattern

MVVM (Model - View - ViewModel) is a separation pattern that was based on the MVP (Model - View - Presenter) pattern. It's very popular in XAML and some web development camps but is frequently abused.

As a separation pattern MVVM aims to provide 3 specific benefits:

#1 Collaborative working

By separating the visual part of the app (the user interface, or UI) from the related code it becomes possible to have specialists in each area work on related items at the same time. The theory is designers can work on the UI at the same time as developers are working on the code without needing to have them both work on the same files at the same time.
Unfortunately, very few people see this benefit as they don't work in teams or on projects where the are enough people with specific skills on the design and development sides that they can work on both simultaneously.

#2 Code reuse

Doing the same thing multiple times gets boring quickly.
Having the same code in more than one place creates a duplication of effort when the code if first created and adds extra effort to maintain the different copies of the same (or very similar) code.
As a separation pattern, one of the intentions is that it allows the different layers to be reused. The model layer is the most obvious candidate for use in multiple apps or versions of an app (i.e. for different platforms) but ViewModel should be able to be reused as well. If you're only building a single app for one platform you have an excuse for ignoring this but if your ViewModels could be being used on multiple platforms then they should be. The biggest barrier to being able to do this is having ViewModels that reference or are strongly tied to something in the View layer or the UI of a particular platform. The associated downside to this is that it also makes testing hard.

#3 Ease of testing

One of the long-time criticism of apps with graphical UIs is that they are hard to test. A separation pattern, like MVVM, should break the coupling between the application logic and the UI and so make testing more accessible. It shouldn't be necessary to do all testing via the UI and so tests become quicker and easier to set up and run. Sadly, many developers using the MVVM pattern still aren't getting the benefits that come from automated testing. Or, they're still creating links between the layers of the app that make automated testing much harder than it need be.

It is disappointingly common that I see apps and developers who are not getting any of the benefits mentioned above. Such developers are still enthusiastic about the pattern and encourage others to use it because of secret bonus reasons numbers four and five.

bonus #4 Bindings make UI updates easier to handle

Bindings simplify many of the challenges of manipulating data, capturing entered data, and monitoring changes. While definitely useful, this shouldn't be the only benefit you get from the MVVM pattern.

bonus #5 Ease of maintainability

By having a separation between the different parts of an app's code it brings a level of structure and uniformity to the code. It's easy to see where things should go or where they're likely to be. It also encourages the use of other patterns (dependency inversion, services, messaging, etc.) and so brings the benefits of good development practices. These aren't unique to the MVVM pattern. The benefits come with almost any architectural pattern that is followed and applied to a codebase.

Just because your code has some classes with the suffix ViewModel that you bind to your views doesn't mean that you are getting the full benefit the MVVM pattern could be providing.
This may or may not be an issue but I can almost guarantee that your codebase would be better served by having more tests. ;)

Do you use the MVVM pattern? What benefits do you get from it?

Tuesday, April 25, 2017

Book Update: New Title and 50% off *TODAY ONLY*

My book has a new title:
Usability Matters: Practical UX for Mobile Developers and other Accidental Designers.
Feedback tells us that this better fits the content and better communicates this is a book for mobile developers. Not a book for people who currently consider themselves designers or UX experts.

The updated cover

For today (April 25th) only it's part of Manning's Deal of the Day. Pre-order for half price with code dotd042517au at

Sunday, April 02, 2017

Windows Phone support ends in 100 days

Yes, on July 11th, 2017 support for Windows Phone 8.1 will finally end.

Ok, so not many of you are still using Windows Phone devices anymore, but this may matter for those of you who are. Like, say, if you've got several hundred in your organization.

What does support ending mean?
The end of support means that no new updates, including security updates, will be made available. The release of Windows 10 means that I doubt you were expecting any more updates anyway but if you're using these devices as part of running your business then a lack of security updates might be important. See the official support notes for more.

What if you are affected?
Update any impacted devices to Windows 10 Mobile if supported by the hardware. (See this guide from AAWP for how.) If not then you should start thinking about replacing that hardware. It's several years old now anyway.

Sunday, March 12, 2017

Playable ads - a cynical response

This week, Microsoft announced support for playable ads for Windows apps.

I totally believe this is a good thing, but I have some cynical observations to the announcement. Some of you who read this will be aware of my cynical take on things and have even reported to liking my alternative points of view.

Let's look at some of the announcement:
"The information contained in the product description page is not always complete and the experience a user can get from the actual app usage can potentially differ a lot. This sometimes leads to a quick uninstall if the promise of the product description pages is not met."
Yes, some Product Detail Pages (PDPs) are not great. If they're "not complete" and not representative of the actual app, then something should be done about them as they are. Just adding playable versions of the app/game isn't necessarily the best solution.

"Playable Ads are a completely new way for end users to interact with ads and apps."
They're only "completely new" on Windows. They've been on other platforms for ages. (See a few iOS screenshots below.) It's good to see Windows/Microsoft catching up.




"the user can interact with the app as if it’s already installed on his/her device"
With some (almost guaranteed) exceptions and limitations which aren't mentioned here.

"Why are these ads better? - Users will not leave the current app context after ad click since these are inline expandable ads."
This doesn't make it better than another ad. This makes it better than leaving the app to try something. There's a debatable argument about who this is better for.

"Users who install the game after three minutes of engagement are more inclined to use the game/app than those who just installed the app based on the product description page."
I'm not 100% on this. It seems a strange argument. It appears to be that people who have tried an app will use it again once they've installed it. I can see that point, but it's arguing against people who have installed it but not tried it.
More interesting and compelling would be a comparison between people who install after seeing a static ad VS a playable ad. I'd totally expect someone who completes the playable ad to be more likely to install the app. How this compares to people who install after just seeing the PDP is interesting. I would have thought the aim was to get people interested enough to install. It seems to imply there's a significant drop-off after people install. Do lots of people really install the app but never launch it? It would be interesting to see some stats on this. If it really is an issue then yes, I'd believe that people are more likely to remember something they've installed if they've tried it before than something they just liked the look of from a PDP.
There's also the issue of what led a person to the PDP in the first place, but that's too big a tangent to explore now.

"we believe that users acquired via playable ads will have a higher life time value compared with users acquired through the regular channels."
App development and promotion are a business. We want facts and statistics, not untested beliefs.

"As an end developer, you don’t have to do anything! No new packages, nothing. Microsoft does all the background work to give a seamless experience to the end users without you, the developer, having to change anything."
It might be that for some apps you don't have to do anything to make this work, but that won't be the case with all apps. Even if you could implement this without having to do anything you probably don't want to. Remember back at the beginning when these were seen as a solution to incomplete PDPs? A successful, high-performing PDP takes lots of work and effort. If you're not prepared to put in any work to creating the best trial experience, then you can't expect them to be super successful for you.

Also, don't ignore that for some apps playable ads may not be appropriate or possible. If they are something that could work for your app, then give them a go. Just remember that there are no magic bullets. ;)

Monday, March 06, 2017

Quickly add some text for testing

Sometimes I need a lot of text in a control to test something. For something very short I'll just mash the keyboard a few times but when I need something longer a bit more effort is required.
I thought there needs to be something that can generate some text (say, some Lorem Ipsum) when it's needed.
My initial reaction was 'how hard can it be to make such a thing'? But then I caught myself and realized someone must have done this already.
It turns out there are a few.

I chose to use NLipsum.

It's really easy to get it to return some text. Just the following is enough.


In case it wasn't obvious, this was a quick post to remind me about this and I thought it was cool and useful enough to tell others about.