Explore Videos MSDN eNews Social
Windows
Web
Phone
Cloud
Visual Studio
Security
ALM
Breakpoint
Canada Does Windows Azure
More
The latest on developer tools and technologies you care about.

Sign Up
Latest Editions
Previous Editions  
Stay connected through on your favourite social network.

Twitter
Facebook
LinkedIn

Two for the Effort of One

Two for the Effort of One

  • Comments 2

Well, almost for the effort of one, but still a lot less effort than starting from scratch. If you’ve read, watched, or attended various sessions on Windows 8 and Windows Phone 8, you would have heard about their “shared core”, a.k.a. their shared codebase. Many have taken that statement quite literally and understood it to be literally writing one app, installing it on Windows 8 and then taking the same app and installing it on Windows Phone. Of course, they soon realize that it doesn’t exactly work that way.

However, with a little bit of thinking ahead of time and some code organization, you actually can get two apps, Windows Store and Windows Phone, for the effort of one (and a bit). How do you do it? Using an architectural pattern known as MVVM (Model-View-ViewModel) and a construct made easy in Visual Studio 2012 known as Portable Class Library.

In this Pure Imagination session, Alnur Ismail shows you how you can focus on your app building efforts to organize your code into Portable Class Libraries and then create native experiences in the different UIs.

Prefer to read rather than watch, check out Alnur’s blog post Maximizing Code Reuse Across Windows 8 and Windows Phone Apps.

So as you digest what you just watched (or read), one of the key things to take away is that sharing across platforms doesn’t mean using the same app. Frankly, a phone app running on a PC is a rather ugly user experience. Instead, sharing means sharing the code and logic behind the scenes and creating separate UIs for each of the different platforms. With MVVM and Portable Class Libraries, you get the foundation for two apps for the effort of one (now that’s value for your time, eh?) and once you add the native UI for each platform, you can publish apps that deliver experiences meant for the device/platform. No need to compromise the experience in favour of writing less code.

Learn More

To help you with writing your (two) app(s), consider joining one, two, or as many as you’d like of these upcoming virtual camps:

February 28 - Developer Movement DevCamp March 11 - Web Camp
March 4 - App Design March 13 – .NET DevCamp
March 6 - Game Camp March 28 - The One About the Dev Who Learned to Build an App for Windows Phone – and Loved It!

Check out all the details here.

Developer Movement

180x150_DM_CDC_v1Developer Movement is Canada’s app building rewards program. As you build Windows Store and/or Windows Phone apps, optionally backed by Windows Azure services, you earn points that you can use towards rewards such as gizmos and gadgets, home theatre systems, laptops, and others. With the above in mind, with one app idea, publishing an app for Windows Store and Windows Phone can earn you 10,000 points (plus additional points for additional features. See the points breakdown for more information.) If you’re not already a member of the Developer Movement, join today! (You actually start earning reward points simply by signing up.)

Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post
  • I did the "Code Sharing" presentation last Saturday in Montreal, then I applied those exact same techniques (MVVM, PCL, linked class, ...) and built 2 apps that passed certification yesterday! Search for "Quick Draw" in both stores. I use the same code for WP8 and Win8! 2 days to build for WP8, 1 day for Win8.

  • Awesome! Real life proof that it actually works, but more importantly, actually saves time. Thanks for the comment!

Page 1 of 1 (2 items)