Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #5913
| From | Victor Porton <porton@narod.ru> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Two classes vs two methods in one class? |
| Date | 2015-10-03 18:19 +0300 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <muorn0$loh$1@speranza.aioe.org> (permalink) |
I need an iterator which returns "processed" data (a function applied to the
unprocessed data received from a DB) and an iterator which return both
processed an unprocessed data (as a structure having ->processed and -
>unprocessed fields).
Should I make two classes of iterators (probably with a common ancestor) or
one class of iterators but two methods, one returning processed data and one
returning both processed and unprocessed?
The first scenario:
$iter1 = FirstIteratorClass;
while($iter1->fetch) { # returns processed data only
...
}
$iter2 = SecondIteratorClass;
while($iter2->fetch) { # returns both processed and unprocessed data
...
}
The second scenario:
$iter1 = IteratorClass;
while($iter1->fetch) { # returns processed data only
...
}
$iter2 = IteratorClass;
while($iter2->fetch_all_data) { # returns both processed and unprocessed
data
...
}
--
Victor Porton - http://portonvictor.org
Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread
Two classes vs two methods in one class? Victor Porton <porton@narod.ru> - 2015-10-03 18:19 +0300 Re: Two classes vs two methods in one class? Marco Bakera <pintman@bakera.de> - 2015-10-03 21:06 +0200
csiph-web