Apr 25

contentfooter_sdk20080306.pngDuring 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.

index_promofooter_sdk.pngSo 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.

written by Dave M. \\ tags: , , ,

Mar 14

Gruber has a post up on his site Daring Fireball about the new iPhone SDK and Apple's decision to not allow iPhone apps to run in the background...

Daring Fireball: The Flip Side of the Multitasking Argument:
"As I wrote this morning, I don’t think the ‘no background’ policy implies any spite or shortsightedness on Apple’s part. It’s simply the result of Apple’s decision to focus first and foremost on maximizing battery life and performance. Other mobile platforms, such as Android, may well have different priorities."

Now, I found out the hard way today that iPhone apps running in the background can kill the battery in a hurry. Apparently, an Apple application was running in the background for over 7 hours. I didn't know this and when I went to turn on my iPhone, I got nothing. I tried several ways to activate my phone only to get nothing.

I finally held the power button down for a few seconds and found out that my battery was down to a very small percentage left. Definitely in the red.

Fortunately I was at home and could plug the phone in to charge it back up. If I had been out, I would have been screwed.

Update: I feel I should point out here that up until this incident, I have not had any problems with my charge. I usually run about 1 day before needing to recharge. Usually that is about 2 hours of usage and 18 hours of standby time. This was the first time in the almost 9 months I have had the phone that the charge of my phone had all but drained out in less than a day.

Back to the original post:
Now, I can appreciate Apple's reluctance to allow apps to run in the background. However, I think they need to take a note out of their own rule book and fix their own apps so that they don't run in the background draining the battery of the phone.

You see, I don't know what I had done to cause the battery to be drained so quickly, but looking at my usage time, I saw that it had been running for over 7 hours. Now I know I hadn't been running my phone for over 7 hours. It was fully charged at 7am, and when I went to use it at 4pm, it was all but dead. I would have been using the thing pretty much all day.

So, Apple, fix your own apps please. I really can't have my phone die on me if I'm on the road. It's the biggest reason I have a cell phone in the first place. For emergencies!

Update 2: One of the author's of Twitterific: Craig Hockenberry, has more insights into why multitasking on the iPhone is a really bad idea.

(Via Daring Fireball .)

written by Dave M. \\ tags: , , , , , , , , , , , , , , , , , , ,

Aug 23

Launchd: One Program to Rule them All
Apple's Dave Zarzycki talks to Google about Launchd.

This is a pretty technical talk about how Apple's launchd works and how to use it as a developer. Most folks won't really care about this, but it's actually quite interesting and shows a lot about how OS X works.

written by Dave M. \\ tags: , , ,