Re: Refactoring into ravioli code



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-

.



Relevant Pages

  • Re: Batch file and MFC (Properly Terminating Application)
    ... running any secondary modal loop. ... don't write an OnCancel handler, ... the changes the user thought had been made--because the app closed without ... user clicks on Cancel button and application exits. ...
    (microsoft.public.vc.mfc)
  • Re: Virus alert on my app??
    ... waste of battery energy if your app is merely polling something in a loop ... processor after it has offered it up until at least one time slot period has ... DoEvents does actually call Sleepbut either of them in a closed loop ...
    (microsoft.public.vb.general.discussion)
  • Re: Console app freezes
    ... This behavior seem to be a result if excessive CPU load. ... Do you know what your app will do in case more data is coming from serial ... Could it wait for available buffer in a loop without sleepin it? ... However, after waiting a while, I ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Console app freezes
    ... It's not a while loop which checks for some ... You'll need to firure out what to do in case buffer overflows (terminate, ... > My app uses OpenNETCF.org’s serial comms code with a few modifications ... I couldn’t use a parity error event to ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: How to set up a global variable in a sub-routine?
    ... the 'global variables' are more like constants ... ... single script, I need a way to tell it only once where the file is and ... So, if you construct a loop with a loop variable, you ... >programmers avoid global variables completely. ...
    (perl.beginners)