Wednesday, October 28, 2009

DevDays

If you want to see some interesting chatter, take a look at the Dev Days backchannel on Twitter. It's very amusing. There's lots of ignorant hyperbole, including claims that Apple is the most evil thing on the planet because they chose to use Objective-C along with the typical complaints that it's not what they're used to, so it's bad, or ugly.

There's also a fair amount of positive chatter as well. It's interesting to see just how different people's opinions can be.

Most of the negative comments are just people expressing their honest (though sometimes ignorant or ill-informed) opinions, but some are just downright snarky as well as being ignorant.

I know most of my readers know this, but Objective-C has a garbage collector. A really, really good garbage collector. Apple chose not to use it for the iPhone SDK (yet) because the iPhone is an embedded device with processor and memory constraints. It was felt that the benefit to the programmer of not having to do some basic memory management was simply not worth the overhead cost. Unlike languages like Java or C#, we have the flexibility to do memory management manually when there's a performance reason to do so.

There's a reason why GC didn't become popular earlier than it did. On slower, single-core machines (especially ones with limited memory or without virtual memory), the overhead of GC is non-trivial. Discarding a technique because it's no longer popular is idiotic. Discarding it because it's no longer valuable makes sense, but understanding memory management always has value, and in this case, using it very much has value.



8 comments:

pippin said...

Laving GC out of iPhone was probably one of the smartest decisions made by Apple.
After playing around a bit with Android I can't state how much I like being able to control memory management myself and how much better it performs.
GC is fine if you have excess performance but in any limited environment it's among the top hogs.

Now I prepare my next comment on how good an idea it was to not have background processes (as much as I would like to use them)...

Jeff LaMarche said...

pippin:

Yeah, as much as I'd like to be able leverage background tasks, I've come to realize that it was a smart move to disallow them with present hardware.

Mostly Torn said...

Coincidentally, earlier today I commented on Twitter about how now that I've been using Objective-C for over a year C++ now feels awkward in comparison. And I had been using C++ for about 15 years.

At first I didn't "get" the power of Objective-C, but now I definitely prefer it over C++.

I don't know why people make such a big deal about the lack of GC on the iPhone. It's common practice to lack GC on embedded devices. Heck, some embedded systems I've used in the recent past even lacked dynamic memory allocation!

Jonathan Nobels said...

Wahhh!! I actually need to manage my own memory!!

Wahhh!! I need to learn a bit of new syntax and some new APIs!!

Wahhh!! I can ignore objective C and develop in pure C or C++ if I like!!!

Wahhh!! I miss the GC running at the most inconvenient time making the device seem unresponsive!!

Wahh!! I have access to several million *paying* customers!!

...CRY ME A RIVER...

Philippe said...

No GB seems logical to me... And I think that reference counting feature makes Objective-C a perfect language for new programmer since they really can monitor what's going on in their programs...

warmi said...

Well Philippe ... I am not a fan of Objective C and If I were to highlight some unique features , reference counting would be the last.

It is really a primitive and relatively error prone approach... a typical smart pointer implementation on C++ is much safer and maintenance free while offering the same benefits in terms of performance.

Philippe said...

@warmi
Of course, but the reference counting feature can get a student(i'm teacher) to be aware (trough the use of the retaincount) of what is really going on in his program. And the knowledge that he gets doing that is applicable in... every language where there's no GB

JMFR said...

Clang/LLVM makes memory management a breeze for a newb like me. Select it in your build setting Command+Shift+A shows all your memory leaks. Simple.