2006
9/27

Scratching out an App







6Tringle's featured product: PhotoClay Logo Photo mushing fun with your finger

Buy app through iTunes








We enthusiastically recommend:

Drawing a line in the ground

Where do you start? When growing a garden, which seed gets planted first? You have the crazy idea for an app that would win accolades, quiet screaming babies and woo the gender of your preference. Now what?

Starting an app from nothing can be much more daunting that jumping into a partially or fully finished bowl of code. If you find you self staring at an empty project in Xcode, the ultimate-super-secret is to find an starting point with a low barrier of entry.

Do UI love me?

When brewing Cocoa, you will always have a GUI. One way to get started is to mock up an app in an image editor or directly in Interface Builder. Since we are at day one, we should create GUIs that get us started, not GUIs where we fuss over pixel widths. If you create a GUI intending to throw it away, you won't fuss over extraneous details. Premature GUI tweaking is a tuber of evil.

throwaway GUI example image

It's not pretty, but it will take you about 60 seconds to do in IB. The "browse for file" code will be fast, even if you have never done it before. The key is the big button in the middle. You hook up an IBAction, a few IBOutlets and BOOM. IB will generate the template and your LBoE point is waiting to be filled in like an overdue tax form.

Prove it!

Another starting point is writing tests. The low barrier here is that writing a test should be easier than writing the code that passes a test. Writing test code may not be interesting, but that's a personal problem. Recent versions of Xcode have a testing framework built in.

The whole software testing concept is explored in a diverse medley of websites, books, articles and interpretive song and dance. One way to get get basic functionality started is to write a test. If you know you are going to need some string processing functionality, write a simple test with some example inputs and outputs.

I Object

If your app is based on Core Data, you can use Xcode's Data Model Design tool to create your model graph.

coredatamodel

This is a widget based tool that will get you thinking about your objects by visualizing the relationship between them. As if this LBoE wasn't low enough, you can create a simple GUI by dragging and dropping from Xcode to IB. It's a neat party trick and sure to impress innocent bystanders.

Let's just keep things simple

The lowest of low barrier entry points is a simple list of priorities. This can be done with a text editor or fancy outliner. The outline format maps well; the code will eventually be structured into chunks of functionality, each with sub-functionality. Once your priorities are laid out, draw straws and pretend you are sentencing an item to execution by delete key.

  • SuperApp
    • Object Model
    • Need Simple Text Processing
      • Convert // to <!-- --> inside an NSString
      • Convert <,> to html entities inside an NSString
      • Convert tabs to spaces inside an NSString
      • Convert one long NSString (with n's) into an NSArray of NSStrings
    • Basic GUI
      • open dialog
      • display raw HTML in an NSTextView
      • display preview HTML in a WebKitView

What if we just start over from the middle?

It is also important to remember that you don't have to start from scratch. Apple has a trove of example code that can help those new or not so new to Cocoa. The always excellent CocoaDev has an exhaustive list of sample code.

If you do find code in the wild, remember to respect the licensees and don't plagiarize. Give credit when it is due.

Let's take things a step at a time

It should be intuitively obvious to even the most casual of readers that the critical action is to just get started. Million dollar ideas are worth approximately $0.02 if they are never acted upon.

Products of unassailable virtue and rectitude

about products blog contact misc xml