iPhone thoughts I — Cocoa Touch framework

I have several more things to say in the Web apps vs. native apps debate, and I’ve decided that a few smaller posts treating just one subject would be the best form. Today we kick off with the Cocoa Touch framework.

John Gruber wants me to mention the Cocoa Touch framework. He feels that its excellence is an important factor in the success of native iPhone apps.

Point is, although Gruber’s probably right, he ought to be wrong.

If all you have is a hammer, every problem becomes a nail. If all you know is the Cocoa Touch framework, every app you make will become a native iPhone one, whether that’s a good idea or not.

If you have to choose between, whatever, two kinds of Web servers, picking the one with the better tools (libraries and such) is an excellent idea. They’re both Web servers, after all. The net result to your end users will be the same, but your job will become easier.

It’s different with Web apps vs. native apps.

The net result of a Web app is that anyone with a modern browser can use it, though on some devices the user experience is less-than optimal. The net result of a native app is a superior experience on the iPhone, and nothing for the rest of the world.

What do your users want you to pick, superior user experience or vastly bigger reach? Do you need device APIs, and is there a way to get paid? Those are the questions that matter right now.

Cocoa Touch is excellent. There, I said it — without having the faintest idea what I’m talking about, obviously.

But it’s just a tool. It shouldn’t matter.

This is the blog of Peter-Paul Koch, web developer, consultant, and trainer. You can also follow him on Twitter or Mastodon.
Atom RSS

If you like this blog, why not donate a little bit of money to help me pay my bills?

Categories:

Comments

Comments are closed.

1 Posted by Marc on 26 November 2009 | Permalink

You should take a look at Gowalla.

I takes a hybrid webapp/native app approach.

Having the native app is really nice, but I can still jump on a browser and use the service.

But the user experience with the native app is just sooo much better.

2 Posted by barryvan on 26 November 2009 | Permalink

I believe that the best way forward for developers is a hybrid -- provide some basic chrome using Cocoa, and have the rest of your app delivered as a webapp. This will, theoretically, allow you to create a completely 'native' UX, as well as write portable code.

All that's missing is a simple toolkit that lets you 'convert' web apps to native iPhone apps cleanly and easily.

3 Posted by Daniele on 26 November 2009 | Permalink

Developing a js library/css framework/whatever that emulates the iPhone OS UX shouldn't be a big task for Apple. Point is, they don't want to.

4 Posted by Jerry on 26 November 2009 | Permalink

noob here. is there an inherent reason webapps can or can't be used on desktop browsers?

5 Posted by Damien on 26 November 2009 | Permalink

It is also about what your users want.

Look at Dropbox, they have desktop apps and a webapp. They quickly made the webapp work for the iphone but users were still eager for a native app.

(the dropbox' webapp doesn't have an offline mode unlike the native app)

6 Posted by Mayel on 26 November 2009 | Permalink

There are frameworks such as http://www.phonegap.com/ who are working to make it possible to build mobile applications in HTML and JavaScript while still taking advantage of the core features in the SDKs of iPhone, Android and Blackberry, etc.

They do this by providing a unified JavaScript interface to the phones' native APIs and dummy apps that wrap your HTML/JS package and that you can compile for each platform.

7 Posted by Adam on 26 November 2009 | Permalink

In fact, Cocoa is so great that the web browser already supports it through the amazing efforts of the Cappuccino project. Web apps are moving to this kind of Javascript framework-style development because HTML/CSS is a terrible platform for applications. Like Cocoa Touch, Cappuccino hides the implementation details so that the developer can focus on developing and not worry about the ugliness of the underlying system.

Given the trends in web application development, what role does the web browser even play? Cocoa Touch and modern web applications share very similar code bases and programming styles. In fact, I mentioned Cappuccino because that framework specifically can target native iPhone, native Mac, as well as the web browser from the same code base.

If fast, secure, and portable network applications is the ultimate goal, why doesn't the "web browser" provide only a canvas to which the Javascript application may draw to and forget about HTML/CSS completely? An HTML renderer can be an application built on top of this "web browser" if you want access to pages that are not applications.

