During my usual news surfing today, I cam across an article that basically questioned Apple's wisdom in choosing Objective-C for the language to use for it's iPhone SDK
"Did Apple Make A Mistake Choosing Objective-C
For iPhone SDK?" at Simon’s Blog:
DID APPLE MAKE A MISTAKE CHOOSING OBJECTIVE-C
FOR IPHONE SDK?
...
Recently, Apple bowed to the inevitable, and has released an SDK for developer testing. The language they chose to base the SDK around is Objective-C. This wasn’t a complete surprise - after all, it’s the ‘native’ language of Mac OS X. However, while it’s not a surprise, I wonder if it’s not a major strategic error on Apple’s part. The point is this: the Mac is a niche platform, and is especially niche in terms of numbers of developers building applications in Objective-C.
...
Normally I don't even bother to read such articles. This one, for some reason, caught my attention and I just had to wonder why Simon even wondered this.
Apple has had some serious success with it's OS X operating system. So much so, that when it developed it's mobile phone, the iPhone, it choose to use a stripped down version of OS X to drive it. As we have seen, this was a very good decision. The iPhone's user interface is now a standard that other mobile phone manufacturers are striving to emulate. Something that seems to happen a lot in the consumer electronics sector with products that Apple also has in that sector. The iPod and Macintosh come to mind here.
So now that they have OS X as a kernel for the iPhone, what language should they use for developing software for it? What else but the language that is used for OS X on their computers? Objective-C.
Since they choose Objective-C for the SDK a lot of library code used in OS X was able to be ported to the iPhone SDK so that Apple's developers could write applications for the iPhone very quickly. In fact, they use Xcode, Apple's free development environment, to develop applications for the iPhone. No need to create a new development environment, no need to create a new set of API calls. Everything was sitting around ready to be reused for the iPhone. Object Orientated programming at it's best.
Simon's point was that Objective-C isn't a very popular language compared to others being used for development. Now, he got his data from Tiobe Software, a company specializing in assessing and tracking the quality of software. Apparently, they index software development languages every month to see how they fair in the world of software development.
Based on this index for April 2008, Objective-C is 38. One behind BASH, a command-line shell scripting language.
Now, one thing that I have to wonder about this index is, who are they polling to get their data? Well, from what I can get from the site, it looks like they query search engines like Google, MSN, and Yahoo! as well as others and apply the results of the searches through normalization formulas to get the results they publish.
So, they are basing their index on how much people talk about a language. I wonder if they include posts about how bad a language is and the multitude of questions people as on the web for help with those languages.
He goes on to say that he doesn't feel that Objective-C is a bad language, he just feels that it's not popular. I have to wonder if he would feel better if Apple used (heaven forbid...) Java.
I have been spending time recently attempting to learn how to program the Macintosh, and possibly even the iPhone. I feel pretty comfortable with Objective-C at this point. There are still a few parts I need to understand before I start tackling the Mac and it's API What I have learned about Objective-C makes me really appreciate the language choice over many other languages they could have chosen. Let me give an example...
With Java, how many times have you gone to a web page that hosts a Java Applet and found it doesn't run due to an exception of some kind? It's not your fault, but it just died. Now, imagine you are on your iPhone and see a dialog pop-up that tells you that the program you are running threw a NULLPOINTER exception. How annoyed would you be?
With Objective-C, null pointer exceptions can't happen. Null pointers can be passed around, but the language pretty much just ignores them and moves on. No exception dialog, it just moves on. Now, this can be a bad thing if that null pointer was needed to perform a critical task. We all know that iPhone apps "crash". I have had Safari crash several times on me. The difference here is that the user doesn't know why it crashes, it just went away, and a simple touch of the icon will bring it back quite quickly.
Another very annoying issue with Java is it's garbage collection. Objective-C 2.0 can do garbage collection, but Apple has decided to disable the ability to use it with the iPhone. A very wise decision. The absolutely most annoying thing about Java is having to wait for the JVM to get around to cleaning up memory. Now this means that the iPhone could have a program that leaks memory in such a way that it uses up all the memory available for program execution. One the other hand, programs on the iPhone run very fast, way faster than any other mobile phone I have seen.
So, did Apple make a mistake choosing Objective-C to develop iPhone applications with? I have to say no, and I think Simon will see that I'm not the only one that feels that way when June comes and the iPhone Application store opens to show hundreds if not thousands of applications ready to download to iPhones.


Twitter
Jaiku


