How Apple does business

Introduction to the madness

I’ve been an Apple user now for five years, ever since the first Intel MacBook Pros hit Finland. I’ve been watching Apple with a good amount of fascination, especially since the launch of the iPhone, iPod Touch and the App Store. Besides developing iOS software, I also sit in the board of a successful small-to-mid-size company that is the market and technology leader in its niche. So, my perspective towards Apple has been both curious, trying to understand the way they operate and what is the guiding philosophy and strategy behind it all, and also that of a satisfied and at times delighted user.

I’ve chosen not to comment on Apple’s strategy as I feel I don’t have good enough grasp of it to really make a contribution. That hasn’t changed, but in the last couple of days senior managers from both Dell and Microsoft have made statements that show a level of ignorance that I can not understand. I would imagine that managers at those position would be required to have a very deep understanding of the markets they operate in, and of the competition they face. They should also possess a sound vision of where the world is going to. It seems painstakingly clear that both Andy Lark from Dell and Microsoft’s Craig Mundie lack those qualities, though I’m inclined to be slightly less disappointed with Mundie. At least he seems to have some kind of vision, but in true Microsoft fashion his vision of how things will be is quite unfeasible for at least the next 5 to 10 years. Microsoft, I feel, gets knocked down sometimes a bit too harshly: they do have ideas and some of them are good, but they have terrible timing and usually poor implementation.

Anyway, back to Apple. Prompted by this evident lack of understanding, I feel compelled to try to put forth how I see what Apple is doing.

Business and Apple

Based on your viewpoint, Apple’s approach to doing business is either really traditional or really disrupting. To put is simply, Apple believes that by doing the best products they can, they will find customers willing to pay for them. Apple works like a craftsman who takes pride in doing the best work he can, as judged by himself. And if that isn’t traditional, then I don’t know what is. The disruptive angle is that craftsmen have all but disappeared from the western markets. We, the customers, are no longer in charge. We’ve been conditioned to buy what is offered to us, to only look at the price and to generally be at the mercy of the middlemen. In enterprise, we get what the IT department deems necessary. In phones, we get a choice of what the carriers want to sell to us. In our homes, we get what the big chains push to us.

It’s our choice, but it’s a choice we’ve been conditioned to make. And we do have the freedom (in many cases) to make a different choice. Apple is a different choice, still, even today. Hardly any place pushes us to have an Apple product. People choose them, they want them.

That is, in a nutshell, the way Apple does business. Their customers are the end users, the people who use their products. And we are disrupting the status quo by not settling for what is being pushed to us.

Simple, isn’t it?

Many tech savvy people have a difficulty understanding why anybody would want an Apple product. For them, they claim, Apple products are closed and proprietary and don’t allow them to do what they want. It’s almost as if Apple were holding the users captive. Why would anybody buy an Apple product that only lets you do A, B and C when you can get a competing product that does A, B, C, D, E, F and G, and usually is cheaper? But the basic assumption here is wrong. For the general public, for the normal people, the competing product only does A, and even that it does poorly. For normal people, Apple’s products are empowering. People who used to be able to do only A (poorly) are now suddenly able to do so much more.

Think about this: if could now replace your car with a flying car that lets you get to all places faster and more comfortably than your old car, would you complain that it can’t fly to moon?

What is Dell’s Andy Lark smoking?

Ok, this interview with Andy Lark, Dell’s global head of marketing for large enterprises and public organizations, is just too much. How can he be so out of touch with reality? Let’s go over some of the gems of that interview. And, to be frank, there doesn’t seem to much else in there.

“I couldn’t be happier that Apple has created a market and built up enthusiasm but longer term, open, capable and affordable will win, not closed, high price and proprietary”

Meaning “we tried for years but failed to do what Apple did. I know the iPad is inexpensive, but I’m going to try to exploit the image of expensive Macs to paint a different picture.”

“[Apple has] done a really nice job, they’ve got a great product, but the challenge they’ve got is that already Android is outpacing them.”

This one is pure gold. Remember, we’re not talking about phones here. So, Andy Lark, pray tell us exactly which Android tablets are outpacing the iPad? The only metric where Android tablets outpace the iPad is the return rate. (And yes, I know Samsung has denied those numbers, but there is considerable doubt as to what are the actual Galaxy Tab sell through figures.)

“Apple is great if you’ve got a lot of money and live on an island. It’s not so great if you have to exist in a diverse, open, connected enterprise; simple things become quite complex.”

