Re: WOPopUpButton
Re: WOPopUpButton
- Subject: Re: WOPopUpButton
- From: Ian Joyner <email@hidden>
- Date: Mon, 25 Jun 2007 10:23:11 +1000
On 23/06/2007, at 12:36 AM, Robert Walker wrote:
Interesting (somewhat off-topic) discussion. I just wanted to
inject that I've recently been writing some Ruby code, which uses
the underscore convention for identifiers. At first it felt really
strange using the underscore identifier style. However, I very
quickly came to prefer it. It actually does make a difference in
readability and flow.
Another example is Unix itself, which looks much neater than the
bumpiness of CameLcase (maybe later bits they are using CC). I
remember when the Burroughs ALGOL compiler put in underscores,
everything became much more readable. Much cheering all round.
I agree that consistency is king. This is especially true when
trying to adhere to pragmatic principles that make heavy use of
code generators (like EOGenerator and similar tools).
I too am torn between consistency and a better more readable
consistency. I'll use CC on other people's stuff, but on my own I can
make non-CC look consistent. However, I do tend to use more laconic
(yet expressive) identifiers (vowel and spelling preserving as well).
One side note on the getValue() vs. value() accessor convention in
WO. Some may recall that this convention is a holdover from it's
Objective-C history. Accessing a getter in Objective-C looks
something like:
NSString *myName = [object name];
not
NSString *myName = [object getName];
I agree. This is just the Principle of Uniform Access:
http://en.wikipedia.org/wiki/Uniform_access_principle
(which I don't think is a very good write-up, and I don't think
Bertrand invented it, just coined the term.) Properties in Objective-
C have put this back in to some extent (which I believe is one of
Bertrand's innovations), so you don't need to write get or set
methods, and can get rid of '()' calls, which are just visual
clutter. By PoUA you should just be able to do:
my_name := object.name
and not know whether name is a direct data access or a computation.
my_name := object.name ()
tells you it is a computation that at least does an indirect data
access, but then you have to write all those accessors (whether named
with a 'get_' or not). Of course Objective-C properties get rid of
having to write explicit gets and sets, but then it is something you
have to explain and rationalize, rather than something which is
naturally in other languages. (Actually I hope Obj-C isn't bothering
to generate get methods, just grabbing the value directly for
optimization, since PoUA is now preserved.)
This later statement would have a completely different meaning in
Objective-C convention. This would mean that object is getting the
name attribute by some form of indirect access to the value. Maybe
through delegation or some other technique. In other words
"object" would have no "name" instance variable, so getName is not
really an accessor method.
Ian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden