Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #11538
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Lew <noone@lewscanon.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Blocks for scope control |
| Date | Fri, 20 Jan 2012 15:24:52 -0800 |
| Organization | albasani.net |
| Lines | 33 |
| Message-ID | <jfct42$tl3$1@news.albasani.net> (permalink) |
| References | <dBCQq.122$d%2.16@newsfe07.iad> <jev7op$j4k$1@news.albasani.net> <IRHQq.2650$2C.1194@newsfe20.iad> <jevoes$qru$1@news.albasani.net> <2P3Sq.1782$lS6.832@newsfe20.iad> <9nsk4fFganU1@mid.individual.net> <invariant-20120120210428@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.albasani.net FK3l6XBoJQxQ2TnETB7eC9ZVjhEvSJKbSSHUc3p1kNFJbLZQXPHJlWcaC2+uWD8P52J72uE3mjyuGyMIT5DkPgtPwBBbTWQuM6CJ//H/evQURloIEtuEJoK/CR6yDaOS |
| NNTP-Posting-Date | Fri, 20 Jan 2012 23:24:50 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="QQ6HeTBiYqTGk1eyMZsrz8rWYmDwZE8P/Tt8ef/gVcYtlkYWO4csnZpq+/4/atDaueEzhG89JuUpWaNcBi+FKXmebLDs5eVjQ1nPp2+3Qvo0PVcLiLgTiLuegR9hDFua"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 |
| In-Reply-To | <invariant-20120120210428@ram.dialup.fu-berlin.de> |
| Cancel-Lock | sha1:f/BCj2NsXNJbcBdTnnSDt7UpySQ= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11538 |
Show key headers only | View raw
On 01/20/2012 12:07 PM, Stefan Ram wrote:
> Robert Klemme<shortcutter@googlemail.com> writes:
>> commenting is needed. I frequently have a private boolean method
>> "classInvariant" or with other (hopefully telling) name with checks and
>
> private static boolean classInvariant(){ ... }
> private boolean objectInvariant(){ ... }
>
> However, since it's boolean, I prefer »is«- or »has«-names:
>
> boolean isValid(){ ... }
>
> . One can compare the readability of:
>
> if( this.classInvariant() )...
>
> and
>
> if( this.isValid() )...
>
> .
There is rarely, if ever, a good reason to qualify a method name with 'this.'
It does not affect the semantics of the statement, and as documentation is
misleading.
The canonical mechanism to prove invariants is the 'assert' statement. It is
a compiler- and runtime-enforced program comment.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-15 11:50 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-15 17:10 +0100
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-15 17:32 +0100
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 11:21 -0800
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-16 07:59 +0100
Re: Blocks for scope control markspace <-@.> - 2012-01-15 09:57 -0800
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 11:28 -0800
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 11:00 -0800
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-15 17:49 -0400
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 15:45 -0800
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-19 21:54 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-20 08:41 +0100
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-20 15:24 -0800
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-20 19:30 -0400
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-20 15:54 -0800
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-16 07:55 +0100
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-19 21:16 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-21 13:25 +0100
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-21 10:41 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-22 13:03 +0100
Re: Blocks for scope control Roedy Green <see_website@mindprod.com.invalid> - 2012-01-16 06:09 -0800
Re: Blocks for scope control Henk van Voorthuijsen <voorth@xs4all.nl> - 2012-01-16 07:03 -0800
Re: Blocks for scope control Arne Vajhøj <arne@vajhoej.dk> - 2012-01-17 18:43 -0500
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-20 11:05 -0800
Re: Blocks for scope control Gene Wirchenko <genew@ocis.net> - 2012-01-20 12:11 -0800
Re: Blocks for scope control Arne Vajhøj <arne@vajhoej.dk> - 2012-02-06 21:24 -0500
csiph-web