Yeah. So the reason why the iPad has 95% percent satisfied customers and the highest rating the American Consumer Satisfaction Index has ever tracked must be that nearly all of the millions of iPad users are rich and live on an island, most likely a tropical one. And hardly anyone uses iPad in an enterprise, despite the fact that over 80% of the Fortune 100 are either piloting or deploying iPads to their organizations. So clearly the iPad is already a failure if you don’t count the satisfied users and enterprise organizations.

“We’ve taken a very considered approach to tablets, given that the vast majority of our business isn’t in the consumer space,” he said. “[A company] like Samsung has to aggressively go after their business, but we’ve got a far more diversified footprint than some of these players.”

This considered approach that Lark speaks of consists of doing both Windows 7 and Android Honeycomb tablets. It also means that “we haven’t been able to put together a credible product that would sell much of anything to either consumers or enterprises, so we’ll pretend that was the plan all along.”

You might be able to chalk Lark’s comments up to just corporate PR talk, until the next comment about the economics of an iPad.

“An iPad with a keyboard, a mouse and a case [means] you’ll be at $1500 or $1600; that’s double of what you’re paying,” he claimed. “That’s not feasible.”

That is wrong on so many levels that it’s hard to believe. It’s even harder to believe that Lark has been able to get to the position he’s in, and remain there, without grasping even the slightest bit of reality.

Starting with the most expensive, 64GB 3G iPad 2, a leather Smart Cover, an Apple bluetooth keyboard and the digital AV adapter you get to $829 + $69 + $69 + $39 = $1006, an extra cost of $177 or 21%. If you go for the 16GB WiFi only model, then the icrease goes up to 35%. Still a far cry from double.

Then there is the bizarre notion of a mouse. Apparently Lark has never used an iPad, or he’d know that it’s designed to be used with your fingers. In fact, you can’t even use a mouse without jailbreaking your iPad.

Not only did Lark get his math way off and misrepresent the price of even the most expensive iPad but he also demonstrated a total lack of understanding the iPad and the tablet space in general. Good guy you have running your marketing, Dell.

Using CCProfiler and CCProfilingTimer

If you’re doing more than the simplest of games, chances are you want to know which things take the most time so that you can focus your optimization efforts in where it makes the most impact. Of course, Instruments with Time Profiler gives you a detailed list of exactly what functions and methods are hogging those precious processor cycles, and I thoroughly recommend using Instruments. However, there are some cases when you would welcome a different toolset and that’s when CCProfiler and CCProfilingTimer come in handy. They are not as easy to use as Instruments, though, and there is surprisingly little instructions on how to use them. Perhaps that’s a testament of just how good Instruments is, or perhaps people are not aware of them. So, if you’re using Cocos2D for the iOS, read on to learn more.

The profiling tools in cocos2d are admittedly simple: you need an instance of CCProfilingTimer for each piece of code you want to time, and you create it via the singleton CCProfiler object. The CCProfiler then prints out the average times for each timer once per second, and that’s it. You won’t get any percentages of time used or any information about the call stack. You will, however, get information about how much actual time each timed piece of code takes, and if you’re targeting, say, 60 FPS, well, you know you can spend at most 16.67 milliseconds per frame. So the actual time used is a very useful metric for game developers.

Though they are simple, I have to admit I made a couple of minor changes to the stock CCProfiler and CCProfilingTimer to make them a bit easier to use. With the stock implementation, you’re supposed to keep track of the CCProfilingTimer instances you’re using and dispose of them once you’re done. This means you need to modify code at four or five different places: declare the ivars in the .h file, init the instances, start timing for an instance, end timing for an instance, and finally release the instance once you’re done with everything. I thought that made things overly complicated, especially since you’re bound to use a number of different CCProfilingTimers, one for each thing you want to time, and I wanted to simplify things as much as I could.

My aim was to make it possible to use profiling with code modifications in just two places: starting timing and ending timing. That also means that you need to create the timer instance when you start timing, and you’ll need a way to access the instance when you stop timing. The latter is usually not such a big problem since in most cases you will start and end the timing within the same function or method and you can use the same instance variable, but it is possible to access the timers using the name and instance you used when creating them.

The resulting solution I came up with was to use a dictionary to hold the CCProfilingTimer instances in the CCProfiler, and use the timer name as the dictionary key. That way, only the CCProfiler keeps track of the timer instances and disposes them when it’s done. The original CCProfiler used a mutable array and, while it would have been possible to continue using it, checking the array for containsKey would be a linear time operation and could turn out to be a problem with a large number of timers. I’ve tagged the lines I changed in the source files with my initials – MPT – just in case you’re interested to see what I did there.

