Monday, August 10, 2009

My Last Word on Dot Notation

The dot notation discussion has taken far more of my time lately than it was wise for me to spend. I've said pretty much all that I need to say on the topic at this point. I don't care if you use it, just don't tell me I'm wrong for doing so.

Just for the record, I was horribly opposed to Objective-C's dot notation when it first came on the scene. i had programmed in both C++ and Java over the years, but I much preferred Objective-C, and I saw dot notation as being a step backwards and a really bad idea for a number of reasons.

For the book, Dave and I decided we were going to follow Apple's lead when it came to coding style and coding conventions, so I bit the bullet and started using properties for the book exercises. Now that I've used them regularly for about a year and a half, I have completely changed my opinion, and I'm pretty sure a lot of my original issues with dot notation were just rationalizations of my own resistance to change.

Arguing theory has only so much merit. In practice, with a little thought and understanding, properties and dot notation work well and can be used to make code considerably more readable and faster to write. If you haven't spent some real quality time using them - if you are arguing only from language theory - then you need to spend some time with them before you condemn them further.



3 comments:

schwa said...

While I applaud you for trying, ultimately I think you're wasting your breath.

The dot notation debate has become a religious war and we (as a community) shouldn't expect anything useful to come from the discussion. This is why I'm having (and have had for a while) great fun provoking dot notation "debates" on twitter (yes, I'm a troll).

People have picked sides already, many of those on the anti-dot-notation camp seem to have done so without even bothering to even try it out (see http://twitter.com/danielpunkass/status/3202942882 for example).

I'm not trying to convince anyone to use (or not use) dot notation, I'm just going to do what is best for me and laugh at (and maybe provoke a little) the religious war.

Michael said...

Personally I find it disturbing that people feel that if someone is not doing if their way, then "they" are wrong.

I use whatever makes sense to me. In reality I use a mix of both approaches as I've learnt Objective from trawling over Apple examples and I guess that is the important point - I can use and recognise both.

So Jeff, well done for writing on the issue. I for one appreciate hearing a balanced view.

M.
M

Niklas said...

Buy the end of the day, Apple's SDKs are the one that use Objective-c 2. Would be stupid not to learn and like dot notation, as we'll all be stuck with it regardless. Besides, it is useful.