Category Archives: Software Development

Xamarin – Migration Journey (Part 3 – Legacy code integration)

This is actually the hard part, and the failure at this point actually prevents us from moving towards with Xamarin.

We have been developing with native iOS and Android for 6 years, with lots of legacy code and libraries. Our libraries in both iOS and Android can have up to 20-30,000 lines of code. To migrate all of them to Xamarin would be a huge deal. The only solution is to connect Xamarin with those libraries.

We have libraries in 3 languages: Objective-C, Swift and Java. The first trouble came up when Xamarin could not connect with Swift framework. In our experiment, we took the risk and port 1 of our library into Objective-C. The Swift framework issue should have signaled us that something was not going right.

Anyways, we move forward with our intention to write a real project, working on both iOS and Android, and connect with 5 of our libraries and use 3 cocoapods frameworks/libraries.

For the libraries we wrote, there was not much problem, except the Swift issue mentioned above. However, with cocoapods, when people write code in all shapes and forms, the API definition kept having weird issues that we could not comprehend. We spent 3-4 man days on this, and still wasn’t sure that if the code would work or not.

We will discuss more about what binding issues we have with Xamarin that forced us to change the direction: to try to at least make a workable app with missing elements and libraries working in Xamarin


Xamarin Migration Journey (Part 1 – Introduction)

We are trying Xamarin as our cross platform approach. And we have learnt many things along the way, some of them were the old approach of Static Library, the API definition and how the code structure and the API design of Xamarin and iOS are somehow different.

We have quite a big codebase (more than 100 thousand lines of code) in iOS and Android in native, mainly because we deal mostly with Video Processing and some native features. We use frameworks a lot to share code between different apps. I have been looking for ways to port the code from iOS to Android in a smooth and cost saving way.

There are multiple steps that I plan to go through when adapting Cross Platform:

- Same or similar architecture between iOS and Android codebase

- Prepare the library in correct format to be reused in the Cross Platform

- Prepare the Binding

- Prepare the team with C# knowledge to migrate the codebase

- Design the module and how best the app will be separated between Shared Module and iOS Module

The Generalist and Specialist Approach

Learning is a lifelong and continuous process in anyone’s career. A common question from the newbie and the college students is what areas they should focus their efforts on to move fast. I share the same feeling with their ambition to go fast and change the world. However, in my opinion, the first few years of college and career should be on learning their most favourite subjects. It is fine to not earn much money at first as long as you are building up your background.

Choosing the first job

Some people would claim that the first internship and job is the most crucial one in his career. This was far from the truth. A career is a 40-50 year (yes, they are extending retirement age to 70) marathon which allows you to make a few mistakes here and there and still achieve the greatness. The key strategy is to always move forward, always expand beyond your comfort zone. I would encourage new students to try different career paths if they are still unsure about what they want: the startup life, the small and medium enterprise and the multinational companies. These offer different skills and experience to people.

The learning curve

To learn some fundamental concepts about a new topic does not take much amount of time.  The pareto principle (The Pareto Principle states that 80% of outcomes come from 20% of causes.) on learning new concept would say you will understand and know 80% of a subject by spending 20% of the time. This part of 80% will not qualify you as a great specialist in the area, but it is enough for you to apply it in your current speciality.

A good example would be that a developer learns about UI/UX development. The first few hundreds of hours of learning and applying it will not make him a UX specialist, but that would be enough for him to apply it into his software development. This will guarantee that the UI/UX of his app/website would be at least at an acceptable level.

Work to learn or work to earn money?

A very important concept for newbie is to know their value, or to put a dollar amount into his work. The one who would say he can work for me for free will not make me impressed. The one who would say that his salary would be a specific amount of A $ because of these reasons, will be the one I feel good about. He would show me that he spends a significant amount of time to research about different companies, about my company to know how much his contribution is worth. He would still have to seek for learning and improving himself over the future period of time, and it would be good for him to show me that plan and how he would stick to it.

The altitude is always valuable for most employers, but you better show that you have the knowledge and skills to make that altitude become valuable.

