Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23935
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to convert image into Hex 2 Dimensional Array? |
| Date | Wed, 08 May 2013 18:46:40 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 72 |
| Message-ID | <kmdvai$765$1@dont-email.me> (permalink) |
| References | <41718873-b1a6-4b97-bbbb-8002c48d4e29@googlegroups.com> <GKCdnX3n1aHvmhfMnZ2dnUVZ8s6dnZ2d@bt.com> <kmdj5i$sk9$1@dont-email.me> <iqudnf7mvqsqxBfMnZ2dnUVZ7tSdnZ2d@bt.com> <kmdquo$dj7$1@dont-email.me> <y4KdnaD92O8L5xfMnZ2dnUVZ8qmdnZ2d@bt.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 8 May 2013 16:42:59 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="8e103db3a4f21801713a9e44848762c0"; logging-data="7365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IwNndDfBaNK9wtt1Eyy8M" |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| In-Reply-To | <y4KdnaD92O8L5xfMnZ2dnUVZ8qmdnZ2d@bt.com> |
| Cancel-Lock | sha1:28n9HcUgJWffVCCrKNnUk8GKTLI= |
| Xref | csiph.com comp.lang.java.programmer:23935 |
Show key headers only | View raw
On 08/05/2013 18:17, lipska the kat allegedly wrote: > On 08/05/13 16:32, Daniele Futtorovic wrote: >> On 08/05/2013 15:57, lipska the kat allegedly wrote: >>> On 08/05/13 14:19, Daniele Futtorovic wrote: >>>> On 08/05/2013 10:06, lipska the kat allegedly wrote: >>>>> Byte[][] bytes = new Byte[width][height]; >>>> >>>> Lipska, mind the difference between Byte and byte. That code above is >>>> extremely bad advice. >>> >>> Why? it's common practice these days to eschew primitives and use >>> (autoboxing) classes, it's more consistent in OO code and, as I >>> understand things, post autoboxing, the following two lines are >>> logically equivalent. >>> >>> 1. Byte[][] bytes = new Byte[width][height]; >>> 2. byte[][] bytes = new byte[width][length] > > typo notwithstanding oops :-( > >>> The following is perfectly legal given either of the above >>> >>> byte b = 127; >>> bytes[0][0] = b; >>> Byte c = 126; >>> bytes[0][1] = c; >>> Byte d = bytes[0][0]; >>> byte e = bytes[0][1]; >>> >>> I would of course be interested to know what your objection is. >> >> Simple: "byte[]" is not a primitive type. > > I wasn't aware that I said it was When I called out your using a Byte[] rather than byte[] in your example code, you defended it on the grounds of an alleged "common practice" to use (boxed) reference types instead of primitive types. Thereby, you have implied that byte[] was a primitive type; otherwise your whole argument would have been a non sequitur. But byte[] is not a primitive type, and hence your argument, irrespectively of its merits (see below), does not apply. >> "byte" is a primitive type. >> "byte[]" is a reference type. > > no argument there but what is your *objection* to > > Byte[][] bytes = new Byte[width][height]; > > in the context of the OPs question? Objection? It's bullcrap. Firstly, no I/O library uses Byte[]. Secondly, as Daniel has indicated, the only reason to use Byte[] over byte[] would be to store null references. Which the OP doesn't need, as they have actual data. And lastly, it's dangerous because it furthers the very thing that, I reckon, lead you to use it in the first place: the confusion induced by autoboxing. General OO matters set aside, in the context of Java, autoboxing is a poison. The meagre convenience it provides is largely offset by the confusion, or lack of clarity, it causes in the minds of Java programmers, especially aspirant Java programmers. I've witnessed its nefarious effects countless times in my colleagues' code. A for/each loop is exactly the same thing as a normal for loop with an iterator. But, for better or for worse, in Java, a boxed reference type and a primitive type are two completely different things. Autoboxing induces the thought that they're not. That's why it's poison. -- DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to convert image into Hex 2 Dimensional Array? sout saret <saretmis097@gmail.com> - 2013-05-07 23:30 -0700
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 09:06 +0100
Re: How to convert image into Hex 2 Dimensional Array? Joerg Meier <joergmmeier@arcor.de> - 2013-05-08 12:29 +0200
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 13:28 +0100
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-08 15:19 +0200
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 14:57 +0100
Re: How to convert image into Hex 2 Dimensional Array? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-08 08:22 -0700
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 17:03 +0100
Re: How to convert image into Hex 2 Dimensional Array? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-08 13:44 -0700
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 17:48 +0100
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-08 21:10 -0400
Re: How to convert image into Hex 2 Dimensional Array? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-08 12:52 -0400
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-08 17:32 +0200
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 17:17 +0100
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-08 18:46 +0200
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 18:25 +0100
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-08 23:24 +0200
Re: How to convert image into Hex 2 Dimensional Array? Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2013-05-08 11:46 -0500
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-08 21:04 -0400
Re: How to convert image into Hex 2 Dimensional Array? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-08 21:45 -0400
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-08 21:59 -0400
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-08 22:03 -0400
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-09 04:09 +0200
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-09 04:09 +0200
Re: How to convert image into Hex 2 Dimensional Array? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-08 23:18 -0400
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-09 22:05 -0400
Re: How to convert image into Hex 2 Dimensional Array? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 09:46 -0700
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-10 19:02 +0200
Re: How to convert image into Hex 2 Dimensional Array? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 11:00 -0700
Re: How to convert image into Hex 2 Dimensional Array? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-10 23:42 +0200
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-10 18:20 -0400
Re: How to convert image into Hex 2 Dimensional Array? Jeff Higgins <jeff@invalid.invalid> - 2013-05-08 12:43 -0400
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 18:45 +0100
Re: How to convert image into Hex 2 Dimensional Array? Jeff Higgins <jeff@invalid.invalid> - 2013-05-08 11:18 -0400
Re: How to convert image into Hex 2 Dimensional Array? Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2013-05-08 11:52 -0500
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 18:40 +0100
Re: How to convert image into Hex 2 Dimensional Array? Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2013-05-08 13:54 -0500
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-08 20:43 +0100
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-11 09:28 +0100
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-11 08:50 -0400
Re: How to convert image into Hex 2 Dimensional Array? lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-05-11 15:00 +0100
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-12 21:45 -0400
Re: How to convert image into Hex 2 Dimensional Array? Manuel Dahmen <manuel.dahmen@gmail.com> - 2013-05-08 15:38 -0700
Re: How to convert image into Hex 2 Dimensional Array? Roedy Green <see_website@mindprod.com.invalid> - 2013-05-11 13:33 -0700
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-12 21:48 -0400
Re: How to convert image into Hex 2 Dimensional Array? markspace <markspace@nospam.nospam> - 2013-05-12 20:49 -0700
Re: How to convert image into Hex 2 Dimensional Array? Arne Vajhøj <arne@vajhoej.dk> - 2013-05-13 19:08 -0400
Re: How to convert image into Hex 2 Dimensional Array? Roedy Green <see_website@mindprod.com.invalid> - 2013-05-15 03:45 -0700
Re: How to convert image into Hex 2 Dimensional Array? Roedy Green <see_website@mindprod.com.invalid> - 2013-05-15 03:50 -0700
csiph-web