Software engineering 101 for iOS app development: I

I thought this for a while, when I was in the Voices That Matter iPhone developers conference, I have seen the great interest from iPhone app developers, from indie developers (individual or small team development shop), to high school teacher who taught self programming and teaches kids on iPhone programming. They come from different background, software consulting, development, education, authors. Being from enterprise software development background and have created iPhone app on my own time, I think I can share some of my thoughts on “applying software engineering principle to iPhone app development”. Hopefully this can shed lights on the best practice of iPhone app development, and ideally those thoughts can be applied to software development on other areas as well.

The No. 1 thing I want to talk is testing. Why we need to test an iOS app?

As my old C++ professor said in the class: a program is a novel if it does not run as expected. We always want to test the software (aka app) if it’s a bit complicated and takes some time to develop. For simple iOS app sometimes we would just skip the formal testing process, and in some cases we just assume it works. I learned the lessons the hard way recently.

1) After I uploaded the binary via iTunesConnect, I found some problems with the app. So I rejected the app, fixed the problem, and uploaded it again. I did this 3 or 4 times in one case. After the last upload, my app was end up in “Upload received” status but did not automatically move into “Wait for review”. Waited anxiously for a few days. Finally I googled and found this article on StackOverflow and followed the instruction to contact Apple, waited for a few more days, and it got resolved eventually. Had I tested the app more thoroughly, I would not have to go through all the pain and the app would get reviewed soon.

2) More recently, I added a feature to the app and tested it on iOS 3.1.2. After it being released, I tried it on iPhone 4, and I found the feature does not work. Ouch.

How to test?
Ideally we should have a test suite and automatic test. But we don’t live in an ideal world. As I minimum, I would test the following:


1) Ran through all the code paths, I learned this from my mentor when I started software programming job in 2000, his suggestions is run through all the code path in debugger;

2) Double check the User Interface, this reminds me another thing, in one app I released in v 1.0, I found I can only see 4 digits in one text field, in other words, put in 10,000 would “overflow” the text field. So I fixed it in v 1.1, with one caveat: how about Japanese user whose currency is about 1/80 of USD? So my lesson here is “always push the envelop”.

More resources on iOS testing:

How to host a beta test for your iOS app (Ray Wenderlich)

An example of unit testing working for me (Graham Lee)

Also, if you went to the VTM conference, don’t forget the “testing” talk and presentation given by Graham Lee.

I will continue this series.

Leave a Reply