top | item 6239467

Ask HN: Why torture yourself with Objective-C?

13 points| rfnslyr | 12 years ago | reply

A bit confused here. I've deployed multiple iPhone applications with 0 native functionality only using HTML/CSS/Javascript. I've deployed to over 10 phones and everything works perfectly.

What is the point of using OBJ-C? It seems much harder to learn and use efficiently. I have a few friends who refuse to use anything but obj-c for their apps and as a result, it's taking them forever to deploy with much more headaches. Meanwhile, I'm deploying to multiple platforms with everything working flawlessly, even accessing native phone features.

Genuinely curious, not favoring one over the other as I've never ever laid hands on objc, though I tried once, I gave up.

12 comments

order
[+] biafra|12 years ago|reply
Not everybody thinks Objective-C is torture. Some people might even say that HTML/CSS/Javascript is more torturous. And I am sure that there are people who are more productive in Objective-C than you are in HTML/CSS/Javascript on the iOS platform. Especially when they are implmenting features that are impossible to implement without using Objective-C.
[+] sahrizv|12 years ago|reply
The most compelling reason to use Objective-C for iOS development is to make use of the vast array of device-native APIs provided by Apple, most of which are not available to webapps as of now. While you can use PhoneGap/Cordova to wrap your webapp in a native container, and access many native APIs, the process is convulated to say the least. Besides, with Apple releasing new API's(1500 new APIs for iOS 7 [1]) with every upgrade, the likes of PhoneGap cant really keep up with natively available functionality. Performance is another big reason which comes to my mind.

[1] http://www.macrumors.com/2013/06/12/upcoming-ios-7-apis-gami...

[+] mertdumenci|12 years ago|reply
I personally don't think that HTML and CSS are a good fit for building complicated, highly performant mobile layouts in the first place.

Additionally, despite my love for JavaScript, JavaScript is not as fast as native code on mobile phones. You can really feel the difference between a fully native app and a web based app on iOS. (well, unless you can build something as good as Fastbook[1])

But there are definitely things that you can do with two lines of HTML & CSS (like advanced text layouts) that require much, much more code in Objective-C.

Someday it will become a personal choice and hopefully won't differ at all to the user, but I don't think we're there just yet.

[1] How on earth is this this good? http://fb.html5isready.com/

[+] pandaexpress|12 years ago|reply
Because I don't see it as torture. I find Objective-C to be a perfectly pleasant tool, and it allows me to do things that would be A) implausible or B) impossible were I to make webapps (or PhoneGap apps) instead.
[+] joeblau|12 years ago|reply
Sometimes you can't do what you need to do in HTML/CSS/JavaScript. I was trying to make an application that could read straight off of a TCP socket to stream images from Twitter, Facebook, Instagram, and Google+ into a mobile app in real-time. With the amount of data I was pushing though, the JavaScript couldn't keep up and was crashing so I had to go native. I think a lot of light-weight apps can be written in JavaScript, but sometimes it's just not possible.
[+] pbreit|12 years ago|reply
I have never seen a non-native app that works as well as a native one does or would.

It's a simple trade-off: easier development vs better user experience.

[+] coryl|12 years ago|reply
Performance reasons, native API / framework availability.

A native developer can achieve anything the JS dev can, but vice versa does not apply.

OOP is a pain to learn, but once you learn it, you have access to all OOP languages. I like Obj-C, and Apple's API are great.

[+] jozefg28|12 years ago|reply
> Though I tried it once, I gave up

Perhaps experience is the deciding factor. I thought the same thing about Common Lisp and Haskell until I took the [long] time to learn them. A steep learning curve doesn't mean the tool sucks.

[+] mayoff|12 years ago|reply
Because Web technology just doesn't have the performance to do what I want to do.

Because every time I use a language that lacks Smalltalk-style keyword messages, I find myself missing them.

[+] wittedhaddock|12 years ago|reply
I really appreciate this question. Thank you for asking the seemingly obvious - yet, not at all.
[+] xauronx|12 years ago|reply
It's actually kind of obvious. If there weren't benefits, people wouldn't use it, and there are some pretty obvious benefits. Why use a directly compiled language instead of a scripting language put through two(?) layers of translation? Why use a language that let's you directly access all features of the platform? etc

Honestly, there are few apps that provide anywhere near the user experience that a native app does (one of those being facebook) and even they opted to switch to native. I've written a graphics intensive phonegap app and... needless to say, that was enough incentive to learn objective-c and I'll never look back. Objective-c is actually an awesome language, it's just tough to learn for most developers coming from a standard dot notation language.