Monday, August 18, 2008

Programming for the iphone really sucks

Ogrampray, ergo sum. I program, therefore I am.

I have wanted to program nearly every device that I own (except for video recorders).
Now that I have an iPhone, I want to program that. Unfortunately there are a number of roadblocks in the way...

NDA
The iPhone nda is ridiculously draconian. There are enough posts on the subject that i won't do into details. See here if you want to know how developers feel about it. Basically, you need to figure everything out yourself coz you can't ask anyone else. There are still discussion groups, but they may be gone tomorrow. There is also a series of tutorials at IphoneSdkArticles.com but that may also disappear.

Objective C
ATM, your choice of development language is Objective C or Objective C.
If you are a windows developer, you first question is probably "Wtf is Objective C?". The short answer is that it is yet another version of C with objects, designed by someone with an unholy fascination for square brackets. The average line of code contains slightly more text than symbols, but only just.

ObjC is primarily used on Apple machines, and sits at #42 in the tiobe list, just below Erlang.

Because it is Apple only, the development tools only run on OS X (you can use gcc on windows, see here, but it's not easy). The tools may be free, but you need a $1000 OS X machine to run it on.

The sdk license expressly forbids interpretors, JITers and iPhone based compilers. So the only way to get java or mono is if they develop an ahead of time complier. Here's hoping.

Multitasking
Nope, sorry, you don't need it. Applications run full screen, single window. When the user presses the home button, your app exits. To get back to your app, the user needs to start it up all other again. This immediately rules out a large number of interesting applications, and adds a certain amount of complication to development. As an aside, Windows Mobile does exactly the opposite and minimises applications rather than closing them, so they can reopen more quickly. This approach is also arse.

Application sandbox
Each application is stored in a single folder. All files, settings and related documents are stored within that folder. The application can only access the contents of their folder. There is no concept of a user documents folder. There is also no simple way to get documents onto the phone for use by your app.

Example: I have an ebook on my computer. I would like to read it on my phone (I have kids, I spend a lot of time sitting in the car waiting). On a windows mobile machine, a palm, or even my old Psion S5, you copy the file over onto your machine, and open it. On a iPhone, it's not so easy, Using ereader, I need to upload the ebook to their website, and then download it again on the iPhone. Alternately, they helpfully suggest, I can run a web-server on my PC.
On the other hand, the Stylus and Bookshelf book readers provide desktop software (50meg download, written in java) that will let you copy documents over using wi-fi. If I ever need to transfer documents when I don't have a wi-fi router, I am in for a large amount of aggravation.

So, if you are writing a app that needs to work with documents, you also need to write a client/server file transfer application, in a different programming language, just to get you document where you can use it!

Distribution
As a means of getting your application to a large number of paying punters, App Store is not too bad. The 30% commission is high compared to Paypal, Regnow, SwReg etc, but low compared to phone/pda specific sellers such as Handango. However as a means of distributing your app to a specific group (ie company wide as opposed to world wide) it is less useful.

Positives
There are some good points about iPhone development though.
  • The hardware is essentially the same (+/- 3g, gps) on every device. This is a significant contrast to Windows Mobile where the screen size and orientation can change, there may or may not be a touch screen, camera, gps, wi-fi, internet etc).
  • Appstore makes purchasing applications dead easy. I suspect that iPhone users will end up with more applications than windows mobile users.
  • The development tools are quite polished, and cheap if you already have an Apple machine.
  • The phone has lots of useful functionality. GPS, wi-fi, accelerometers, camera etc. I can't think of any other phone that has sold as well and has as many toys to play with.
  • The xcode development tools can also deal with C++ and C code, although the sdk is in Objective C.
If you are a Apple developer, developing for the iPhone is a no-brainer. For a windows developer, it is a much harder decision.

Links
NDA comments
SDK Discussion group
iPhone SDK Articles
Wikipedia on objective C
iPhone Development on Windows

12 comments:

Anonymous said...

Take a look here: http://www.readwriteweb.com/archives/morfik_builds_first_iphone_development_tool.php

Morfik IDE runs on Windows, and you can choose your preferred language to code: Pascal, C#, Java or even Basic. Maybe it can help.... hehehe

Yogi Yang said...

There is a thing called Darwin on http://free.oszoo.org which is a MacOS clone and it really works.

So I think you can now develop software for Mac without purchasing the original OS.

Try it!

Sean said...

@Anon
Morfik is web only atm.

@Yogi

I'll have to take a look

Alister Christie said...

A timely post - I'm just thinking about porting a pocketpc app to the iphone - I'll probably use VMWare to get around the OS/X thingie (saves buying a machine - but still need an OS license). It'd be nice to see Delphi for the PocketPC or iPhone.

Sean said...

@Alister

Don't bother with a vm. Google "usb hard drive osx"

Jeremy said...

[Release] Leopard for VMware Virtual Machine

I downloaded his VMware session last night and gave it a shot this morning using VMware Workstation v6.0.4. Its mostly working but I'm having a problem getting the network to work with it.

I haven't installed the SDK for the iPhone yet. Of course I only signed up for the free SDK. Not going to purchase it until I can get it working and play around with it a bit. I'm looking forward to using RemObjects Project RO|C with the iPhone.

Regards

Peter Eddy said...

I think you should try Objective-C before you dismiss it. It's not perfect, but it's much nicer than C/C++ for GUI development, especially because Apple's GUI framework is mostly Objective-C classes. Also, the OSX thingie is much nicer to program to than the Windows thingie.

Sean said...

@Peter,

I have played with Obj C, but I ended up doing most of my iPhone development in c++. The main drawback for me, is that Obj C is essentially single platform. It may be better than c++ for gui work(a low bar), but it is not a skill I can use outside of the iPhone/OSX system.

Techjunkie said...

According to some recent studies a typical iPhone game contains; 500000 lines of C code, 0 lines of C++ code and 700 lines of Ojective C.

Techjunkie said...

BTW, check the tiobe list today... ;-)

Sean said...

@Techjunkie
That's interesting. My code was mostly c and c++ with as little Obj C as possible.

Anonymous said...

This is an old post, but it came up in Google for people looking for SDK access to databases from iPhone and that's accomplished with http://ODBCrouter.com/ipad