Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31724

Re: Main Loop porblm

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Main Loop porblm
Date Mon, 18 May 2015 11:15:18 -0400
Organization A noiseless patient Spider
Lines 36
Message-ID <mjcvk3$4gl$1@dont-email.me> (permalink)
References <c666ab49-a6d4-4ad0-b4a5-4ab7da6d5c97@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 18 May 2015 15:14:12 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="4629"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qgkIpUIjlYMwK1nj50kkS"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <c666ab49-a6d4-4ad0-b4a5-4ab7da6d5c97@googlegroups.com>
Cancel-Lock sha1:yV3/6k/rKBaEphwACSeeBgXENQU=
Xref csiph.com comp.lang.java.programmer:31724

Show key headers only | View raw


On 5/18/2015 9:50 AM, Michael wrote:
> Simple window application with JSlider. [...]

     From the follow-up, it seems you have solved your problem.
However, there's still a small matter of style:

> 	    	if(show == true)

Do you see anything odd about this test?  The comparison is
between a boolean variable (whose value is `true' or `false')
and the boolean constant `true', and the result of comparing
is either `true' or `false'.  In fact, the result of the
comparison is whatever value `show' itself has: The comparison
has made no "progress."  You began with a value that is either
`true' or `false', and you arrive at an expression whose value
is either `true' or `false'.  If you want to check the value of
the expression, shouldn't you write

	if ((show == true) == true)

?  Well, no: You're still stuck with a `true' or `false' result,
and you still need to test it.  So, maybe

	if (((show == true) == true) == true)

would be an improvement?  Um, no, and it's beginning to look like
adding more and more `== true' comparisons might not be the right
way to go.  Hmmm: What to do?

	if (show)

... might be an attractive option, don't you think?

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Main Loop porblm Michael <progressman757@gmail.com> - 2015-05-18 06:50 -0700
  Re: Main Loop porblm Michael <progressman757@gmail.com> - 2015-05-18 07:05 -0700
  Re: Main Loop porblm Silvio <silvio@internet.com> - 2015-05-18 17:01 +0200
  Re: Main Loop porblm Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-05-18 11:15 -0400

csiph-web