Controls Android New Site

I am so excited to announce my new site: where I show my collection of all android controls that I find on the internet. We are still updating it everyday, so please spend time visiting the website, download and use the controls for your cool app. Leave my any comments or suggestions on how to improve the site much better for the community.

For a better Android Interface

General Purpose GPU Programming for Mobile



There are times that your app collects a whole lot of data (by capturing it live or by downloading from a third party, or import from email), and you want to do a whole ton of reports and visualisations inside your app. .

To do lots of computing inside your smartphone is a very challenging job, as I have experienced myself in processing video data. A small trick is to use your GPU, which could be 10-100 times faster than your CPU in calculating floating point.

Setting up a GPU shader and calculation could be a huge task for anybody who are not familiar with OpenGL. So, this excellent GPGPU library could help you a lot, all you need to do is to change the calculation inside the vsh file. I am planning to make it even easier for anybody to use in the near future.

Improve your Android emulator performance

Want to supercharge your Android emulator in Eclipse/IntelliJ, use the following, excellent tip from Stackoverflow

IMPORTANT NOTE : Please first refer to Intel list about VT to make sure your CPU support Intel VT.

HAXM Speeds Up the Slow Android Emulator

HAXM stands for - “Intel Hardware Accelerated Execution Manager”

Currently it supports only Intel® VT [Intel Virtualization Technology]

The Android emulator is based on QEMU; The interface between QEMU and the HAXM driver on the host system is designed to be vendor-agnostic.


Steps for Configuring Your Android Development Environment for HAXM

  1. Update Eclipse: Make sure your Eclipse installation and the ADT plug-in are fully up to date.
  2. Update your Android Tools: After each Eclipse plug-in update, it is important to update your Android SDK Tools. To do this, launch the Android SDK Manager and update all the Android SDK components. To take advantage of HAXM, you must be on at least release version 17.

enter image description here

  • Download the x86 Atom System Images and the Intel Hardware Accelerated Execution Manager Driver: Follow the image below:

enter image description here

  • Install the HAXM Driver by running “IntelHaxm.exe”.
    It will be located in one of following locations:

    • C:\Program Files\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager
    • C:\Users\<user>\adt-bundle-windows-x86_64\sdk\extras\intel\Hardware_Accelerated_Execution_Manager

    If the installer fails with message that Intel VT must be turned on, you need to enable this in BIOS. See description for how to do this here.

Install .exe or .dmg

  • Create a New x86 AVD: Follow the image below:

Create AVD

  • Or as for new SDK, enter image description here

Time Management for Software Project

Time, quality and cost

 The basic of project management is a balance between time, quality and cost. Pick 2 of them. And then we start discussing about how to estimate the time when we have fixed the quality and cost (just kidding, you can pick quality and time as well).


Time Cost Quality

Time Cost Quality – Pick 2

 In projects I have done over last 5 years, each always contains lots of unknown and challenges, as I have worked in most of the latest technology and sometimes I come to new project without any experience

 Main problems in estimating projects can be listed as below:

   - Miscommunication

   - Overestimate the team competency

   - Task breakdown not done carefully.

   - Underestimate integration between models

   - Technical unknown

   - Requirement changes


This normally happens with outsourcing companies or when teams are spread between different locations. When I chat with clients or teammates, people are lazy to chat so they tend to chat short. It leads to lots of assumptions and miscommunications between people. Voice chat on skype suck energy really fast, and require both sides to communicate synchronously. It could be the miscommunication between clients and your teams or inside your team. You definitely don’t want after 3 months, you come back and the clients’ feeling is like the figure below….


Well, a famous and familiar figure huh?

Overestimate team competency

I pick my team members really hard, and I also have strong belief in my people. That is why I overestimate my team member most of the time. Belief and overestimate should be separated from each other. “Keep a cold mind and a warm heart”. That means you should keep a strong feeling in your members and encourage them to do a good work, but when evaluate them for specific project, be careful to estimate.

Task breakdown & integration

