Monthly Archives: February 2012

How to make apps if you’re not a good programmer

The other day I received an email with the following question:

“I have this great idea for a game, but I’m new to iOS development and this goes way over my head. So I’m wondering if you could help with the development or know anyone else who can? Of course, we’ll split the profits.”

Since this isn’t the first time I’ve received such a request, I thought I’d put up my answer here.

It’s not easy getting started, that’s for sure. It can take a long time to go from noob to someone who can make quality apps. Also, not everyone is cut out to be a programmer.

Having a great idea is only the beginning, but the money is in the execution. If you don’t know how to execute, then you might need to take another approach to get the app made.

Even if you can pull off the programming part, that is not enough to make your app a success. You also need to get it to the right people, in the right place, at the right time. That also takes certain skills.

Sell your idea to find your team

Here’s what I would do: To find someone to work on this with you (for a part of the profits rather than work-for-hire), you’ll have to convince them of the potential of your idea. The best way to do that is to make a short demo video. Appsterdam’s Mike Lee wrote a good blog post about that.

With that video you can set up a project on Kickstarter or a similar site, that allows you to raise money from small-time investors and at the same time attract attention from developers and even potential customers. With that money you can hire a professional programmer, designer, and anyone else you need.

Let’s say you raise only $5,000. That by itself won’t be enough to pay for the development of the app, but it will serve as a decent down payment for the people you will hire. With some up-front cash and a convincing demo video, professional developers might be more willing to work for profit sharing.

In other words, if you don’t have the programming or design chops to make the app by yourself, you will have to play the role of a producer (like a movie producer) instead of a programmer, and gather a team of people who are willing to work with you.

Most of these people — if they are any good — aren’t interested in working for profit if you’re not also bringing something to the table. Asking someone to work on your project for a share of the (hypothetical) profits is asking them to invest their time and talent into your idea — and by extension, your leadership — at their expense, based on nothing but a promise of a fat payday. You’d better be ready to deliver on that promise!

But what if someone steals my idea?

You’re putting your great idea out there for the world to see in order to attract investors and talent, so what’s to stop others from simply copying it?

Here’s the thing: it is incredibly hard to make a hit game or app. If your idea is something anyone can build in a handful of days that is guaranteed to sell itself without any effort, then keep it to yourself. These are one in a million ideas and chances are yours isn’t one of them.

Your idea will take many months of dedicated effort to turn into something real and many more to find its way to customers. No one will steal it because no one else will care about it as much as you do or is willing to put in that kind of effort.

It’s not the idea that is worth money, it’s the execution of the idea. Most of the hit games on the App Store are not 100% original ideas — for example, Angry Birds and Tiny Wings are both based on other games — just very well executed versions of those existing ideas.

The idea isn’t really yours to keep

Now personally, I believe that you have to let go of the notion that you can “own” an idea. An idea by itself is nothing. That’s why you can’t really “steal” ideas. On the other hard, you can certainly own the execution of the idea, and that is protected by copyright laws and by the fact that’s it’s just a lot of hard work.

The only way you will ever profit from your idea, is to make sure you are the one with the best version of that idea.

If your idea is truly good but you put out a very basic, average implementation of the game that you programmed and designed yourself, chances are that hardly anyone will care about it. But it might inspire some other developer and a few months later some other team makes a lot of money from your idea but done better. You will have blown your opportunity.

So if you want to be the one with the hit app, you need to be the one making the most amazing version of it. And that requires programming help if you’re not a very good programmer, design help if you’re not a good designer, and marketing help if you’re not a very good business person.

So start working on that video!

Illustration by Oscar S.R. / miutopia (from openclipart.org)

Don’t Abuse the App Delegate

Many of my tutorials (and real apps) have code in AppDelegate.m that looks like this:

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    DataModel *dataModel = [[DataModel alloc] init];
    self.rootViewController.dataModel = dataModel;
    . . .
}

The app delegate creates the data model object and passes it to the root view controller.

The class may be called something different than DataModel, but that’s essentially what it is, the data model for the app. In a Core Data app, this could be an instance of NSManagedObjectContext.

At some point, the root view controller opens another screen, and it passes along the DataModel object to this new view controller:

- (void)tableView:(UITableView *)tableView
    didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    SecondViewController *controller = [[SecondViewController alloc]
        initWithNibNamed:@"SecondViewController" bundle:nil];
    . . .
    controller.dataModel = self.dataModel;
    . . .
    [self presentViewController:controller animated:YES completion:nil];
}

Invariably, someone asks: “Why not simply ask the AppDelegate for that data model object?”

They propose code such as this:

// Somewhere in SecondViewController.m:
- (void)someMethodThatNeedsTheDataModel
{
    DataModel *dataModel = ((AppDelegate *)[UIApplication
        sharedApplication].delegate).dataModel;
    . . .
}

That looks a bit ugly, but you can always “work around” that with a macro:

// In your Prefix.pch file:
#define MY_APP_DELEGATE ((AppDelegate *)[UIApplication sharedApplication].delegate)
 
// In SecondViewController.m:
- (void)someMethodThatNeedsTheDataModel
{
    DataModel *dataModel = MY_APP_DELEGATE.dataModel;
    . . .
}

The DataModel object is now a property on the AppDelegate class, and you can “just” ask for it whenever you want. Easy right?

I don’t know who came up with this idea, but it seems widespread, especially among beginners. It’s also a quick fix with harmful consequences.

So what is the difference?

My preferred approach requires you to pass the DataModel object (or objects) from each view controller to the next, or at least to those that need it. That seems like more work, but it has an important advantage: your view controllers only depend on the objects that they directly need.

It is a good object-oriented design principle to limit the dependencies between your objects. The looser your objects are coupled, the better.

This is what the principle looks like in a picture:

The view controllers pass around the DataModel object

However, when all your view controllers depend on the app delegate, the diagram looks like this:

All the view controllers are now connected to the AppDelegate

The problem is this: As your app grows, it will have a lot of classes that have many interconnections between them. The greater the number of connections, the harder it is to understand what is going on in your code, and the harder it is to make changes. If you’re not careful, your code will become a big mess — and we all know where bugs love to hide.

By using the app delegate this way, you’re adding even more complexity to the web of connections. Each view controller now has to reach out to AppDelegate to get the data it needs to do its job.

You’re also giving AppDelegate too much to do. Before you know it, it has become this humongous class that is responsible for just about anything in your program.

Passing around objects all the time seems like a chore, but it’s the cleaner design. Consider each view controller in your app an island that can function independently of all the other view controllers, given the data model objects it needs for its calculations.

What should the app delegate do?

The app delegate performs an important function in your app but is not intended to be some magic singleton that holds all your data.

It is the place where you receive notifications that concern the application as a whole: the app is launched, the app is about to go into the background, the app has returned from the background, and so on. You should restrict the role of the app delegate to just handling those notifications.

The app delegate is where your app initializes itself — it creates the window and loads the initial view controller, it creates the data model objects or Core Data store — and then it passes control to that initial view controller. Beyond that, the app delegate should just handle the application-wide notifications and do nothing else.

So if you feel tempted to write,

[UIApplication sharedApplication].delegate

anywhere in your code, then it’s time to rethink your class design.