So, how do you actually use the modified CCProfiler and CCProfilingTimer? Here are the things you need to do:

1. Grab the zip containing the modified CCProfiling.h and CCProfiling.m -files, unzip it and copy the files over the stock file in cocos2d/Support.

2. Head over to ccConfig.h, find CC_ENABLE_PROFILERS and change the value to 1.

3. Go to your code where you want to use profiling. Do something like this:

#if CC_ENABLE_PROFILERS
    CCProfilingTimer *timer = [CCProfiler timerWithName:@"YourTimerName" andInstance:self];
    CCProfilingBeginTimingBlock(timer);
#endif
    [self yourMethodYouWantToBeTimed];
    [self yourOtherMethodIncludedInTheTiming];
#if CC_ENABLE_PROFILERS
    CCProfilingEndTimingBlock(timer);
#endif

4. That’s it. When you run your app, CCProfiler will print average times to the console once per second.

It’s not strictly necessary to wrap the profiling code bits with the preprocessor #ifs, but it makes it easy to turn profiling on and off for the whole app. If you want to begin and end the timing in different methods, but still within the same instance, change the end timing to:

#if CC_ENABLE_PROFILERS
    CCProfilingEndTimingBlock([CCProfiler timerWithName:@"YourTimerName" andInstance:self]);
#endif

If you’re starting and ending the timing in different classes and/or instances, you’ll need to pass the timer name and the instance used to create the timer to where you end the timing, otherwise you won’t be able to reference the timer. In real world usage I suspect these scenarios will be exceedingly rare.

Geotargeting App Store affiliate links

Awhile ago, I posed a question on the iPhoneDevSDK forums about GeoRiot and geotargeting LinkShare and TradeDoubler affiliate links. I got only one reply suggesting using PHP, and Googling the issue of geotargeting links to the App Store yielded precious little. Thus, I decided to take a better look and see what could be done with javascript. I wanted to make the process as simple as possible, requiring as little changes to the existing pages as possible.

To cut a long story somewhat shorter, Google offers a javascript api at http://www.google.com/jsapi though browsing the source code is of little value for the casual observer. Anyhow, you can use Google’s javascript library to find out where your user is coming from, and then do something about it. I decided to iterate through all links in the html document, identify links to the app store, and then modify those links into proper affiliate links to the correct affiliate program and to the correct iTunes country store.

You have to first register with LinkShare and TradeDoubler, and apply for the iTunes affiliate program within each. TradeDoubler also required us to add a site verification code to our index.html head. Once you’ve successfully registered and been approved to the iTunes affiliate program, grab your affiliate ids from LinkShare and TradeDoubler and you’re ready to go. Apple provides some additional information about affiliate linking which can be useful, read their article on Advanced Affiliate linking. Please note that you should not use this javascript for geotargeting affiliate links in apps, for that Apple has a section in the article.

Once you have all the preparations done, using my script is fairly simple:

  1. Put normal deep links to the App Store products on your page. To get a deep link, find the app in iTunes App Store, right click the icon of the app and choose “Copy Link” and paste the link to your page. Do this for all App Store links on your page.
  2. Grab the affiliatelinking.js file, edit it to and put in the correct affiliate ids you have from LinkShare and/or TradeDoubler into constructAppStoreAffiliateLinkHref -function. Currently, DGM is not supported; in my experience it nigh impossible to get anything working with them: we had great difficulties in even managing to register and log in to their site, let alone enrolling in the iTunes affiliate program. So for Australia and New Zealand, the script returns the iTunes deep link without the country code. Don’t worry, those links work great: they will automatically redirect to the appropriate iTunes country store. Also, you need to put in your site id for TradeDoubler.
  3. Insert the following code snippets to the head part of your page(s):
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script src="http://www.yourdomain.com/scripts/affiliatelinking.js" type="text/javascript"></script>
    <script type="text/javascript">window.onload=modifyAppStoreLinks;</script>

Unless you have other function calls firing on window.onload, that’s all you need to do. The script goes through your page and finds the links, checks each link to determine whether it is a link to the App Store or not, and if it is, it then cleans up the link and adds all the necessary stuff to make it a proper affiliate link. If you have other functions in your window.onload, then you have to add a call to modifyAppStoreLinks to an appropriate place in your code.

That’s all, I hope this is helpful to you.

Bob The Bubble free for today

As part of OpenFeint’s Free Game of the Day, Bob The Bubble is now free.

Get Bob The Bubble for free from the App Store

The offer is valid only today, so go and get your copy now!