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

Friday, August 15, 2008

Subversion add-ins for Delphi

Part 4 of a n part series on Subversion and delphi

Subversion add-ins
As we have already established, TortoiseSvn adds version control functionality to windows explorer. This is all good, and the result is quite functional. Many people need nothing more. However for the rest of us, there are a number of ways to integrate subversion into delphi.

File Browser
If you have a recent version of delphi, and have TortoiseSvn installed then you get integration for free. The File Browser window (View menu -> File Browser) uses the Windows Explorer context menu so all TortoiseSvn commands also work with the File Browser



JCL Version
The jedi control library (jcl) includes a Tortoise (Svn and CVS) add-in that adds a JCL Version menu. Most functionality is available, although I have never managed to get Diff working. It requires Tortoise to be installed. If you are already using Tortoise and the JCL, it's a bit of a no-brainer.




Others


There are a few others that I haven't used.
  • Delphi Svn is available from SourceForge. It looks like it doesn't need Tortoise to be installed.
  • The gloriously named delphiaddinfortortoisesvn is available from tigris.org, home of TortoiseSvn. As you might expect, it requires Tortoise to be installed.

Links
Tortoise
Jedi Control Library
Delphi Svn
Delphi Addin (Tigris)