How we do cross platform mobile app development at Nintex

Maintaining your business presence or mobile apps on different platforms is challenging. A lot of companies hire platform specific developers, form one team for each platform which work in their own silos, each responsible to maintain their respective platform, having different implementation, different code paths and different kind of design. Each team may or may not have face similar functional/UI issues.

At Nintex, we build and ship native mobile apps across iOS, Android and Windows platforms to support access to workflows and forms securely from wherever you are on your mobile devices. Here we have followed a slightly different approach where we design and implement any feature once and then we port the implementation to other platforms. Therefore we have feature based mobile developers which design and implement each feature across Android, iOS and Windows platform.

This has work really good for us, breaking the silos and help us achieve design and code path consistency across multiple platforms.

This often lead us concluding that if we have functional bug in one platform, chances are we have that bug in other platforms as well.

The crux of the idea is that we follow Model-View-ViewModel (MVVM) pattern across all platforms. So we have similar classes for model, view and view-model, contracts, repositories, helpers etc. across Windows, iOS and Android. By similar classes I mean, similar name, code path and structure yet they are written in their own platform specific languages. So if we have a view model with a method on one platform, we will have it across all.

MVVM
MVVM

As an example, consider following sample snippet of a view model from Android and iOS and you will see the point here.

ViewModel in Android (Java)
ViewModel in Android
ViewModel in iOS (Obj-C)

However view, which comprises of UI and code, can be platform specific. e.g.
In Android, View = XML Layout + Activity
In iOS, View = Storyboard + ViewController
In Windows, View = XAML + Code behind

Each view has reference to its view model (initialized through IoC or passed by its parent) where all user interactions are done through events or binding or listeners etc. depending on platform. For instance, in iOS we leverage KVO to observe value change in ViewModel to reflect update to View/UI and stuff like button click is simply routed back to ViewModel method either via simple method call or some mechanism. So our views are just there to render UI widgets/components/layout.

The advantage of this approach is, first, it gives us shared design and code consistency, second, it gives opportunity to open a cross platform conversation and knowledge across team, third, it improve code testability by decoupling UI logic from View (ViewControllers/Activity/CodeBehind) to ViewModel, fourth, it makes relatively easy for us to follow SOLID principles.

However, we have came across challenges with platform specific components like showing alerts/notification, http clients, retrieving geolocation etc. The way we handle it is by injecting contract (interface/protocol) to ViewModel class which has platform specific implementation however code structure remains same in ViewModel across all platforms.

If you are interested to see some sample yet naive MVVM implementation:
MVVM implementation in Android
MVVM implementation in Windows Store and Windows Phone

How do you develop cross platform native apps? It would be interesting to know… is it C++ shared/wrapped code? Do you use Xamarin? You prefer each platform specific team working in their own silos?

PS: This post is revised version of my original blog post at Nintex Labs

Event Details: Windows 7 for Geeks

Yesterday, 20th March 2010, I organized and participated as speaker, “Windows 7 For Geeks” event. The overall objective was to introduce the Windows 7 API for managed developers so that they, as a third party application developer, know how to utilize the capabilities and design experience of Windows 7 in their applications.

I’m very glad to see the growing interest of the technical community and students in such events. For me speaking in community is not all about sharing! It’s about interacting and having an in-person relation with community. So thank you all for coming to the show. For details about the event, please click here to read blog post on Emerging .NET Devs site.

Event Summary: Windows 7 House Party

We had a fantastic Windows 7 house party on Sunday, October 25th. I invited some of my friends and community contributors and I’m glad I hosted a Windows 7 House Party, it was really fun.

We started with one of the most famous feature of Windows 7 i.e. Aero Shake 🙂 and then moving towards start menu and search options. Later I handed over my position to Taimur Asad, who is Microsoft Student Partner to continue the show on my behalf.

At the end, we did some I’m PC fun time 🙂 Check out the video and make sure you watch till end 😉

Thank you all for attending the party. I really had a great time and hope you all enjoyed as well. Also thank you Munir and Jadoon for tweeting about the event 🙂

Windows 7 House Party

I will be hosting Windows 7 House Party at my home on 25th October. I have invited few of my friends and active community people in Karachi, Pakistan. This is an informal event and we will discuss some of the exciting features of Windows 7 🙂

I have received Windows 7 Party Pack from House Party and Microsoft. In that pack I got Windows 7 Signature edition and some other goodies 😀

Obviously, I have invited very limited number of people due to limitation of space and ;p at my house 🙂 But, just to inform you, if you are really looking forward to see some exciting features of Windows 7 we will be organizing a Windows 7 Launch event at the User Group level which will be open for all the PCs! 😉

Thanks! Looking forward to see you all in the upcoming Windows 7 Launch events!

