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.
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 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.)