I now have a love/hate relationship with Objective-C. I'm playing with Cocoa, and therefore I've been playing with Objective-C. Background: I've wanted to play with NextStep and Objective-C since they came out. When OO extensions to C started to come up (C++, Objective-C), I'd hoped that Objective-C would dominate, mostly because I came to OO via Smalltalk, and I wanted the syntax. (I'm weird.) C and C++, however, paid the bills. I never had the opportunity to program a NeXT. Playing with Cocoa is the fulfillment of a wish I once had. The problem is that I love being able to declare my variables anywhere, as you can in just about every scripting language, C++, and Java. I love it becuase it allows you to group variables with the code that chiefly concerns them. It's a nice way of structuring your code. I can't do that in Objective-C, because it is based on C, for head-shakingly obvious reasons. All variable declarations have to be made at the top. Arguments can be made that variable declarations must always be made at the top. Many of them are compelling. I am even convinced by others. But I still like to declare them as I go. I like to limit the information necessary to understand the code.
Oh. The argument that is convincing? 'If you have a hard time keeping all the local variables straight, your method is too long.' It's a Code Smell. |
Damn. The Mariners lost. But it was close and exciting, right up to the last pitch. Other than winning, what more can you ask for? 5:56:47 PM comments () trackback [] |