Re: Avoiding Booleans & Danny Thorpe
- From: "Jim Rowell" <x@xxxxx>
- Date: Sun, 30 Oct 2005 17:27:58 -0500
"John Jacobson" <jake@j[nospam]snewsreader.com> wrote in message
news:43650c36$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> There is a sense in which you are correct, I think. Consider this code:
> var LNeedsFixing: boolean;
> procedure SomeProc;
> begin
> ReformatParagraph(LNeedsFixing);
> end;
> That looks pretty clear to me, yet it uses a Boolean parameter. Yet...what
> about if the two choices are 1) Needs fixing
> 2) Needs formatting
In this particular case, since the name of the method indicates formatting
is the intent then I'd say that will occur no matter what. All that's left
is to decide whether to "fix" or not as well. A boolean will do. The
parameter could be named "FixInstead" I suppose if you want it to preempt
the normal purpose. <g>
All in all, I agree with you that there are no hard and fast rules here.
Depends on the case. I obviously over-reacted to the original author's
opinion against booleans.
> language constructs do. I think it is an over-simplification to resort to
a
> hard and fast rule that you ought to NEVER use one or the other. Best to
use
> one's brain and figure out the best way to carry on.
Agreed.
--
Jim Rowell
.
- References:
- Avoiding Booleans & Danny Thorpe
- From: Kyle A. Miller
- Avoiding Booleans & Danny Thorpe
- Prev by Date: Re: Avoiding Booleans & Danny Thorpe
- Next by Date: Re: Version Control Sofwtare
- Previous by thread: Re: Avoiding Booleans & Danny Thorpe
- Next by thread: BDN_Delphi.xml News feed no longer works???
- Index(es):