Windows
Video: Phone developers should use the cloud
When you think about the monetization (awful word!) of apps for the phone, you can narrow it down to either:
The app is free – it was fun building it, I don’t want to be rich.
The app is paid for and entirely standalone. It doesn’t rely on any service that is firmly rooted in terra firma.
The app is free, but you pay for the service that is delivered through the app.
There are a few others which are basically combinations of the above. It’s the last one, and its variants, that probably scares a lot of phone developers off because it' has more to do with running a service and the phone app is probably the smallest part of the whole thing. Running a service means service management: making sure it’s still running, capacity planning, scaling, and obvious bread-and-butter jobs like patching, service packs, security fixes and so on.
Although the responsibility of continuing to provide a service to customers of your app still rests with you in these scenarios, PaaS cloud operators truly take away almost all of the time-consuming, headache-inducing part of running a reliable, scalable, available service.
I’ve made a video to describe the benefits and the approach to how a phone developer can deliver services which run in massively scalable, multi-million-dollar cloud-computing-datacentres and test out their ideas for just a few pence, or in many cases, using free cloud service trial subscriptions – meaning the only risk they endure is the time they spend developing the service.
Have fun
Planky – GBR-257
Cross-posted to the Plankytronixx blog.
Article: Windows Phone–Updated Patterns and Practices Guidance
I’ve just spotted that the Patterns and Practices guidance for Windows Phone on MSDN has been updated this month. This includes the use of the MVVM pattern as well as designing for testability (see Sara’s post from earlier today for more details) and a case study that tackles many advanced topics in some detail.
It’s part of the broader Patterns and Practices guidance on MSDN and is well worth checking out if you’re building Windows Phone applications.
How to: Building Testable Windows Phone Applications
by David Britch
Introduction
The purpose of this technical article is to demonstrate how to build a testable Windows Phone application that consumes accelerometer data. The approach adopted here for building a testable Windows Phone application is to:
1. Abstract the Windows Phone SDK class that provides the desired functionality for the application.
2. Consume the wrapped class in an application.
3. Write unit tests that test application business logic.
The key to building testable Windows Phone applications is to abstract the classes in the Windows Phone 7.1 SDK. An interface can be generated for the required class in the Windows Phone 7.1 SDK that contains the desired functionality for your application. Adapters, which are wrapper classes that implement the generated interface, can also be generated. Adapter classes pass parameters and return values to and from the underlying Windows Phone 7.1 SDK class. The adapter translates calls to its interface into calls to the original interface. Creating adapters enables you to write loosely coupled testable code.
Example
The Accelerometer class provides access to the device's accelerometer sensor, which will detect the force of gravity along with any forces resulting from the movement of the phone. However, this class is not easily testable. To create a testable version of this class you should adapt the class, and then create a mock for it.
The interface for the Accelerometer class is not available in the Windows Phone 7.1 SDK. Therefore, the IAccelerometer interface can be generated from the Accelerometer SDK class by using a Reflector add-in named Doubler. Doubler is a code generator which can generate a wrapper class and its interface for a chosen type in an assembly. The generated IAccelerometer interface contains the properties, the method signatures and the event implemented by the Accelerometer SDK class.
The IAccelerometer interface can then be implemented by the AccelerometerAdapter class, which can also be generated by Doubler. The AccelerometerAdapter class adapts the Accelerometer class from the Windows Phone 7.1 SDK. The following illustration shows how the AccelerometerAdapter class adapts the Accelerometer SDK class.
The AccelerometerAdapter class implements the IAccelerometer interface. Any classes that want to consume the Accelerometer class to obtain sensor data should consume the AccelerometerAdapter class instead.
These classes are available in the Microsoft.Practices.Phone.Adapters Visual Studio project, which contains interfaces, adapters and facades for Windows Phone API functionality. This project is available from NuGet.
The right-hand side of the illustration shows the MockAccelerometer class, which also implements the IAccelerometer interface and is used in unit tests instead of the AccelerometerAdapter class. The MockAccelerometer class is an example of how a general-purpose mock can be given behaviour using delegates. Delegate accepting properties enable the execution of any desired behaviour necessary for the unit test. Unit tests can then be written that use the mock to test aspects of the application's business logic, contained in view models.
The Microsoft.Practices.Phone.Testing Visual Studio project contains mock implementation of the Windows Phone 7.1 SDK adapter and facade classes contained in the Microsoft.Practices.Phone.Adapters project.
The accompanying TestableAccelerometer.Tests project uses the Silverlight unit test framework for Windows Phone and Silverlight 4. To run the TestableAccelerometer.Tests project, first build and then deploy the project either to the Windows Phone emulator or to a real device. On the Windows Phone device, you can now launch an application named TestableAccelerometer.Tests, and then run the unit tests.
SummaryThis article has demonstrated how to build a testable Windows Phone application that consumes accelerometer data. The AccelerometerAdapter class adapts the Accelerometer class, with the AccelerometerAdapter class then being consumed by an application. The MockAccelerometer class is used by unit tests to test business logic contained in the view model class.
To find out more, see Building Testable Windows Phone Applications on MSDN.
ResourcesDeveloping a Windows Phone Application from Start to Finish
Developing a Windows Phone Application using the MVVM Pattern
A Case Study for Building Advanced Windows Phone Applications
Building Testable Windows Phone Applications
Author Bio David Britch Senior Technologist, Content MasterEvent: UK Windows Azure Bootcamp roundup
Over the past few weeks we have run 2 free Windows Azure Bootcamps in the UK: one in London, one in Bristol.
Londonetc.venues at Drummond Gate were our hosts in London and the Mercure Holland Hotel in Bristol. 55 delegates turned up to each event, laptops in hand ready for a day of Windows Azure. Each had been issued with a Windows Azure Pass which gives them a 30 day subscription to try Windows Azure for free. This would be important in the lab work.
I said it’d be a “pacey” sort of day because although we have what might be called “lectures”, most of the day is taken up with hands-on coding, config, deployment and so on. The first session concentrated on Windows Azure Compute and Storage. A mostly architectural discussion. Then immediately on to the lab:
The labs are not isolated, standalone exercises. They each build on the previous lab and the delegates eventually end up with an application which consists of a web front end using queues to communicate with a worker-role back end which stores references to messages in a SQL Azure database and the messages themselves in blob storage. Hyperlinks to the messages are formatted on to the home-page so they can be inspected afterwards.
The first lab gets delegates familiar with the Windows Azure SDK and tools for Visual Studio. They deploy their first “Hello World” ASP.Net app on Windows Azure as a live app running on the Internet. This gets them familiar with the way roles and instances work and we showed that a deployment in the Northern Europe data center is currently taking less than 8 minutes.
They then start to add code to the Web Role to take the contents of a text box, append the Windows Azure instance number and machine name and write that to a Blob. Next they put a reference to the blob on a Windows Azure queue.
It’s not too long before they are adding a Worker Role to the solution and adding code to pull the message off the queue and retrieve the blob. The worker role then “processes” the message (turns the text to uppercase!) and appends its own instance number to the message.
The delegates test their application out by tracking the messages as they flow through the system using a trial version of Red Gate’s Cerebrata Cloud Storage Studio.
Of course during the lab time, there are breaks, but I’ve found the delegates to be so enthusiastic they tend to run out, grab a coffee and bring it back to their desk and then carry on coding. I was ably assisted during these times by my Windows Azure colleague, Eric Nelson. Also Andy Cross and Richard Conway, both founders of the UK Windows Azure User Group and also Steve Spencer from Black Marble – who delivered the SQL Azure session and helped out during lab time along with everybody else. In Bristol, Eric helped and was able to chip in frequently with lots of very helpful tips regarding things that had come up on the six weeks of azure programme he is currently running. Also in Bristol, Andy Sithers, another Microsoft Colleague lent his help…
It’s the same at lunchtime – everybody grabs their bag of crisps, chocolate and sandwiches and brings them back to their desk to carry on coding while they munch away.
We then had an architectural discussion of SQL Azure. This was delivered by Steve Spencer in London and then folks start the lab – creating a simple SQL Azure database, adding ADO.Net code to the worker role and a data-bound repeater control to the web role. Another coffee break comes and goes, but you wouldn’t notice it: everybody is so keen they take the coffee to their desks and keep coding. We also move in to some other areas in this lab – such as setting the roles up to allow Remote Desktop access.
After the break there is a very brief session on the service bus and then a more detailed session on the access control service. There is also a lab for this and again, folks are busy typing away, deploying the services. This lab introduces a couple of other aspects, such as startup tasks.
Here’s a video to give you a feel of what it’s like on a bootcamp.
We’ll be running 2 more bootcamps in May so keep your eyes peeled on this blog for the announcement…
Planky – GBR-257
Windows 8–SkyDrive
Is it me or is the rhythm (or “cadence” if you want to be trendy ) of the “Building Windows 8” blog posts starting to increase as we head towards the Windows 8 Consumer Preview being made available next week?
I use a number of online file storage services and the big two for me are SkyDrive and DropBox so I’m genuinely excited to get a sneak preview of how SkyDrive might look as a Metro style app on Windows 8 and also the work around SkyDrive on the desktop.
Once again, the scale of some of the numbers are “scary huge” ( that’s a technical term );
“We currently store approximately 10 petabytes of user data”
“Hotmail stores over 100PB of user data”
Head on over to the Building 8 blog for the full detail (including a video demo).
Building Windows 8: Connecting your apps, files, PCs and devices to the cloud with SkyDrive and Windows 8
Express Online Tour of Windows Azure for Developers this March
Join us on an express tour of Windows Azure from newcomer, experienced developer to an architect’s perspective in March.
In this series of the UK Tech.Days Online Conference, we will take you through a guided journey to understanding Windows Azure from the ground up. We will take you from a newcomer’s guide to, experienced developer, and finally from an architect and business decision maker’s perspective to Windows Azure. You are highly encourage to register and attend all three sessions, however, you can simply choose to attend the ones that you are interested in. We’ll show you Windows Azure and get you over that initial hump of taking on something new, which on the surface can look scary, but with just a small amount of knowledge, you’ll find you can be very productive in this new environment. Join us this March for the UK Tech.Days Online Conference for Developers & Windows Azure.
Track 1: A Newcomer’s Introduction to Windows Azure, Tue 20 March 2012, 12-2pm
This session is for a developer who is either new to Windows Azure or has not yet had any exposure to it. But, as a developer you have heard some buzz and noise around it that you feel you should check out. We will be providing an introductory technical description of Windows Azure’s architecture, what moving parts are included in the platform, how to actually get started writing code and deploying live Internet applications, an overview of some of the core APIs and finally to understand how it is sold, how much it might cost to deploy your application and what the benefits would be.
Track 2: An experienced developer’s guide to Windows Azure, Wed 21 March 2012, 12-2pm
You are already experienced with Windows Azure. You have written and deployed some code but you’d like to now get a feel for what it’s like to actually deliver projects on this platform. What works well, what sorts of things should you avoid? This session, delivered by Andy Cross, one of the founders of the UK Windows Azure User Group, touches on a few areas of Windows Azure that you’ll have used but is full of useful information you can use as a working Windows Azure developer, in the trenches, delivering projects today.
Track 3: An Architect & Business Decision-maker’s guide to Windows Azure, Thu 21 March 2012, 12-2pm
This is a “warts and all” track where there are 2 case studies of organisations who have made the move to a Windows Azure Platform. Did the platform live up to expectations? Did it deliver what it promised to deliver? Most importantly, was it worth the effort of developing for the platform and does it bring the stated benefits such as agility and economy, compared to an on-premises data-centre?
Click on the links below to register or check out more upcoming Tech.Days learning events here.
Great presentation on MVC 4
Over the weekend a video of Scott Guthrie talking about ASP.NET MVC 4 went online, there are many new features but In particular I'm interested in the Web API. Over the past few months I have been doing a lot of HTML5 work and for my backend services I have been using controllers to simply spit out JSON. In the demo, that starts around 36 minutes, Scott shows how you can create APIs that will return either JSON or XML depending on the http header sent. Also if your API’s return type is of IQueryable then you can make Odata requests against the API.
This comes at a perfect time for me as I’m just putting together an App that runs across WP7, HTML, iOS and Windows 8 and this looks like it will be perfect for my requirements.
I’d recommend watching the whole presentation if you have time as it’s a really great primer for MVC 4. It’s also nice to see that many of the features shown will work in Web Forms too.
Compiled (XNB) Content Format
Windows Phone Localization for Games
Windows 8–Internet Explorer Performance Lab
With the Consumer Preview of Windows 8 to be available for download by the end of February, it’s good to keep a close eye on the posts on the “Building Windows 8” official blog and it’s companion - “Windows Store for developers”
The latest Windows blog post talks about testing the performance of IE. I love the scale of some of these Windows posts, for example;
“We measure the performance of Internet Explorer 200 times daily, collecting over 5.7 million measurements and 480GB of runtime data each day”
and I think it’s really enlightening to get a glimpse at the level of engineering that goes into software that’s used on a global-scale.
Take a read…
Building Windows 8: Internet Explorer Performance Lab- reliably measuring browser performance
Windows 8–Accessibility
With the Consumer Preview of Windows 8 to be available for download by the end of February, it’s good to keep a close eye on the posts on the “Building Windows 8” official blog and it’s companion - “Windows Store for developers”
A recent Windows blog post talks about new accessibility features present in Windows 8. Given that Windows is run by hundreds of millions of people worldwide, it has to cater for the broadest spectrum of users.
Building Windows 8: Enabling accessibility
Windows 8 – Submitting your Apps
With the Consumer Preview of Windows 8 to be available for download by the end of February, it’s good to keep a close eye on the posts on the “Building Windows 8” official blog and it’s companion - “Windows Store for developers”
The latest Windows Store blog talks about the goals and choices made for designing the application submission experience. It resonated with me pretty much straight away as I know that when I submitted an app into the Windows Phone 7 store I learned this lesson the wrong way around;
“if developers waited to visit the Store developer portal until after they finished coding, they would usually be inspired to change their code slightly as a result of decisions made during the app submission flow”
Windows Store for Developers: Submitting your Windows 8 apps
Web Development–Martin Beeby’s Articles of the Week
The W3C co-chair got up on his soap box last week and declared that WebKits power is causing an Open Web crisis:
W3C co-chair: Apple, Google power causing Open Web crisis
Cross-Origin Resource Sharing (CORS) enables you to do AJAX requests across different domains, over on the IE blog they have a nice post about how you can use it in IE10:
CORS for XHR in IE10
If you want to do MVVM in HTML then you might want to check out this post from John Papa that talks about 2 JavaScript DataBinding Libraries.
2 Great JavaScript Data-Binding Libraries
The post above talks about Knockout.js, a few months back I wrote a tutorial on how you could use Knockout.js and MVC together to build a shopping cart you can check it out here:
A Knockout.js price calculator
iPhone Meetup Training Kit
Windows 8 on ARM Processors–WOA
With the Consumer Preview of Windows 8 to be available for download by the end of February, it’s good to keep a close eye on the posts on the “Building Windows 8” official blog.
A lot of people I’ve spoken to about Windows 8 have asked about ARM and there is a huge post on the “Building Windows 8” blog as of yesterday with a tonne of information from the Windows team about ARM.
I read every word. I’ve read some of them 2-3 times now. My recommendation would be to sit back with a cup of tea and zoom the browser’s text to 140% for comfort and dive in – it’s a long post but it’s a great read.
Building Windows 8: Building Windows for the ARM processor architecture
Windows 8 and Power Efficiency for Applications
With the Consumer Preview of Windows 8 to be available for download by the end of February, it’s good to keep a close eye on the posts on the “Building Windows 8” official blog.
This recent post on improving power efficiency for applications is a great example and is well worth a detailed read.
Building Windows 8: Improving power efficiency for applications
Windows Phone Development–Mike Ormond’s Articles of the Week
by Mike Ormond
Excellent write up from ScottH that details how he built his first Windows Phone app and includes links to lots of great libraries / tools / frameworks to accelerate the development process (and even create a website for your app).
“From Concept to Code in 6 hours: Shipping my first Windows Phone App”
A great walk-through of using the profiling capabilities in the Windows Phone SDK 7.1 for tracking down memory issues.
“Memory Profiling for Application Performance”
Information that we’ve added the Argentina, Indonesia, Malaysia, Peru, and the Philippines markets
“Marketplace now open in 5 new markets”
If you want to get involved in the community around Windows Phone in the UK, there are dedicated, active Windows Phone User Groups in London, Cardiff and Manchester.
“Windows Phone User Group”
http://blogs.msdn.com/b/mikeormond/
Email author »
As an evangelist here at Microsoft I’m all about enabling talented developers to build great applications on Microsoft Windows Phone 7.
Learning HTML5 & CSS3
How did you learn to code?
I ask because a couple of recent chance encounters have got me thinking that there are some pretty big gaps in people’s knowledge of HTML5 and CSS3.
For example, I was chatting to a student who approached me at an event last Saturday. He asked me where he could go to learn HTML5. I suggested a few books and started explaining how HTML5 differs from HTML4. He interrupted and said, "Sorry you don't understand… I have no idea about HTML 4 either."
Is it me or is there a real problem here? After all, the guy was enthusiastic, he wanted to learn but was struggling to find the right resources for him. The problem seems to be that too many of the current books and sites assume that you’re simply moving up from an earlier version. So they spend a lot of time putting HTML5 into context by making exactly the same mistake as I did – explaining how it was different from HTML4 (or 3 for that matter).
When I started web development back in the late 90's (when dinosaurs ruled the world) I remember starting with WebMonkey.com. Then I moved on to learn DHTML from DHTMLcentral.com. And then on to 4guysfromrolla.com to learn server-side programming.
Is there a modern day equivalent? A resource that guides people from complete beginner to web developer. Or do we simply expect all new developers to find their own way?
What site, book, course etc would you recommend to people that are just beginning in web design and development?