These are the 2 most underestimated when managing any projects. It is easy to look at the whole and say that it would take 3 days to finish all of them. However, if you actually break it down, and allow time for writing the code, debugging, testing and fixing bugs again,the total time could be 10 days. Oh, I forgot to mention about integrating between tasks or modules. Sometimes, we assume that if task A is done, and task B is done, combining them would be easy. Poor us, it is not usually the case. The combination between module A and module B can generate a whole new level of bugs that need fixing. The bug may only happen due to specific conditions of module A and B. It is important to run lots of tests and allocate debugging time for this phase, as shown in the following figure.

Work Breadown Structure

Work Breadown Structure

Technical Unknown

The risk level of the project depends on how many unknown stuff in your project. Some of them is that the requirement is unclear, or the technical solution is not yet known or implemented by any people in the team. It requires an expert with sharp eye to know which areas are unknown and needs to allocate time for it. The problem is people don’t know what is unknown…

One cool example that strikes me a lot is how Video Player is implemented in iOS and Android. In iOS, seeking to any arbitrary frame is a piece of cake, and I assume a well-designed framework like Android would be the same. I was totally wrong. It took me 2 months to search through many different solutions and approaches to figure how to do it in the correct way.

Only when you really get into coding, you can really know which part is challenging.

How to deal with changes

Another problem is customer change their requirement based on what you demonstrate them. An Agile approach normally helps by clearing any customers’ assumptions as soon as possible and not let them wait until the finished product. By receiving early feedback, we can constantly change the products.

1 problem of the Agile approach is that customers keep changing their minds way too often. There is 1 point that we really need to lock the requirement no matter what the customers want. Striking a balance between these issues may keep customers happy and our project budget and timeline in a good shape.

SnappyCam App looks very good

I just read about this on Techcrunch and try it out, it is a very handy camera app. Although I am not sure the image result looks actually great because it is only 213kb? I also would love to know how he can do it

Snappy Camera

Snappy Camera

Your standard iPhone camera app is actually pretty slow, able to take just three to six photos per second at 8 megapixels each. But with SnappyCam 3.0, you can shoot 20 full-resolution photos per second thanks to a breakthrough in discrete cosine transform JPG science by its inventor. Twenty frames per second is fast enough to capture shot-by-shot animations or every gruesome detail of an extreme sports crash.

Debt, Inventory and Revenue



Your code is your debt

You spend money, efforts and bug management to control your debt. Code doesn’t automatically generate revenue, user features and user satisfaction do. It doesn’t matter that you write 100 000 lines of code in 10 000 hours and complexity is 1 million (it, well, matters for technical guy) if those efforts doesn’t acquire new users or generate more revenue. It is like saying: I have borrowed 1 million dollars and spent all in this project. It sounds cool but it doesn’t do any benefit to the company. Even worse, it harms the company.


Inventory is what you produce but just sitting on some warehouse/storage and does not generate any money. It could be even worse if it costs you any money to store those things.
Like Joelonsoftware said: inventory can happen in each of the following software process, and they can have different results:

      Decision-Making Process: documentation, product backlog, feature ideas…
      Design Process: diagrams,
      Implementation Process
      Testing Process
      Debugging Process
      Deployment Process

Each of stage’s products can never be implemented, get ignored or become unrealistic the next time. Here, we don’t talk about the waterfall process, which could make it even tremendous. For example, the feature backlog that is written in hundreds of pages that 90% are not implemented. The bug database contains all the bugs, efforts to maintain them and understand them but only 10% of them get fixed after a long time.

As with any kinds of inventories, after a while, your products inside the inventory gets obsolete, and needs cleaning up so the new things can be added in. The obsolete inventories will cost you the efforts and time to create it, maintain it and get rid of it. It is the same for software engineer, the bugs that are no longer bugs (after lots of updates), the features documentation that are not compatible with the current products…

It is important for manager to understand about the similarity of the cost, the debt, the inventory and the revenue in a software engineering process. It is easy to measure engineer by how much code they write, but it is the same as measuring how much debt he brings to the team. Higher debt doesn’t mean higher revenue, so be careful.