Theocacao
Leopard
Design Element
Comment on "CocoaHeads: Objective-C 2.0"
by Ulai — Sep 15
Hello again Russell and Scott. Thanks for your answers.

Yes, I did realize just after having posted the thought that I had written the C++ style method instead of the Objective-C one. I happen to know a thing or two in Objective-C. However, changing the style of methods to the Objective-C ones does not change my arguments one bit.

Russell talks about [z plus: w] being more readable than .Add(z,w). Sure I agree with that. But this is one example. And probably among the simplest you could find. What about the example of z+w+v ? This would translate into [[z plus: w] plus: v]. Or some string formatting stuff. Simply just not as good as z+w+v. The thing will get worse as we move to real-world applications of the scientists.

What is it about this belief that overloading operators will make code less readable? To me it is like saying that every word in the English dictionary should mean one and only one thing. That of is of course not so and what they mean depend on the context. When you read code that says z+w you will have read the surrounding code, and in your study of the code you will long have known that z and w are complex numbers.

Don't get me wrong though. I happen to like Cocoa and Objective-C a lot. However, I do for sure miss overloading operators. I happen to use C# daily at work and overloading has not caused me any confusion at all. It has just served to make my life easier. After all, the meaning of '+' is just determined by the context, which will be obvious when the code in question has been looked at.
Back to "CocoaHeads: Objective-C 2.0"
Design Element

Copyright © Scott Stevenson 2004-2015