Theocacao
Leopard
Design Element
Comment on "The Year in Mac Development"
by Matt Tavares — Jan 01
Why do so many people LIKE OBJECTIVE-C PROPERTIES.

Properties are the most useless and confusing addition to objective-c that you could think of. What do they add to the language? Are they iVars? uhh, kinda. Do they flow when other objects don't use properties? NO. Do they confuse your average C person becuase everyone knows "." means a non-allocated property and -> means an allocated property. YES!

Lets go into a bit of detail:

Right now, you can create properties in objective-c 1.0 code, just by adding the handy @public keyword in your iVar prototype:

@interface MyGreatObjectThatDoesntUseProperties : NSObject { @public NSMutableDictionary *dict; } @end

And hey, guess what, this will actually work:

obj->dict;

No confusing "." syntax, no having to check whether it is a struct or an objective-c object.

And look at it this way, lets say you have a class that stems properties which stem public ivars, well then you have a mess on your hand.

value = object.this->that.something->somethingElse

Confusing isn't it, now you dont know which object is a struct or an actual object. Thanks Apple!

The whole reason objective-c is great is becuase it keeps everything so simple, its just a small but incredibly usefull layer above c. Now its trying to be its own thing, which isn't what objective-c is. If anything, Apple should at least take a page from ruby and implement lexical-scopes or blocks or something that is atleast usefull.
Back to "The Year in Mac Development"
Design Element

Copyright © Scott Stevenson 2004-2015