Skip to Content.
Sympa Menu

patterns-discussion - Re: [patterns-discussion] Design pattern recommendation

patterns-discussion AT lists.cs.illinois.edu

Subject: General talk about software patterns

List archive

Re: [patterns-discussion] Design pattern recommendation


Chronological Thread 
  • From: Fernando Cuenca <fernando_cuenca AT yahoo.com.ar>
  • To: patterns-discussion AT cs.uiuc.edu
  • Subject: Re: [patterns-discussion] Design pattern recommendation
  • Date: Wed, 14 Nov 2007 18:07:25 -0800 (PST)
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>


Hi,


----- Original Message ----

> From:
> "win_ash12 AT yahoo.com"
>
> <win_ash12 AT yahoo.com>

>
> If I had a class that has a lot of boolean flags and I have an IF
> condition that requires me
> to do a lot of AND/OR among these boolean conditions is there a design
> pattern that will help
> me to refactor this code ?

It will depend on what your code looks like and what you're trying to
accomplish. You might want to check Joshua Kerievsky's "Refactoring to
Patterns" book, which includes some refactorings specifically designed
to deal with Conditional Complexity:

- Replace Conditional Logic with Strategy
- Move Embellishment to Decorator
- Replace State-Altering Conditionals with State
- Introduce Null Object.

Hope this helps.

Saludos!
Fernando.







____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now.
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ




Archive powered by MHonArc 2.6.16.

Top of Page