8 Posted by AJ on 26 November 2009 | Permalink

I think web apps are your hammer.

I'm new to the web development environment so this is going to skew my comments. I'm currently developing html/javascript/css based app not involving web pages. If it did have one the point I'm attempting to make would be no different because then you'd add PHP/Python/MySQL/SQLite/whatever to it, too. I'm replacing a current GUI written in .NET 3.5.

My beef/point is this. After working in a nice integrated environment like .NET, entering the world of web development is just plain ugly. I feel I've dropped back in time to 1991 and Windows 3.1. Just the act of trying to get a customized button or showing a popup window requires too much code in too many places. Writing useable interfaces means building on a hodgepodge of libraries (prototype.js or jQuery.js??) which don't play well together. It's all a hack fest to get it to work.

I can't tell you how much time I've wasted trying to debug a simple syntax error (that's with a tool like Aptana.) I really miss my compiler. Call me lazy, but I was waaaaay more efficient in .NET. Sure there are things for which web apps are needed, but having to use such disparate tools to shoe horn in a basic GUI experience is just ugly and inefficient.

9 Posted by Roland van Ipenburg on 26 November 2009 | Permalink

What it seems we're dealing with is a generation that doesn't realize we could have had it the easy way years ago if we treated Microsoft then in the same way we're treating Apple today. A native solution made in a development environment handed to you by the powers that control the only platform it will live on will on that platform always be superior to a more generic approach based on open standards. The question is whether you just want to make a shiny quick buck or if you want to change the world.

10 Posted by Robbert Broersma on 26 November 2009 | Permalink

For once ;) I fully agree, Peter-Paul! Apple has been developing the iPhone/iPod Touch for many years now, and having the eagerness of developers in mind you'd expect Apple to have given developers full access to these APIs by now.

Instead they chose vendor lock-in and full control over what customers can install on their devices. And that's WRONG.

11 Posted by Joris von Loghausen on 26 November 2009 | Permalink

I agree with the hammer/nail view. And while I am in no way an advocate of making derivate for every phone/browser/microwave, I do wonder why you're using your webapp hammer all over the place ;)

Someone probably mentioned this before, but there's also the problem of serverload. If 200.000 people use your iphone app, good for them. If 200.000 people use your webapp, YOU have to invest in better hardware for the servers to keep it snazzy and responsive.

12 Posted by Fabrizio Di Giuseppe on 26 November 2009 | Permalink

