1 Aug 2003 03:05
Re: What's a another name for...?
Kiel Hodges <kielhodges <at> mindspring.com>
2003-08-01 01:05:45 GMT
2003-08-01 01:05:45 GMT
--- In extremeprogramming <at> yahoogroups.com, Ron Jeffries
<ronjeffries <at> X...> wrote:
> On Thursday, July 31, 2003, at 9:00:48 AM, Ron Jeffries wrote:
>
> > In the second case, I use a language that permits me a better
deal, as does
> > Ilja. However, if I had to use iterators, I would behave as
if they were
> > mostly irrelevant, and would give them trivial names, still
giving the
> > other objects application or usage-explaining names, perhaps
like this:
>
> > Collection transactionsOverLimit;
> > Iterator iter = transactionsOverLimit.iterator();
> > while (iter.hasNext()) {
> > Transaction overLimitTrans = (Transaction) iter.next();
> > overLimitTrans.processLimitAction();
> > }
>
I have this pattern. The whole Iterator thing is noise. Using the
same trivial name -- iter is a common choice -- makes it just a
bit easier to ignore allowing you to focus on what's important.
> One addendum. If the same method had more than one iteration,
especially
> nested, then I might give the iterators more meaningful names,
such as
> accountIter and overLimitIter.
(Continue reading)
RSS Feed