Sunday, May 26, 2013

LEAN4: 3 Lessons Learned on Creating Cross-Platform App

3 Lessons Learned on Creating Cross-Platform App

As what happens on last year been summarized in this post, I'll continue to share what I did recently. I have the ambition to support 5 platforms, Windows/Mac OS X/Ubuntu/iPhone/Android. It's not as smooth as what I expected, and here are some lessons learned.

  • Don't use web technology to make native applications on desktop unless you have no choice. My first version of PomodoroApp is built on Qt with C++. Not including the time in school, I have 10 years of experience of using C++ on commercial software. Starting from 2002, I worked as part-time programmer to work on backend services for GIS applications, and now enjoy the new features of C++ 11. Native applications are really good at platform, and C++ is easier for me to do optimization. However, because of the increasing of web technologies. I decided to use ExtJS and TideSDK for new version, the simple initial idea is to share code for PomodoroApp on mobile devices because I can use Appcelerator Titanium or PhoneGap to reduce the efforts of making apps on iPhone and Android, and sencha provided Sencha Touch for mobile and I can share most of the code with ExtJS. Ideally, I can share 80% of the code on Windows/Mac OS X/Ubuntu/iOS/Android, the only thing I need to revise for different platform is UI. However, here are a list of issues that I have to resolve:
    • Limitations. Desktop and Mobile devices have specific limitations. For example, SQL API in TideSDK is synchronous API, while when it comes to mobile, SQL API in web page is actually HTML 5 sqlite API, it has 5M bytes limitation. More worse, it provided only asynchronous API, so the logic of the code will be different with desktop. Making it clear on limitations is important because features may not be able to achieve.
    • Performance. In somewhat level it depends on the libraries selected. Web technology may looks good at beginning, but I'm sure it will get really sluggish when more and more components added on one page. In addition, for ExtJS, the one page application, it's really easy for memory leak.
    • Dependencies. C++ can access platform features, while JavaScript cannot. What your application can achieve depends on how the cross platform SDK provided. For example, in 2.x of PomodoroApp, I updated the application icon on dock bar/task bar. However, it's impossible to achieve unless you can add new API to TideSDK.
  • Don't mess up the library of your core business logic with platform guards. It's acceptable when I have to handle different logic in my library to have something like if(platform is Windows){...}. However, I didn't imagine the complexity at the very beginning until I started porting on mobile devices. When there are 5 platforms need to be supported. The guards section in code is really what bugs come from. Especially in JavaScript because there is no compiling time verification.
  • Triple your estimation when porting from desktop to mobile. Even you have lot's of reusable code. There may be lots of issues never happened on desktop side. For example, Apple App Store review rejected my app several times and I have to resolve all the issues they proposed. Generally I need 5 working days to get review result.


  1. If you are looking for the best Things to do around the world, this list has something for everybody from food to history and culture.

  2. Since I am a medical student, this post is not for me – I realized it after reading the first line. Though a friend of mine may find it helpful as he is a computer science student, studying in Canada. Yesterday, when we talked, he told me he was searching for Essay Writing Services Canada. I hope he finds it helpful enough so he doesn’t have to pay. If not, then I am sure he will find a good service.