When you use a WebApp on iPhone and you can't get connected you can't use the WebApp at all. Moreover, even if I like the idea that the Web is a develop every kind of application (that's the reason I like what Palm made with WebOS), I have to admit that not every kind of application can be developed using Web technologies today. I'm talking about thinks like… augmented reality browsers, is just one kind of application I'm working with now. Games are another kind of applications that for the most part can't be developed with HTML, css and JavaScript (WebGL is not here now). I'm sure I forgot other examples.

However, you have to remember that WebApps was the first solution proposed by Apple to develop iPhone applications. But at the end developers wanted a native SDK.

13 Posted by Steve on 26 November 2009 | Permalink

As a user, I would pick "superior user experience" without a second thought. The reason I'm using an iPhone/iPod touch (or any other Apple product) is because I value a product that works beautifully.

I have no desire to use apps that sacrifice user experience just so that they can run on other devices without much extra work. "Jack of all trades, master of none."

Currently, user experience is an area in which I feel iPhone web apps are seriously lacking. I'm not talking about pretty interfaces here—I'm talking about responsiveness. In an iPhone web app, when you tap a button, it takes *much* longer before something happens than in a native app. Everything is so much 'snappier' in a native app.

As a developer, because I value my user's time, and therefore, a smooth user experience, I would only consider developing a native iPhone app.

14 Posted by Daniele on 26 November 2009 | Permalink

"When you use a WebApp on iPhone and you can't get connected you can't use the WebApp at all."

Geez guys, DO invest ONE minute in research before making assumptions.

HTML5 has mechanisms for working offline.

Again, the slow response time is not a problem of the "webapps" system, it's a problem of the browser, a problem that can be fixed. So if webapps are not "snapping" is because apple didn't provide a system for them to be. So much for a company that makes products that work "beautifully".

HTML/CSS/JS being "awful" is a misguided perception. They are not "awful" they are "powerful" and allow for anything to be created, .NET allows for simple commands creating simple interfaces, custom controls require an amount of hoop-jumping that is unbearable.

I also think most of you mix the IDE used to create something, with the language it creates. Visual Studio (for instance) is a very nice IDE for .NET apps, an equivalent IDE could be made for webapp creation.

15 Posted by Silent Johnny on 26 November 2009 | Permalink

@daniele. You make it sound really easy. There have been JS frameworks longer than the iPhone / Cocoa Touch / XCode exists. Now where is that IDE you say can be made for webapp creation? I'm sure the web community could have come up with something awesome already.

Instead of only insisting on JS/HTML5/CSS3 being a great platform (which I really think it is), maybe you could actually *learn* something from Cocoa Touch and .NET. Take a look at Cappuccino/280Atlas.

Why do so may commenters say that it is so hard to build an application with 2 or more different UI toolkits? Come on guys, it's about your design, not the code (as I think PPK himself points out).

Talking about hammer and nails... which camp is trying to convince everyone of us to only use HTML5/JS/CSS3. Aren't these not just tools as well?

Oh, and how come you say Apple doesn't *want* to build on JS/HTML? Ever seen Dashcode? Checked out the new TuneKit? What about WebKit? WebGL? CSS Animations? Canvas was already in OSX Dashboard 5 years ago.

I could go on, but I don't want to sound like an Apple fanboi. Just want you to get your facts straight.

16 Posted by Silent Johnny on 26 November 2009 | Permalink

And for those of you who want to compare things: come and see my workshop on Cocoa combined with Jonathan Stark's workshop on PhoneGap. All at SXSW this Spring.

17 Posted by ArseneKarl on 27 November 2009 | Permalink

@Daniele

Apple is the main sponsor of WebKit and the new Nitro JavaScript engine. Both of them are FAST and Championing the HTML5 movement.

Clearly your problem with Apple has clouded your judgement.

WebApp on Android or Palm Pre or even the PC or Mac still sucks compare to the native ones...if there is a native one.

Sorry, if all you have is a WebApp hammer, find your nail and stop trying to hammer everything else.

18 Posted by Daniele on 27 November 2009 | Permalink

I have no problem with Apple, I never take things "personally".

I have many problems with their approach.

Say I'm a user that wants to develop an application, I am given an SDK from apple that lets me create it with a wonderful UX for native apps. The same people are not giving me an equivalent SDK (in the form of css framework, precut images/psd files, js library) and an equivalent platform (a browser that is as responsive) for web apps.

The iPhone is an iPhone and its hardware and software is the same for native apps and web apps. There is no sane reason why a native app should have a better experience than a web app. SPECIALLY if you consider that the webkit team is not shy in adding non standard stuff and is part of the team that works on html5 (and many css3 WGs too.)

About the IDE dilemma: the good IDEs are for some reason developed by people who wants to push THEIR product (visual studio for .net, netbeans for java...) and HTML is no one's.

Also IDEs are desktop applications (bespin being the exception) so if we don't have an IDE for that it's not the fault of webdevs, who do things on the web.

Then again cappuccino is going in that direction.

HTML5/CSS3/JS are OPEN tools, which is really the point.

19 Posted by ArseneKarl on 27 November 2009 | Permalink

@Daniele

Eh... Are you faulting Apple for not catering to you web developers' special need group?

God I though I've seen whiny people.

If you want all things done in HTML5/CSS/JS,WebOS all the way and more power to you and Palm.

Then again I don't remember seeing OpenGL API in Mojo (yet) and WebApps on the internet still can't use a lot of APIs, in fact it's no more optimised then say mobile Safari - and for GOOD reasons!

20 Posted by Daniele on 27 November 2009 | Permalink

Hey, THEY said they wanted to empower the web with new tools, THEY launched the iPhone saying that it would support awesome webapps. If they make claims like those and fail to provide tools as good as the one they provided for native apps, I can't be blamed.

21 Posted by Silent johnny on 27 November 2009 | Permalink

@daniele. Good point, though I am convinced they will. Did you take a look at Sproutcore? Or Dashcode for that matter?

22 Posted by ArseneKarl on 27 November 2009 | Permalink

@Daniele

THEY said a lot of things. and the WebApp vision regrettably flopped, two years ago.

And they MOVED ON, the world MOVED ON.

Apparently not you.

Just curious, are you still holding a grudge against SUN for their inability to bring NC to the mainstream?

23 Posted by Daniele on 27 November 2009 | Permalink

The WebApp vision didn't "flop", internet still works doesn't it?

What "flopped" was the amount of support the gave it.

I have no idea what you're talking about when mentioning Sun and "NC". Then again I'm not a great fan of Sun/Java either.

Seriously, my brain hurts when I try to parse the situation as you put it:
* Apple says "webstuff"!
* People says "yay"
* Apple delivers
* People says "boo, we want native apps"
* Apple retires and redelivers

It's more likely to be
* Apple says "webstuff"!
* People says "yay"
* Apple delivers
* People makes stuff with ugly UX
* People demands a better UX
* Apple provides a better UX library, but for a completely different language
* People splits
* NativeApp People says "yay"
* WebDev People says "wtf?"

24 Posted by ArseneKarl on 27 November 2009 | Permalink

I believe Apple will bring a lot of improvement into the future iPhone OS revisions.

The native SDK was not as powerful as iPhone 3.0 when it was first introduced.

And the WebKit engine inside iPhone was updated alongside every point release. I believe iPhone 3.1 just past Acid3 100/100.

Gradually more APIs and functionalities will be added, though I highly doubt it will catch up with the native APIs anytimes soon. And for some department, maybe Apple will never let loose. For Christ's sake even native app still can't get calender events.

25 Posted by ArseneKarl on 27 November 2009 | Permalink

@Daniele

When Apple said "webstuff"

The overwhelming reaction from developers is "WTF" "Epic Fail"

Yeah, I know WebDevs all fainted from ecstasy, one or two even died euphorically

26 Posted by Daniele on 27 November 2009 | Permalink

If it doesn't catch up it's because Apple doesn't want it to. No matter how updated Webkit gets, as long as they don't give it capabilities to match native apps, they are holding back the coming of webapps on the iPhone, for no good reason if you ask me.

Acid3 means it supports some functions, what webdev needs is both a performing platform and a js/css lib to leverage it.

27 Posted by ArseneKarl on 27 November 2009 | Permalink

@Daniele

From a user's perspective I see no good reason for Apple to invest major resource into a WebDev SDK now.

App Store is a hot mess, I need Apple first and foremost sort that out. It matters to me. From June till now, the lack of real improvement in the most obvious parts (ie. more coherent and well documented rules, accelerated view process) strike me as Apple's incompetence. And from anecdotes I've heard, Apple's iPhone Team is stretched very thin already.

Sophisticated WebApp can wait.

28 Posted by Silent Johnny on 27 November 2009 | Permalink

OK, final thoughts, because this is becoming too long a discussion between rather uninformed people.

The native SDK will always be faster, because it doesn't have a parsing overhead. This does not mean the JS engine will never be fast *enough* but there are limitations. It depends on the kind of application you are developing, but CSS transitions (like those used in JQTouch) are the best we'll get. These are hardware accelerated and Apple provided.

If you do not understand these limitations, that means you will have to do some serious research instead of blaming Apple they don't deliver web technologies. Because they actually do. And it actually works.

It strikes me that in this discussion, the WebApp zealots seem the most uniformed and ignorant ones.

Grow up. Please.

29 Posted by Roland van Ipenburg on 28 November 2009 | Permalink

As I said 20 comments ago, native will always outperform generic. But if you've got a dozen or so platforms with a native option, that doesn't mean developing a native solution for every single platform is always the optimal situation, even if every single native solution is better than a more generic one. Approaching this issue as developers who only claim how much better they can make their native solution doesn't solve the bigger issue.

30 Posted by Silent Johnny on 28 November 2009 | Permalink

@roland I agree, but there is also reality. Not every developer wants to (or should) be a zealot.

Even frameworks like PhoneGap don't solve all issues with JavaScript. The current state of JS has important limitations, especially regarding speed and security.

But we shouldn't blame Apple for not delivering what we want. Instead, we should start building that killer HTML5/JS IDE. We can do that today.

31 Posted by Roland van Ipenburg on 28 November 2009 | Permalink

Not every developer should be a zealot, but it's only because Apple doesn't allow Flash on the iPhone that developers with a web background suddenly are confronted with creating native applications. And probably none of those developers knows or is interested in what the possibilities of native applications on platforms that Flash does support are, so then it gets a bit tricky to defend Apple without realizing just creating native apps for Windows might then be a viable option as well.

32 Posted by BARTdG on 28 November 2009 | Permalink

I think this is a non-issue. There are great web apps and great native apps. I will use whatever app makes it easier for me to do what I want to. For instance, I hardly ever use the Facebook website, because the iPhone App is by far superior. I hope the Facebook webdevelopers will learn something from the iPhone app and be encouraged to do something about their sh*tty website.

Convince each other by building the greater app, not by being ideological.

33 Posted by Roland van Ipenburg on 28 November 2009 | Permalink

@BARTdG it kind of stops being ideological if you have to tell a client what it costs to develop functionality in all the available formats just so users can pick whatever they like. You know, in a reality where we're not being ideological about the iPhone an sich in the first place.

34 Posted by BARTdG on 29 November 2009 | Permalink

Roland, the point I am trying to make is that your if your client *wants* it to be available in different formats or on different platforms, then, sure, he should choose the web. But you may have a client who doesn't care about that and just wants to be on the iPhone for whatever reason.

I do agree that availability for all devices is really important, but saying that that is the ultimate ratio, is not a fact, but an opinion.

35 Posted by Roland van Ipenburg on 29 November 2009 | Permalink

Sure, and when a client for whatever reason wants something that should only work in Internet Explorer, we could just deliver that. I don't believe in "whatever reason". You should at least ask a client for a reason to cover your ass for when the client later asks why you didn't advise him to provide a better solution, because you are supposed to be the specialist and not just an Apple fanboi.

36 Posted by Daniele on 1 December 2009 | Permalink

I know all too well that an engine that could parse any animation will always be slower than one allowing only a selected subset of said animations. But as I said earlier the webkit is not shy about adding custom stuff, they could easily make up a -webkit-page-transition: iphone-slide hardcoded value that's very optimized, allowing for native(ish) effects with responsive and smooth UX that can gracefully degrade for other browsers.

I still see no reason not to.

I have a dream, a dream of an open market that lets silly applications be handled via open technologies.

We're not talking about making a perfect replica of Adobe Premiere CS4 for the iPhone, we're talking of silly farting apps.

37 Posted by Jeff Barbose on 6 December 2009 | Permalink

Funny how PPK spent several posts making Cocoa Touch look like a nail.

Ultimately, the user is the always the primary priority, not the developer, so "write once, run everywhere" goes out the window in favor of "best user experience".

Look at the available options and if native dev wins--and it does--then native it is.

38 Posted by Roland van Ipenburg on 6 December 2009 | Permalink

ROI is the primary priority, not some iPhone users who think they are the only ones entitled to be provided with native apps.

39 Posted by Doug Rowe on 8 December 2009 | Permalink

Like life its a tradeoff! ( gasp)

Why are you developing an APP? Who is paying for it, or what are you hoping to gain from it?

If the customer then it's his ( possibly informed ) decision. Quicker running on one platform or quicker to run on (many most more ) platforms.

What he wants to accomplish should push him one way or the other.

40 Posted by Grover Saunders on 9 December 2009 | Permalink

"What do your users want you to pick, superior user experience or vastly bigger reach?" ... "and is there a way to get paid? Those are the questions that matter right now."

Ummm...don't the answers to both of these questions point to native iPhone apps, at least for iPhone users? I'm confused.