Category Archives: Programming Language

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

 

Controls Android New Site

ControlsAndroid.com

ControlsAndroid.com

I am so excited to announce my new site: ControlsAndroid.com 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

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.

HAXM

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

Miscommunication

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

Miscommunication

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.
HOWEVER…

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

 

http://techcrunch.com/2013/07/31/fastest-iphone-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.

Windows Phone Potential?

I normally hear from Windows developer to say that their Windows market share is much bigger than the total of iOS and Android together. And the sales of Windows 8 has bypassed all the sales of iOS and Android from the beginning to now.

Windows Phone 8

Windows Phone 8

It is quite unfair to compare the whole Windows 8 with iOS or Android. And if we do take that demand into PCs and laptops, then why the hell we do not compare the supply side? It is very clear that if Windows 8 could be a shared platform between PCs, tablets and phones, then all the old software, all the old games would have beome compatible to the Windows 8 system in the short amount of time. And many apps for tablets and phones would be quite different than the ones in PC. No, I don’t mean technology, I am talking about the business model, the purpose of the software.

I don’t mean that iOS and Android is a better market than Windows Phone for indie business. These markets have become very competitive and continue being so. You either have to figure out a market niche or be very lucky.

iPhone v.s Android

The smartphone game is over. The tablet game will be finished soon, within 2 years.

iPhone versus Android

iPhone versus Android

 

 

Android wins, iPhone loses. 75% v.s 15%, soon will become 85% v.s 5%. But that doesn’t matter much for Apple. Apple is a brand for high-end products. They don’t aim to gain all market share. To gain market share, Apple has to attack more of the low-end market, which means they have to lower their price. However, matching other supplier’s price may be harmful for Apple’s brand, although they may achieve it by more efficient supply chain and factories.  To become a high-end brand, Apple spends a significant amount of money on their brand and will not scarify it for the market share.

But in this ecosystem war, the bigger ecosystem leads to a win by monopoly. When 75, 80 or 85% of the market is using Android, app developers will flock to there, and make the ecosystem become much more valuable for customer. To continue earning a lot of money, Apple has to continue what it has done best under Steve Jobs’s empire. New product, new market, new value, or new software that people are willing to purchase with high-price.

What will be the next Apple’s product? Probably Apple TV, I am not even sure about that.

And the important questions for most of us, as app developers, what should we do? Should we all move to Android yet, should we change our strategy of iOS first, Android second? Or should we start discussing about Mobile Web App?

I am writing more on the Mobile Web App v.s Mobile Native App in the next post, catch it soon.

Suggested Frameworks for iOS

Here are some suggested frameworks for iOS development, since I have used all of them quite a lot. I think they are good frameworks/libraries that you may need to know. It could save you a good amount of time in researching and reinventing the wheel.

List of Frameworks/Code Snippets for Objective-C:

List of some good components

CorePlot : Core Plot is a plotting framework for OS X and iOS. It provides 2D visualization of data, and is tightly integrated with Apple technologies like Core Animation, Core Data, and Cocoa Bindings.

Core Plot Graph

Core Plot Graph

iPhone Cocoa Http Server:

CocoaHTTPServer is a small, lightweight, embeddable HTTP server for Mac OS X or iOS applications.

Sometimes developers need an embedded HTTP server in their app. Perhaps it’s a server application with remote monitoring. Or perhaps it’s a desktop application using HTTP for the communication backend. Or perhaps it’s an iOS app providing over-the-air access to documents. Whatever your reason, CocoaHTTPServer can get the job done. It provides:

 

Google Objective-C coding standard

I am not sure what coding standard you follow, but I usually follow the Objective-C coding standard of Google for code formatting:

Spacing And Formatting

Spaces vs. Tabs

Use only spaces, and indent 2 spaces at a time.
Line Length

Each line of text in your code should try to be at most 80 characters long.
Method Declarations and Definitions

One space should be used between the - or + and the return type, and no spacing in the parameter list except between parameters.
Method Invocations

Method invocations should be formatted much like method declarations. When there’s a choice of formatting styles, follow the convention already used in a given source file.
@public and @private

The @public and @private access modifiers should be indented by 1 space.
Exceptions

Format exceptions with each @ label on its own line and a space between the @ label and the opening brace ({), as well as between the @catch and the caught object declaration.
Protocols

There should not be a space between the type identifier and the name of the protocol encased in angle brackets.
Blocks

Blocks are preferred to the target-selector pattern when creating callbacks, as it makes code easier to read. Code inside blocks should be indented four spaces.

My New Book – 21 years old achievement

21 years old, I got my first book released, I was so excited. Buy it here

Pro iOS Apps Performance Optimization

Pro iOS Apps Performance Optimization

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Today’s iPhone and iPad apps developers are often running into the need to refine, improve and optimize their apps performances. As more complex apps can be created, it is even more important for developers to deal with this critical issue.

Pro iOS Apps Performance Tuning and Optimization covers many common but difficult problems when tuning and optimizing performance for iPhone and iPad apps and how to resolve these problems efficiently. This book gives you the following:

  • Basic knowledge on common problems in iPhone apps
  • Advanced knowledge over data structure, algorithms, multithreading, and network data in iPhone apps
  • Comparison with problems and solutions for Android and Windows Phone apps

After reading this must-have book, you’ll be ready to make the most of the processing power of the iPhone with your apps performance optimization know-how.

 

What you’ll learn

  • Benchmark your apps using emulators and real device tests
  • Increase and optimize UITableView performance in your iOS apps
  • Increase your app performance using image and data caching techniques
  • Tune your apps using algorithms and data structures
  • Improve your parallel data access using multithreading techniques
  • Optimize memory usage for increased battery life and better apps performance
  • Use native C code to address memory leaks or EXEC_BAD_ACCESS