Blogging Live from Windows 7 Launch Event – Part V

Memo’s distribution:

Then finally the XBox lucky draw:

The two XBox winners 🙂

Then the event was concluded and guest were requested to proceed for lunch

DSC01791 DSC01794

Post event snaps with friends at Microsoft Innovation Center and other MVPs/MSPs etc.

DSC01803DSC01805

That’s all from the Launch Event. We enjoyed much and finally we also received goody pack as well 🙂

Blogging Live from Windows 7 Launch Event – Part IV

and finally much awaited, a little talk on Windows 7 features by Salma Nisar

Jehan Ara, President of P@SHA joined the Bloggers’ corner 🙂

Catch up more news on twitter with hash tag #Win7PK. Stay tuned more to come!

Blogging Live from Windows 7 Launch Event – Part III

Coffee Break:

JehanAra from PASHA Coffee Break Bloggers and MVPs

We are back from the coffee break and they just showed the launch video of Windows 7 🙂 *clap clap*

Salma Nisar Salma Nisar

Salma Nisar, Account Technology Strategist, Microsoft Pakistan talking about the “The Value of Optimized Desktop”

Catch up more news on twitter with hash tag #Win7PK. Stay tuned more to come!

Blogging Live from Windows 7 Launch Event – Part II

ZafarUlIslam

Microsoft Pakistan – Enterprise Technology strategist, Zafar-ul-Islam delivering technology keynote at “The New Efficiency – Joint Business Launch Event”.

Naveed Bajwa and Munir

My Microsoft mouse just pointed out by bloggers!

Microsoft Arc Mouse 2 Microsoft Arc Mouse

Catch up more news on twitter with hash tag #Win7PK. Stay tuned more to come!

Blogging Live from Windows 7 Launch Event – Part I

We are here at Sheraton Hotel, Karachi – Pakistan at “The New Efficiency – Windows 7 Launch Event” by Microsoft Pakistan. I will be blogging live from the event 🙂

DSC01683DSC01738 DSC01703

Kamal Ahmed Microsoft Pakistan Country General Manager, Kamal Ahmed addressing keynote on the Launch of Windows 7, Windows Server 2008 R2 and Exchange Server 2010.

 

 

 

 

Yes there is a Blogger’s corner as well. As there no separate corner for MVPs ;p so we joined the Bloggers’ corner 😀

DSC01713Catch up more news on twitter with hash tag #Win7PK. Stay tuned more to come!

C# 4.0 + Visual Studio 2010 Beta + Windows 7 RC

Here we are with the Visual Studio 2010 Beta installed on Windows 7 RC, the most coolest and latest stuff out yet 🙂

In this post, I wanted to share some glimpse at Visual Studio 2010 beta along with some demonstration of one of the feature of C# 4.0 🙂 For Windows 7, I will write another detail post about the new features and what I like most and why it can be the best windows till yet!

So, coming back to VS 2010, If you start Visual Studio 2010 Beta, you will notice a major change in UI of Visual Studio with a nice, interactive and customizable startup page :

VS 2010 Beta Start up

Yes, It’s UI is built on Windows Presentation Foundation (WPF). So let’s go ahead and create a new project:

As you can see we have a similar kind of option, as in VS 2008, is available to select target framework version which is by default 4.0 🙂 and as you can see we have Silverlight templates available so now no need to install separate Silverlight 2 tools for VS :). Let’s move forward and create a new C# Console Application:

You will notice that editor itself is in WPF along with the intellisense menu but works almost as identical. So let’s try one of the feature of C# 4.0 🙂

I’m going to implement a method that takes dynamic typed object and that object will invoke a method which will be resolved at runtime!

DemoCSharpFeature

Didn’t get? Keep reading 🙂 Here we have a DemoCSharpFeature class that have a static method having a dynamic parameter “obj”. Now inside that method, I have written obj.ABC() which can be resolved only at runtime because at compile time, compiler does not know what will be the actual type and it will be resolved dynamically at runtime and hence compiler will not raise a compile time error here 🙂

I have created another DemoClass which have method ABC.

Main Method 

As you have noticed that I have created an object of DemoClass which contains method “ABC” and passed to CheckDynamicParameter. The demoObj parameter will be resolved at runtime and it will find ABC method in it. Thanks to dynamic type in C# 4.0, otherwise I would have used Reflection here or static typed object 🙂

Let’s hit F5!

image

The beauty is that even if I remove method ABC from DemoClass, the program will still compile because it will expect that when dynamic is resolved at runtime it will find the method ABC and if not found, a Runtime Binder Exception would raised.

That’s all for today! If you want to download Visual Studio 2010 Beta, visit Visual Studio on MSDN