Re: Refactoring into ravioli code
- From: topmind <topmind@xxxxxxxxxxxxxxxx>
- Date: Sun, 27 Jan 2008 13:31:59 -0800 (PST)
Personally, I'd prefer to use the RDBMS if possible to avoid
transferring globs of data to the app side, but if I have to loop in
code, KISS would dictate something like this:
while (str = getnext()) {
found = false;
if (matchType=="startsWith") found=str.startsWith(compr);
if (matchType=="endsWith") found=str.endsWith(compr);
if (matchType=="contains") found=str.contains(compr);
etc...
if (found) {
// process match
}
}
(There's some minor efficiency adjustments not shown here.)
Why are you guys making all these complicated OO contraptions? Maybe
if and when we use this code over again for slightly different
purposes, then different approaches can be looked at. But such has not
been identified. You're gold-plating a shack.
-T-
.
- References:
- Refactoring into ravioli code
- From: chris_a_brooks
- Refactoring into ravioli code
- Prev by Date: Re: Refactoring into ravioli code
- Next by Date: Re: sale.submit() or submitter.submit(sale)
- Previous by thread: Re: Refactoring into ravioli code
- Next by thread: china wholesale nike jordan sneakers WWW.21cn-shoes.COM discount gucci prada puma
- Index(es):
Relevant Pages
|