Re: NSArray.iterator and NSArray.listIterator bug
Re: NSArray.iterator and NSArray.listIterator bug
- Subject: Re: NSArray.iterator and NSArray.listIterator bug
- From: Ian Joyner <email@hidden>
- Date: Wed, 21 Jun 2006 13:36:48 +1000
On 20/06/2006, at 6:04 PM, Lachlan Deck wrote:
Hi there,
On 15/06/2006, at 8:22 PM, John Larson wrote:
objectEnumerator does work. I didn't even think that that would
be a different implementation except for Iterator's remove()
method. Oh well, just trying to obey Sun's advice about their
Collections framework and not have to call
methodWithAsLongANameAsPossible(). :-)
Late response but - I've never seen this advice. But, assuming the
advice exists (or is it folklore?) then it'd be nice if Sun would
remove all the 'get' prefixes from there class' methods. They
certainly add clutter (I mean length) to the name of the method.
'get' is superfluous anyway. I think the advice might come (although
I'm not sure of your context here) from the "Principle of Uniform
Access" which says that getting a value from an object should be the
same whether it is retrieving a value from a memory location
(variable) or computing the value (function). Thus all access should
be functional and should not distinguish. C-based languages break the
principle, so it is up to the programmer to do it by having to put in
all those little 'get' functions, adding to clutter (even more having
all those empty parentheses () all over the place).
Of course, in Java, you don't need the get because you can name both
variable and access function 'val' and 'val ()' (rather than 'getVal
()' or 'get_val ()'), but the name still breaks the principle because
it is distinguished by the '()' characters. Distinguishing between
variable access and functions is thus low-level programming. It is
also inflexible – you have to rigorously apply using get functions or
if you change from a variable to a function or vice-versa, you then
have to either put in all the () call operators or take them out of
calling code!
As for entity names such as methodWithAsLongANameAsPossible, perhaps
it is a shame that compilers allow really long names now, instead of
forcing programmers to be less verbose. And the style of separating
the individual words with the first character being upper case is
both ugly and lacks readabililty.
NSArray is immutable anyway - so the opportunity for remove() won't
help unless it's a listIterator for a NSMutableArray.
with regards,
--
Lachlan Deck
_______________________________________________
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