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


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

Re: compare several boolean matrix’s

X-Received by 10.224.175.65 with SMTP id w1mr5701692qaz.7.1360437484889; Sat, 09 Feb 2013 11:18:04 -0800 (PST)
X-Received by 10.49.15.100 with SMTP id w4mr720333qec.26.1360437484869; Sat, 09 Feb 2013 11:18:04 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!p13no6419774qai.0!news-out.google.com!k2ni21154qap.0!nntp.google.com!p13no5173041qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Sat, 9 Feb 2013 11:18:04 -0800 (PST)
In-Reply-To <5115d160$0$283$14726298@news.sunsite.dk>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 173.164.137.214
References <8f60207e-f848-490b-a402-7cc1aba657e9@googlegroups.com> <ad3775e4-d087-4d07-ab95-ab62db3f35fb@googlegroups.com> <cq2dnVlRd-tdDY_MnZ2dnUVZ8jidnZ2d@bt.com> <d1322f9a-2c40-4b0e-9e41-f490d18b1f67@googlegroups.com> <bvqdnV6WTp7CA4_MnZ2dnUVZ8sadnZ2d@bt.com> <d0e4ed65-85cd-416f-8339-aff4fa943ea5@googlegroups.com> <b23f5206-3054-4cbd-a091-e9d63f5107a8@googlegroups.com> <P7ydnXXp988ty4jMnZ2dnUVZ7radnZ2d@bt.com> <5115d0e4$0$283$14726298@news.sunsite.dk> <5115d160$0$283$14726298@news.sunsite.dk>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <21496893-281c-4f0a-803a-0466acce96f4@googlegroups.com> (permalink)
Subject Re: compare several boolean matrix’s
From Lew <lewbloch@gmail.com>
Injection-Date Sat, 09 Feb 2013 19:18:04 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.java.programmer:22255

Show key headers only | View raw


Arne Vajhøj wrote:
> I would have done a few things differently, but ...
>
> public class MatrixSummarize {
> 	public static boolean[][] summarize(boolean[][][] matrices) {
> 		assert matrices.length % 2 == 1 : "Number of matrices must be odd";

Nitpicks: Some details that separate pedagogy from production.

Arne's code is very good, and proper for instruction. However, if it were
to serve in production there is more to do.

This is an improper use of 'assert' because there is no code to 
enforce the invariant. Properly, there should be argument-checking prior to
the assertion so that it represents an actual invariant.

There's no check for a null argument. One could assert non-nullity after 
the check.

By dropping the 'assert' in here like this, Arne has presented a secret 
challenge to fill in the gaps, as anyone schooled in the use of 'assert' 
might have noticed.

-- 
Lew

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


Thread

compare several boolean matrix’s keijaf2011@gmail.com - 2013-02-05 11:19 -0800
  Re: compare several boolean matrix’s Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-05 15:47 -0500
  Re: compare several boolean matrix’s Roedy Green <see_website@mindprod.com.invalid> - 2013-02-05 16:26 -0800
    Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-05 19:43 -0500
      Re: compare several boolean matrix’s Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-05 21:09 -0400
  Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-05 19:40 -0500
  Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-05 23:21 -0800
  Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 03:23 -0800
    Re: compare several boolean matrix’s Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-06 07:55 -0400
      Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 04:11 -0800
        Re: compare several boolean matrix’s Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-06 08:24 -0400
          Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 06:00 -0800
        Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 14:00 +0000
    Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 16:18 -0500
  Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 06:35 -0800
    Re: compare several boolean matrix’s Patricia Shanahan <pats@acm.org> - 2013-02-06 07:49 -0800
    Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 16:13 +0000
  Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 08:01 -0800
  Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 08:20 -0800
    Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 16:33 +0000
  Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 08:42 -0800
    Re: compare several boolean matrix’s Lars Enderin <lars.enderin@telia.com> - 2013-02-06 18:09 +0100
      Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 09:14 -0800
        Re: compare several boolean matrix’s Lars Enderin <lars.enderin@telia.com> - 2013-02-06 18:29 +0100
          Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 09:40 -0800
    Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 17:19 +0000
      Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 09:29 -0800
        Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 18:18 +0000
          Re: compare several boolean matrix’s Lars Enderin <lars.enderin@telia.com> - 2013-02-06 19:57 +0100
            Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 19:02 +0000
              Re: compare several boolean matrix’s T®oll <spooksRus@derbyshire-crania.org> - 2013-02-06 21:01 +0000
          Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-08 11:21 -0800
            Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-08 11:31 -0800
              Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-08 19:49 +0000
                Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-08 12:24 -0800
                Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 23:30 -0500
                Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 23:32 -0500
                Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-09 08:39 +0000
                Re: compare several boolean matrix’s Lew <lewbloch@gmail.com> - 2013-02-09 11:18 -0800
                Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-09 19:25 -0500
                Re: compare several boolean matrix’s Lew <lewbloch@gmail.com> - 2013-02-09 23:36 -0800
                Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-10 13:54 -0500
            Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 16:30 -0500
        Re: compare several boolean matrix’s Patricia Shanahan <pats@acm.org> - 2013-02-06 11:24 -0800

csiph-web