Warming up to iPhone

I'm on the startup path. One thing you realize when you set out to do a startup where you will initially do all the heavy lifting is that you don't know everything you think you know. For me, I've been training for this for a while, I have web stack burned in to my head and it just drips out of my fingertips. However, what I didn't have was enough mobile to get me by. I've done plenty of web-based mobile apps and mobile web sites but what I plan to do quickly outgrew that and needed access to the phone's hardware.

I have released 2 apps which served me well as learning tools and submissions to the San Diego App Challenge. Win or lose, I figured I'd do these two apps rather than any "hello world" book samples.

San Diego Transit

Available for iPhone, this app is the only native iPhone app that integrates mapping and realtime bus location data for all areas that San Diego MTS covers. I was shocked to learn that such an app didn't yet exist in San Diego, but multiple existed for all other major California cities. See the video below for a walkthrough.

Download San Diego Transit on iTunes:
http://itunes.apple.com/us/app/san-diego-transit/id518207969?ls=1&mt=8

 

What I learned doing this app:

  • UIMapKit, iPhone's mapping framework
  • Loads of strategies for doing databases that live on the phone via SQLite
  • MonoTouch UI development
  • Web service / data connection and parsing (iphone phone-home!)

Street Report

Simply take a photo, share your location, and alert the city to issues. The trick here was getting the data to the city, and using some HTTP POST magic, was able to auto-fill the city's own service request form.

What I learned doing this app:

  • Photo taking / storing / manipulating
  • Low-level HTTP work for iPhone
  • Windows Azure cloud storage from iPhone
  • Location, reverse geo-tagging

Download Street Report on iTunes:
http://itunes.apple.com/us/app/sd-street-report/id518218814?ls=1&mt=8

 

The skinny on MonoTouch

Mono is an open source .NET implementation. MonoTouch, and MonoDroid are .NET libraries that allow for developing native apps in C# on iPhone and Android respectively. Because C# is also the language of the new Windows Phone 7 platform, I was intrigued by the possibilities of less code. I just stuck to MonoTouch

The short version:

I like it. It wasn't no-brainer by any means, but MonoTouch was just the right about of abstraction from Objective-C. I feel pretty confident I can cross-develop for all 3 phone platforms, re-using anywhere from 50 - 90% of the code, depending on the type of application.

The long version:

Since MonoTouch compiles right down to the native objective-c bindings, and it uses the XCode UI development tool, I really felt like I was developing iPhone the way objective-c developers do. In fact, I found I could talk to them and get tips / strategy, or follow along with solutions on Stack Overflow. The best benefit was writing it in C# and getting to use .NET framework pieces, like web service calls, JSON parsing, and a ton of other useful framework pieces we take for granted.

My second favorite thing was how easy MonoTouch can be to do real database work, using SQLite database development. An open source tool called SQLite-NET (https://github.com/praeclarum/sqlite-net). It's kind of like Entity Framework Code-First, for iPhone since it can generate the tables, and makes CRUD operations to that SUPER simple. It's a HUGE time saver and worked perfectly for large data sets / normalized data interactions

Let the fun begin

Now, back to these regularly scheduled programs. 2 Apps published, a ton of new development potential in the vault, and some exciting beta products coming soon.

***UPDATE*** 6/29/2012-  Street Report Wins Grand Prize and City Innovation Award

I'm so grateful to the judges of the SD Apps Challenge for thinking so highly of this app. It won 2 awards, City Innovation ($5,000) and Grand Prize 1st Place ($15,000). The money is of course helpful as I work on my company, Small Steps Labs, but the recognition is equally appreciated. More info from the UT article: utsandiego.com/news/2012/jun/29/tp-winner-fills-hole-in-city-app-market-winning/ 


In a surprise move, Apple has relaxed their restrictions on which tools and languages developers can use to build apps for iPad and iPhone they previously disallowed in section 3.3.1:

"In particular, we are relaxing all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code," Apple said in a statement released to the press. "This should give developers the flexibility they want, while preserving the security we need."

http://arstechnica.com/apple/news/2010/09/apple-relaxes-restrictions-on-ios-app-code-iad-analytics.ars

I'm now intrigued at the propsect of the following code-reuse possibility using the Mono framework in addition to Microsoft C#. With Apple easing this restriction, C# works on:


With all of these tools, the goal is to reuse the functional (backend) code, and use the native UI (user interface) toolsets. For instance, on iPhone you still use Apple's user interface builder, but instead of combining that with backend code in Objective-C, you combine it with C# and the MonoTouch Framework(open-source .NET implementation). Same for Android, you combine it with Android's native UI builder, same with Phone 7. For the web, we use the MVC pattern which keep our functional code separate from our view (presentation code). Moving from the web to phones isn't a 1-to-1 switch, but some of our code could be cut / pasted.



But why C#? Aren't we playing in to the hands of the evil empire? Well, not really. I've said it before, C# is a great language that is as powerful as anything out there but lets developers write fewer lines of code. Like Java, we don't concern ourselves with low-level memory allocation and we get access to a powerful, tried and true tested framework for almost every web, client, server scenario you can find yourself in.


But C# isn't "free" as in "freedom", I hear. Well, more than you'd think. Microsoft released C# in a way that you, I, or for instance, Novell could freely implement the language and it is now a free ECMA standard language: http://port25.technet.com/archive/2009/07/06/the-ecma-c-and-cli-standards.aspx

As Microsoft's release explains it:"Under the Community Promise, Microsoft provides assurance that it will not assert its Necessary Claims against anyone who makes, uses, sells, offers for sale, imports, or distributes any Covered Implementation under any type of development or distribution model, including open-source licensing models such as the LGPL or GPL."

They even went so far as to apply these rules to their MVC framework, ASP.NET MVC.

Most businesses have to pick and choose to support more than one phone, which means a different code base and developer skillset. Web-based mobile apps are one approach, but are limited in capability so sometimes don't fit the need. I hope to see C# grow as a broader solution to cross-platform development.