Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;)

50 views
Skip to first unread message

Skybuck Flying

unread,
May 17, 2012, 9:09:23 AM5/17/12
to
Hello,

My hypothesis that a human being cannot write 10 lines of code without
making a mistake has been confirmed by either oracle or google or both
depending on what you believe ;)

The lawsuit apperently mentions these 9 lines of code:

"
private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex(" + fromIndex +
") > toIndex(" + toIndex+")");
if (fromIndex < 0)
throw new ArrayIndexOutOfBoundsException(fromIndex);
if (toIndex > arrayLen)
throw new ArrayIndexOutOfBoundsException(toIndex);
}
"

There is at least 1 major bug in it:

toIndex could equal arrayLen which would still be out of bounds assuming
zero-index-based arrays.

So for example if the array length is 100, then toIndex is valid for range 0
to 99.

And therefore the exception should be raised for equalness to arrayLen as
well.

So the correct code should probably have been ">=" instead of just ">".

Except if some special outside code assumes that it's ok... I don't know
where this routine is being used... but by itself it would be flawed.

Also fromIndex could also still go out of range past arrayLen this is also
not checked.

So this code seems highly buggy and does somewhat prove that it was copied
?!

It's a bit unlikely that two programmers make the exact same dumb mistake !
;)

So the funny part is, the bugs in it kinda prove that it was copied ! ;)

Mimimimimimimmimimi :)

Bye,
Skybuck.

Joshua Cranmer

unread,
May 17, 2012, 9:23:13 AM5/17/12
to
On 5/17/2012 9:09 AM, Skybuck Flying wrote:
> There is at least 1 major bug in it:
>
> toIndex could equal arrayLen which would still be out of bounds assuming
> zero-index-based arrays.

I believe toIndex in this case is being used in half-open notation, so
toIndex is the first element not accessed.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Skybuck Flying

unread,
May 17, 2012, 11:26:21 AM5/17/12
to


"Fred K" wrote in message
news:29308868.1994.1337265697084.JavaMail.geo-discussion-forums@pbcuc6...

On Thursday, May 17, 2012 6:09:23 AM UTC-7, Skybuck Flying wrote:
> Hello,
>
> My hypothesis that a human being cannot write 10 lines of code without
> making a mistake has been confirmed by either oracle or google or both
> depending on what you believe ;)
>
> The lawsuit apperently mentions these 9 lines of code:
>
> "
> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
> if (fromIndex > toIndex)
> throw new IllegalArgumentException("fromIndex(" + fromIndex +
> ") > toIndex(" + toIndex+")");

"
This is not C.
"

It's a curly brace language which the same kind of stupid c programming see
below.

> if (fromIndex < 0)
> throw new ArrayIndexOutOfBoundsException(fromIndex);
> if (toIndex > arrayLen)
> throw new ArrayIndexOutOfBoundsException(toIndex);
> }
> "
>
> There is at least 1 major bug in it:
>
> toIndex could equal arrayLen which would still be out of bounds assuming
> zero-index-based arrays.
>
> So for example if the array length is 100, then toIndex is valid for range
> 0
> to 99.
>
> And therefore the exception should be raised for equalness to arrayLen as
> well.
>
> So the correct code should probably have been ">=" instead of just ">".
>
> Except if some special outside code assumes that it's ok... I don't know
> where this routine is being used... but by itself it would be flawed.
>
> Also fromIndex could also still go out of range past arrayLen this is also
> not checked.
>

"
Actually it is checked by the combined actions of the first and third "if"
statements.
"

A very perverse way. The mission is to check if indexes are outside the
array "out of bounds".

Furthermore it makes no sense, copieing from high to low should be possible
as well, so it's obvious this code assumes that copieing from low to high is
the only possibility. A strange assumption to make, making this code much
less usuable and much less flexible in the case it needs to be adjusted to
accommodate for this new functionality as will often be the case with
software and changing requirements.

Furthermore it seems to be an "optimization". Instead of simple using 4
branches, the code tries to do it with 3.

Furthermore a dependency is added on the correctness of another branch.
Since the 3 branch is incorrect the first one is now incorrect as well
leading to two different possible bugs instead of just one.

bug1: toIndex can now be out of bounds.

bug2: fromIndex can now be out of bounds as well.

Example: 100 100

This code is a nice example oh how not to program.

Apperently only a skilled coder/debugger like me seems to be able to spot
the fallacies in this way too debug-complex code.

Lesson to be learned from this code:

Do not introduce dependencies like this.

Heikki Kallasjoki

unread,
May 17, 2012, 12:19:00 PM5/17/12
to
On 2012-05-17, Skybuck Flying <Window...@DreamPC2006.com> wrote:
>> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
>> if (fromIndex > toIndex)
>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>> ") > toIndex(" + toIndex+")");
>> if (fromIndex < 0)
>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>> if (toIndex > arrayLen)
>> throw new ArrayIndexOutOfBoundsException(toIndex);
>> }

> A very perverse way. The mission is to check if indexes are outside the
> array "out of bounds".
>
> Furthermore it makes no sense, copieing from high to low should be possible

Who said anything about copying?

I believe it is checking whether the range fromIndex, fromIndex+1, ...,
toIndex-1 -- i.e., a range given as the first index and one past the
last index, not an uncommon practice -- is within the array, in which
case it has no bugs. (toIndex may legally equal the length of the array
when the range extends to the last element, and requiring the range to
be specified "the right way around" is not especially perverse.)


--
Heikki Kallasjoki

jacob navia

unread,
May 17, 2012, 12:54:27 PM5/17/12
to
I think you are 100% right. Human beings are just too stupid.

Let's get rid of them, starting with you.


Mark Storkamp

unread,
May 17, 2012, 1:06:38 PM5/17/12
to
In article <b3f1b$4fb4f87c$5419acc3$14...@cache60.multikabel.net>,
"Skybuck Flying" <Window...@DreamPC2006.com> wrote:

> Hello,
>
> My hypothesis that a human being cannot write 10 lines of code without
> making a mistake has been confirmed by either oracle or google or both
> depending on what you believe ;)
>
> The lawsuit apperently mentions these 9 lines of code:

Skybuck »apparently« proves humans cannot write 7 lines without an error
in spelling.

markspace

unread,
May 17, 2012, 1:11:01 PM5/17/12
to
Classic.

The internet: it's like an assembly factory for idiots.


Marius

unread,
May 17, 2012, 1:32:21 PM5/17/12
to
True, i have just written a few testcases for 4 year old sources and
was really amazed to find lots of (little) bugs (6 errors on 1100 lines
to be exact and i'm sure there a a few left which i haven't tested or
cannot test).

Though 10 lines seems really low (unless you're using that weird C
dialect <g>), 1 error each 20 to 50 sounds about right for experienced
programmers.

Skybuck Flying

unread,
May 17, 2012, 1:57:33 PM5/17/12
to


"Heikki Kallasjoki" wrote in message news:slrnjra97...@iris.zem.fi...

On 2012-05-17, Skybuck Flying <Window...@DreamPC2006.com> wrote:
>> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex)
>> {
>> if (fromIndex > toIndex)
>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>> ") > toIndex(" + toIndex+")");
>> if (fromIndex < 0)
>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>> if (toIndex > arrayLen)
>> throw new ArrayIndexOutOfBoundsException(toIndex);
>> }

> A very perverse way. The mission is to check if indexes are outside the
> array "out of bounds".
>
> Furthermore it makes no sense, copieing from high to low should be
> possible

"
Who said anything about copying?
"

It seems likely this code is called right before the array is accessed to
try and prevent an access violation, instead it tries to throw a somewhat
nicer exception message to indicate a problem with array access.

(Reading/writing to an array can be considered "copieing").

"
I believe it is checking whether the range fromIndex, fromIndex+1, ...,
toIndex-1 -- i.e., a range given as the first index and one past the
last index, not an uncommon practice -- is within the array, in which
case it has no bugs. (toIndex may legally equal the length of the array
when the range extends to the last element, and requiring the range to
be specified "the right way around" is not especially perverse.)
"

It's simply not valid. Out of bounds has a very clear meaning in programming
practice. It's either within bounds or it's not. The bounds of a java array
are very clearly defined. Thus the only logical conclusion is that the code
is simply bugged.
Either in logic or in description. Either change the exception-description
or fix the code.

If this were some stack based structure then it would make sense that the
index could go one beyond the size. However it's not a stack, but an array.

The perversity is not with checking if "to" is beyond "from". The perversity
is the logical dependency of the "from" out of bounds check onto the "to"
out of bounds check.

Both indexes can be considered separate indexes and there a simply routine
which would check each index individually would be better/preferred.

However this routine seems to try and do multiple tasks all at once, which
is another bad coding practice.

Therefore advice:

1. Split routine up into two separate routines:

First routine to check if a single index is out of bounds.

Second routine to check if the indexes are in proper order.

Further more checking the indexes independently might even execute faster
because of instruction level parallelism, so this attempted optimization
might actually be counter productive, except for perhaps less instruction
decoding.

The call overhead of using multiple routines could be counter acted by
inlining features. I am not sure if java has "inlining" support.

Bye,
Skybuck.

glen herrmannsfeldt

unread,
May 17, 2012, 2:33:31 PM5/17/12
to
In comp.lang.java.programmer Skybuck Flying <Window...@dreampc2006.com> wrote:

(snip)

>>> if (fromIndex < 0)
>>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>>> if (toIndex > arrayLen)
>>> throw new ArrayIndexOutOfBoundsException(toIndex);


(snip, someone else wrote)

>> I believe it is checking whether the range fromIndex, fromIndex+1, ...,
>> toIndex-1 -- i.e., a range given as the first index and one past the
>> last index, not an uncommon practice -- is within the array, in which
>> case it has no bugs. (toIndex may legally equal the length of the array
>> when the range extends to the last element, and requiring the range to
>> be specified "the right way around" is not especially perverse.)
>> "

> It's simply not valid. Out of bounds has a very clear meaning
> in programming practice. It's either within bounds or it's not.

But this isn't "programming" it is Java, and Java can do it however
it wants to.

> The bounds of a java array are very clearly defined. Thus the
> only logical conclusion is that the code is simply bugged.
> Either in logic or in description. Either change the
> exception-description or fix the code.

Look at the definition of the substring method in String class.

It avoids a lot of -1 by the programmer to define it this way.
(Along with consistently starting indexing at zero.)

-- glen

Heikki Kallasjoki

unread,
May 17, 2012, 3:13:00 PM5/17/12
to
On 2012-05-17, Skybuck Flying <Window...@DreamPC2006.com> wrote:
>>> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex)
>>> {
>>> if (fromIndex > toIndex)
>>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>>> ") > toIndex(" + toIndex+")");
>>> if (fromIndex < 0)
>>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>>> if (toIndex > arrayLen)
>>> throw new ArrayIndexOutOfBoundsException(toIndex);
>>> }
>
> It seems likely this code is called right before the array is accessed to
> try and prevent an access violation, instead it tries to throw a somewhat
> nicer exception message to indicate a problem with array access.

No. It seems likely rangeCheck(10, 4, 7) is testing whether indices 4,
5 and 6 (that is the *range* from 4, inclusive, to 7, exclusive) are
within the bounds of an array of length 10, which it does just fine.

> It's simply not valid. Out of bounds has a very clear meaning in programming
> practice. It's either within bounds or it's not. The bounds of a java array

Yes, but it is not designed for testing whether fromIndex and toIndex
are within those bounds. It is used to test whether fromIndex,
fromIndex+1, ..., toIndex-1 are, which it does. In particular, the
element with index "toIndex" is not part of the range it's testing, so
it does not need to be inside the array bounds.

In other words, the range fromIndex=5, toIndex=10 denotes the elements
5, 6, 7, 8 and 9. It does not include element 10. rangeCheck(10, 5, 10)
is not supposed to throw an exception, nor does it do so.

(Would it be possible to also stop crossposting to all the unrelated
groups?)


--
Heikki Kallasjoki

Heikki Kallasjoki

unread,
May 17, 2012, 3:19:46 PM5/17/12
to
On 2012-05-17, Heikki Kallasjoki <fis+u...@zem.fi> wrote:
> On 2012-05-17, Skybuck Flying <Window...@DreamPC2006.com> wrote:
>>>> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex)
>>>> {
>>>> if (fromIndex > toIndex)
>>>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>>>> ") > toIndex(" + toIndex+")");
>>>> if (fromIndex < 0)
>>>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>>>> if (toIndex > arrayLen)
>>>> throw new ArrayIndexOutOfBoundsException(toIndex);
>>>> }
>>
>> It's simply not valid. Out of bounds has a very clear meaning in programming
>> practice. It's either within bounds or it's not. The bounds of a java array
>
> Yes, but it is not designed for testing whether fromIndex and toIndex
> are within those bounds. It is used to test whether fromIndex,
> fromIndex+1, ..., toIndex-1 are, which it does. In particular, the
> element with index "toIndex" is not part of the range it's testing, so
> it does not need to be inside the array bounds.

For "proof", see the original comments that accompany the rangeCheck
function:

/**
* Checks that fromIndex and toIndex are in range, and throws an
* appropriate exception if they aren't.
*
* @param arrayLen the length of the array
* @param fromIndex the index of the first element of the range
* @param toIndex the index after the last element of the range
* @throws IllegalArgumentException if fromIndex > toIndex
* @throws ArrayIndexOutOfBoundsException if fromIndex < 0
* or toIndex > arrayLen
*/

Note in particular the words "the index after the last element of the
range".

(Source:
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/TimSort.java?view=co
)

--
Heikki Kallasjoki

Skybuck Flying

unread,
May 17, 2012, 5:16:05 PM5/17/12
to


"Heikki Kallasjoki" wrote in message news:slrnjrajd...@iris.zem.fi...
Now it's becoming a computer programming language issue.

What is the definition of "range".

You cannot simply redefine the meaning of "range". As you did by writing
"inclusive" and then "exclusive" and flipping flopping whenever it suits
you.

The programming language known as C probably introduced the "curly brace
language".

Java is based on C and also uses the "curly brace language".

Since Java seems to be based of off C and is actually implemented in C it's
safe to say that the word known as "range" in computer language follows the
same meaning as it has in C.

Wikipedia is pretty clear about what "range" means in the programming
language C:

http://en.wikipedia.org/wiki/Range_(computer_programming)

Range is always inclusive unless otherwise stated.

Therefore a programmer seeing a prototype of "rangeCheck" without actually
seeing the body of the code should be safe to assume that range encompanses
all of the indexes, being inclusive.

Thus calling rangeCheck( 10, 0, 10 ) would include index 10 to be checked
for out of bounds.

In this case it would be out of bounds, yet no exception is raised, thus
from any point of view the function is flawed.

Bye,
Skybuck.

Skybuck Flying

unread,
May 17, 2012, 5:25:08 PM5/17/12
to

"
"glen herrmannsfeldt" wrote in message
news:jp3g9r$v22$1...@speranza.aioe.org...
Not really,

Programmers of all languages must be able to communicate with each other
through common language and concepts.

One such concept is "range".

It's pretty clearly defined:

http://en.wikipedia.org/wiki/Range_(computer_programming)

Any computer language deviating from the standard/common meaning of range
should clearly state so.

Any code deviating from the standard/coming meaning of range should clearly
state so.

Obviously if the routine was ment to check "range" then it's flawed.

Obviously if the routine was ment to check "range-1" then it’s name should
have been slightly different to state just that, example:

checkRangeMinusOne

or

checkRangeInclusiveExclusive

or

CheckRangeExceptLast

Fortunately for us the code is available, but this is not always the case in
other programming languages like C where sometimes only headers are
available.

Nice way to sneak in bugs ! ;)

Bye,
Skybuck.

Lew

unread,
May 17, 2012, 5:43:38 PM5/17/12
to
markspace wrote:
> Mark Storkamp wrote:
>> "Skybuck Flying" wrote:
>>> My hypothesis that a human being cannot write 10 lines of code without
>>> making a mistake has been confirmed by either oracle or google or both
>>> depending on what you believe ;)
>>>
>>> The lawsuit apperently mentions these 9 lines of code:
>>
>> Skybuck *apparently* proves humans cannot write 7 lines without an error

or three

>> in spelling.

Plus other grammar errors.

> Classic.
>
> The internet: it's like an assembly factory for idiots.

Isn't that spelled "Internet", being a proper noun and all?

But aren't the factual errors rather more significant, such as the false claims about the
indexes going out of range, or about his skill?

My favorite line from the OP was, "Apperently [sic] only a skilled coder/debugger like me ..."

The tears of laughter flowed like a monsoon.

--
Lew

Skybuck Flying

unread,
May 17, 2012, 5:45:26 PM5/17/12
to

"
"Marius" wrote in message news:xn0hy7hu9...@nntp.aioe.org...
I will have to disagree with you on the number of lines that an average
human being can write flawlessly.

One could consider writing and reasoning about programming lines as an
exercise in thinking ahead like "chess".

My hypothesis simply comes down to this: an average human being can at most
think 10 steps ahead in a game of chess ;)

If you could truly think ahead in steps of 20 or 50 then that would make you
a really strong chess player ! ;) I doubt it, more likely you are over
estimating yourself ;) :)

(Even for a computer/desktop pc in 2012 a depth of 9 to 10 is already quite
a lot ! ;))

Bye,
Skybuck.

Lew

unread,
May 17, 2012, 5:52:48 PM5/17/12
to
Skybuck Flying wrote:
> Not really,
>
> Programmers of all languages must be able to communicate with each other
> through common language and concepts.
>
> One such concept is "range".
>
> It's pretty clearly defined:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)

That definition does not contradict what others have said.
For example, it clearly states that the range of an array in
zero-index languages is from the lower bound (zero) to
one less than the length of the array.

If the variables in the program you incorrectly deride
specified the range differently from that, you would be right,
but they don't, so you're wrong.

> Any computer language deviating from the standard/common meaning of range
> should clearly state so.

Java is not such a language.

> Any code deviating from the standard/coming meaning of range should clearly
> state so.

The code you cite does not so deviate.

> Obviously if the routine was ment to check "range" then it's flawed.

Obviously it is not. If you write a loop such as

for (int index = 0; index < TOP; ++index) { ... }

it is perfectly legal for TOP to equal the array length, as in the
code you excoriate. If you wish to check that "0" and "TOP" specify
a valid range, you'd call that routine with

rangeCheck( array.length, 0, TOP);

just like they say to, and it would check the range just as defined
in the Wikipedia article you cite.

Your logic is what's flawed.

I guess you aren't such a skilled "coder/debugger" as you claim.

> Obviously if the routine was ment to check "range-1" then it’s [sic]
> name should have been slightly different to state just that, example:

Obviously that is just your own idiosyncratic style despotism speaking.

>
> checkRangeMinusOne
>
> or
>
> checkRangeInclusiveExclusive
>
> or
>
> CheckRangeExceptLast
>
> Fortunately for us the code is available, but this is not always the case in
> other programming languages like C where sometimes only headers are
> available.
>
> Nice way to sneak in bugs ! ;)

You have shown no bugs.

You don't even cite how that routine is used, you only speculate
and rant based on your unfounded assumptions and reasoning.

--
Lew

Daniel Pitts

unread,
May 17, 2012, 5:58:59 PM5/17/12
to
On 5/17/12 2:25 PM, Skybuck Flying wrote:
> But this isn't "programming" it is Java, and Java can do it however
> it wants to.
>
>> The bounds of a java array are very clearly defined. Thus the
>> only logical conclusion is that the code is simply bugged.
>> Either in logic or in description. Either change the
>> exception-description or fix the code.
>
> Look at the definition of the substring method in String class.
>
> It avoids a lot of -1 by the programmer to define it this way.
> (Along with consistently starting indexing at zero.)
> "
>
> Not really,
>
> Programmers of all languages must be able to communicate with each other
> through common language and concepts.
>
> One such concept is "range".
I read the method as saying "Verify this range is valid for this array
length." and it is according to the algorithm used.

It is a programming concept, open ended ranges are very frequent.

Joshua Cranmer

unread,
May 17, 2012, 5:59:05 PM5/17/12
to
On 5/17/2012 5:25 PM, Skybuck Flying wrote:
> One such concept is "range".
>
> It's pretty clearly defined:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
>
> Any computer language deviating from the standard/common meaning of
> range should clearly state so.

In 0-based array indexes, the standard interpretation of a range is the
half-open model: start <= value < end. Note in particular things like
the standard STL idioms, JavaScript slice, python's methods.

That you spend so much time arguing that this interpretation is wrong
indicates that you don't both to do much programming. Also, note that
Wikipedia isn't necessarily correct.

Heikki Kallasjoki

unread,
May 17, 2012, 6:13:44 PM5/17/12
to
On 2012-05-17, Joshua Cranmer <Pidg...@verizon.invalid> wrote:
> On 5/17/2012 5:25 PM, Skybuck Flying wrote:
>> One such concept is "range".
>>
>> It's pretty clearly defined:
>>
>> http://en.wikipedia.org/wiki/Range_(computer_programming)
>>
>> Any computer language deviating from the standard/common meaning of
>> range should clearly state so.
>
> In 0-based array indexes, the standard interpretation of a range is the
> half-open model: start <= value < end. Note in particular things like
> the standard STL idioms, JavaScript slice, python's methods.

And, most relevantly in this context, the standard methods in
java.util.Arrays (binarySearch, copyOfRange, fill, sort), all of which
accept ranges using the half-open "inclusive start, exclusive end" way.
Most of them even have parameters called "fromIndex" and "toIndex",
identically to rangeCheck. Surely it would be strange and unexpected to
deviate from this "standard/common meaning" used by the system libraries.

(Not to mention that the code in question, in its generated-documentation
comments quoted elsethread, does clearly state what the arguments mean.)


--
Heikki Kallasjoki

Marius

unread,
May 17, 2012, 6:16:40 PM5/17/12
to
>Though 10 lines seems really low (unless you're using that weird C
>dialect <g>), 1 error each 20 to 50 sounds about right for experienced
>programmers.
>"
>
>I will have to disagree with you on the number of lines that an
>average human being can write flawlessly.

You can, i don't think we will ever agree on the approx. amount of
errors made by an average programmer and experienced programmer. (i
deliberately wrote experienced programmer)

>One could consider writing and reasoning about programming lines as
>an exercise in thinking ahead like "chess".
>
>My hypothesis simply comes down to this: an average human being can
>at most think 10 steps ahead in a game of chess ;)
>
>If you could truly think ahead in steps of 20 or 50 then that would
>make you a really strong chess player ! ;) I doubt it, more likely
>you are over estimating yourself ;) :)

Chess is kind of a weird comparison but i do agree that a seasoned
programmer will think ahead like 2 units, 5 classes etc. Programmers
think more ahead in terms of algorithmes, processes etc and the details
of those dont need to be crystal clear (unlike chess).

;)

Skybuck Flying

unread,
May 17, 2012, 6:47:06 PM5/17/12
to
The chess comparision makes sense in the following way:

A good chess player will reason about dependent moves which can also be
considered branches like a computer program.

For each possible move there are other possible moves which can be done,
just like if else statements and case statements.

However it goes further, all parts of a computer program like indexes,
values, constants influence each other.

Therefore code is one dependent mess, the more dependencies the more likely
that something will break or become buggy if something is changed.

Therefore for a programmer to reason about a possible change to a single
line of code it's necessary to think how this single change could impact all
other dependencies just like a chess player must reason about dependencies
of it's moves.
(The same applies to debugging a program, reasoning about potential bugs,
potential wrong lines of code).

Doing the moves in the wrong order in chess might lead to "being checked" or
even "stalemate" which can be considered in error in the reasoning or a bug
;) :)

Think of the C program as being compiled to assembler instructions, each
assembler instruction being a "chess move" or each branch as being a "chess
move", also indexes/values/registers as being "a chess move".

Think of the indexes as being the squares on the chess board. This will
quickly lead to the conclusion that the number of moves in a computer
program could surpass a chess game.

It's quite amazing how complex an only 10 instruction program can be if
allowed to copy itself, mutate itself, modify itself etc ;) (corewar hint
here ;) :))

Bye,
Skybuck.




Skybuck Flying

unread,
May 17, 2012, 7:09:23 PM5/17/12
to


"Joshua Cranmer" wrote in message news:jp3sbr$s52$1...@dont-email.me...

On 5/17/2012 5:25 PM, Skybuck Flying wrote:
> One such concept is "range".
>
> It's pretty clearly defined:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
>
> Any computer language deviating from the standard/common meaning of
> range should clearly state so.

"
In 0-based array indexes, the standard interpretation of a range is the
half-open model: start <= value < end. Note in particular things like
the standard STL idioms, JavaScript slice, python's methods.
"

More reference material on this would be nice.

None the less this does not mean that STL is correct, it could be flawed
just like standard library for C's gets.

"
That you spend so much time arguing that this interpretation is wrong
indicates that you don't both to do much programming. Also, note that
Wikipedia isn't necessarily correct.
"

For such a simple concept as "range" to state that wikipedia is incorrect is
a bit cheap/cheesy.

None the less programming was invented by mathematicians so let's see what
they have to say about it:

"
Answer:
For a Function
The "range" is the set of all possible values of a function for the values
of the variable.

Read more:
http://wiki.answers.com/Q/What_is_the_definition_of_range_in_math#ixzz1vAehNwPN
"

The array can be considered the variable, the values of this variable can be
considered the indexes.

The data elements can be considered the indirect values which are pointed
towards by the indexes.

Therefore "all possible values" is the full range from 0 to 9 for an array
of 10 elements starting with a zero based index.

Interestingly enough another website defines the range to be "9" (highest
value - smallest value). Which seems to be a compounded variable/value.

However here array length is specified which is 10 and thus not a "range" in
this sense. Thus length != range.

Finally your claims make me wonder if this is perhaps why "for each" and
"for all" was invented because c++ programmers fok-up to much with the
openness which you described ! ;)

That would be quite amuzing that you guys now need a special "for each" to
iterate correctly ;)

So much for that lol ("programming skill") ;)

Bye,
Skybuck.

markspace

unread,
May 17, 2012, 7:13:03 PM5/17/12
to
On 5/17/2012 2:43 PM, Lew wrote:
> markspace wrote:
>>
>> The internet: it's like an assembly factory for idiots.
>
> Isn't that spelled "Internet", being a proper noun and all?



I haven't been in the habit of capitalizing "internet" in a long time.
There appears to be some debate about it, which rather surprised me. I
would have thought by now it would be ubiquitous to not capitalize.

"In 2002, a New York Times column theorized that Internet has been
changing from a proper noun to a generic term.[4] Words for new
technologies, such as Phonograph in the 19th century, are sometimes
capitalized at first, later becoming uncapitalized.[4] In 1999, another
column suggested that Internet might, like some other commonly used
proper nouns, lose its capital letter.[5]"

<http://en.wikipedia.org/wiki/Internet_capitalization_conventions>

C.f. "Oxford comma."

Skybuck Flying

unread,
May 17, 2012, 7:18:00 PM5/17/12
to


"Heikki Kallasjoki" wrote in message news:slrnjrau0...@iris.zem.fi...
There is no "rangeCheck" function for java.util.Arrays:

http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html

To me it appears as if rangeCheck is some low level operating system code or
memory management code to try and prevent the os or applications from
crashing or exploits from taking over the system.

It would be interesting to know where this "rangeCheck" function is from.

I would not be surprised that the functions you mentioned would be the cause
of many bugs in java programs.

Almost seems like a deliberate design to make java programs crash... perhaps
a nice test for the "sand boxing" which after many years has proven to be a
failure, google for java exploits ;)

One of the reasons why java will not be installed onto my computers now and
in the future.

Seeing these functions only re-assures me of my decision to do so.

Bye,
Skybuck.

markspace

unread,
May 17, 2012, 7:42:23 PM5/17/12
to
On 5/17/2012 4:13 PM, markspace wrote:

> <http://en.wikipedia.org/wiki/Internet_capitalization_conventions>


Here's an even better quote from the same Wikipedia link. Perhaps not
coincidentally, I read both The Economist and CNN rather obsessively.


"More recently, a significant number of publications have switched to
not capitalizing the noun internet. Among them are The Economist, the
Financial Times, The Times, the Guardian, the Observer[8] and the Sydney
Morning Herald. As of 2011, most publications using "internet" appear to
be located outside of North America, but the gap is closing. Wired News,
an American news source, adopted the lower-case spelling in 2004.[9]
Around April 2010, CNN shifted its house style to adopt the lowercase
spelling."

Jan Burse

unread,
May 17, 2012, 8:27:56 PM5/17/12
to
markspace schrieb:
The english capitalization rules are anyway degenerate:

Traditionally, certain letters were rendered differently according to a
set of rules. In particular, those letters that began sentences or nouns
were made larger and often written in a distinct script. There was no
fixed capitalization system until the early 18th century. The English
language eventually dropped the rule for nouns, while the German
language kept it.

http://en.wikipedia.org/wiki/Letter_case

Bye

Jim Janney

unread,
May 17, 2012, 8:35:57 PM5/17/12
to
This is in fact a good example of someone doing everything exactly
right: the JavaDoc provides a clear, unambiguous specification and the
code implements it exactly. I can only wish all code were this "buggy".

--
Jim Janney

Joshua Cranmer

unread,
May 17, 2012, 9:32:26 PM5/17/12
to
On 5/17/2012 7:18 PM, Skybuck Flying wrote:
> There is no "rangeCheck" function for java.util.Arrays:
>
> http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html
>
> To me it appears as if rangeCheck is some low level operating system
> code or memory management code to try and prevent the os or applications
> from crashing or exploits from taking over the system.

It's a private method in java.util.Arrays, which is why the API does not
list it. If you actually read the code you'd posted, you would have
realized that.

Heikki Kallasjoki

unread,
May 18, 2012, 3:22:40 AM5/18/12
to
On 2012-05-17, Skybuck Flying <Window...@DreamPC2006.com> wrote:
> To me it appears as if rangeCheck is some low level operating system code or
> memory management code to try and prevent the os or applications from
> crashing or exploits from taking over the system.
>
> It would be interesting to know where this "rangeCheck" function is from.

AFAIK, it's originally from TimSort, the sorting algorithm used in Java
nowadays. See
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/TimSort.java?view=co
-- rangeCheck is at the end of the file. It's not low-level at all; the
sandboxing is enforced by the Java VM. It's just used once to check the
arguments of sort(), before starting the actual work, presumably in
order to get more sensible-looking exceptions that it might otherwise
produce.

> I would not be surprised that the functions you mentioned would be the cause
> of many bugs in java programs.
>
> Almost seems like a deliberate design to make java programs crash... perhaps

Strongly disagree. I wouldn't be surprised if the number of places
where half-open intervals are used would outnumber the uses of fully
inclusive ranges, though a thorough survey is outside the scope of this
message. I can only think of PHP range() and Perl "a..b" notation
offhand. I'm sure more can be found; but then again, that applies also
to half-open ranges, for which C++ (STL), JavaScript, Python and Java
have already been mentioned.


--
Heikki Kallasjoki

Roedy Green

unread,
May 18, 2012, 5:57:30 AM5/18/12
to
On Thu, 17 May 2012 15:09:23 +0200, "Skybuck Flying"
<Window...@DreamPC2006.com> wrote, quoted or indirectly quoted
someone who said :

>So this code seems highly buggy and does somewhat prove that it was copied

Even if it were, so what. Every time you write a sentence you copy
words from a dictionary. Copying should only apply to complete works.
You are allowed to copy paragraphs of books. So it seems to be
partial methods should be fair game.
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Plants" with "leaves" no more efficient than today's solar cells
could out-compete real plants, crowding the biosphere with an
inedible foliage. Tough omnivorous "bacteria" could out-compete
real bacteria: They could spread like blowing pollen, replicate
swiftly, and reduce the biosphere to dust in a matter of days.
Dangerous replicators could easily be too tough, small, and
rapidly spreading to stop -- at least if we make no preparation.
We have trouble enough controlling viruses and fruit flies.
~ Eric Drexler (born: 1955-04-25 age: 57)
Engines of Creation: The Coming Era of Nanotechnology.
.

Leif Roar Moldskred

unread,
May 18, 2012, 6:26:06 AM5/18/12
to
In comp.lang.java.programmer Roedy Green <see_w...@mindprod.com.invalid> wrote:

> You are allowed to copy paragraphs of books.

Not as such, no. There are fair use exceptions to copyright, and how
much of the material you have copied is one factor that's taken into
account when judging if it's fair use, but it's not a sufficient
factor on its own. There's no blanket allowance that allows you to
you copy fragments of a work otherwise under copyright.

Basically, there's a difference between quoting the first five
paragraphs of a book as part of a review of that book, and copying
them wholesale into the start of your own book.

--
Leif Roar Moldskred

rossum

unread,
May 18, 2012, 7:25:28 AM5/18/12
to
On Thu, 17 May 2012 15:09:23 +0200, "Skybuck Flying"
<Window...@DreamPC2006.com> wrote:

>It's a bit unlikely that two programmers make the exact same dumb mistake !
>;)
>
>So the funny part is, the bugs in it kinda prove that it was copied ! ;)
Common errors are often used as legal proof of copying. Many
encyclopaedias and directories include deliberate errors for just that
reason.

rossum

Joshua Cranmer

unread,
May 18, 2012, 8:08:09 AM5/18/12
to
On 5/18/2012 5:57 AM, Roedy Green wrote:
> On Thu, 17 May 2012 15:09:23 +0200, "Skybuck Flying"
> <Window...@DreamPC2006.com> wrote, quoted or indirectly quoted
> someone who said :
>
>> So this code seems highly buggy and does somewhat prove that it was copied
>
> Even if it were, so what. Every time you write a sentence you copy
> words from a dictionary. Copying should only apply to complete works.
> You are allowed to copy paragraphs of books. So it seems to be
> partial methods should be fair game.

Uh, no. Copyright law can potentially apply to even a mere fragment of a
sentence (although, in exceptionally small fragments, it is effectively
impossible to actually enforce copyright). At least in US law, this is a
notion of fair use which basically amounts to "you can copy
small-to-substantial portions of a piece of work if you're not
'intending' to replace it" (note: this is a very footloose summary and
not expert legal advice. Please consult the US code before attempting to
cite this in defense in court).

Noob

unread,
May 18, 2012, 11:08:41 AM5/18/12
to
Joshua Cranmer wrote:

> It's a private method in java.util.Arrays, which is why the API does
> not list it. If you actually read the code you'd posted, you would
> have realized that.

Dear Joshua,

Sane people have kill-filed "Skybuck Flying" so long ago that
they don't remember whether they used a computer or an abacus
to set up the kill file.

Regards.

Gene Wirchenko

unread,
May 18, 2012, 1:46:22 PM5/18/12
to
On Fri, 18 May 2012 12:25:28 +0100, rossum <ross...@coldmail.com>
wrote:

>On Thu, 17 May 2012 15:09:23 +0200, "Skybuck Flying"
><Window...@DreamPC2006.com> wrote:
>
>>It's a bit unlikely that two programmers make the exact same dumb mistake !
>>;)

It happens so often that we have a name for it. It is called an
off-by-one error or a fencepost error. OK, *two* names.

>>So the funny part is, the bugs in it kinda prove that it was copied ! ;)
>Common errors are often used as legal proof of copying. Many
>encyclopaedias and directories include deliberate errors for just that
>reason.

Maps, too. I once got a bit lost before I realised that the road
I was looking for did not exist.

Sincerely,

Gene Wirchenko

Skybuck Flying

unread,
May 19, 2012, 2:18:53 PM5/19/12
to


"Joshua Cranmer" wrote in message news:jp48rq$6s8$1...@dont-email.me...

On 5/17/2012 7:18 PM, Skybuck Flying wrote:
> There is no "rangeCheck" function for java.util.Arrays:
>
> http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html
>
> To me it appears as if rangeCheck is some low level operating system
> code or memory management code to try and prevent the os or applications
> from crashing or exploits from taking over the system.

"
It's a private method in java.util.Arrays, which is why the API does not
list it. If you actually read the code you'd posted, you would have
realized that.
"

Nonsense, this code could have come from anywhere.

There is no proof that this came from any api at all.

I have yet to see any proof from the court case that this is actually from
java.util.Arrays.

The only thing hinting that it might be a private method is the static
keyword, well excuse me for not being a java expert ;)

Bye,
Skybuck.

Skybuck Flying

unread,
May 19, 2012, 2:21:53 PM5/19/12
to
Anyway the court case seems to be about "copyrightable api".

If this is actually a private method then I don't see how that's relevant...
since it's not part of the actually published api ! ;)

Bye,
Skybuck.

Skybuck Flying

unread,
May 19, 2012, 2:52:50 PM5/19/12
to
Hmm.. I saw some document stating: "motion for rangeCheck denied" or
something... so it seems to be resolved already at least the law matter ;)


Bye,
Skybuck.

Skybuck Flying

unread,
May 19, 2012, 2:53:56 PM5/19/12
to


"Noob" wrote in message news:jp5olq$bl2$1...@dont-email.me...
More trash from: A noiseless patient Spider

Skybuck Flying

unread,
May 19, 2012, 3:01:27 PM5/19/12
to


"Gene Wirchenko" wrote in message
news:1k2dr7527p5reqegf...@4ax.com...

On Fri, 18 May 2012 12:25:28 +0100, rossum <ross...@coldmail.com>
wrote:

>On Thu, 17 May 2012 15:09:23 +0200, "Skybuck Flying"
><Window...@DreamPC2006.com> wrote:
>
>>It's a bit unlikely that two programmers make the exact same dumb mistake
>>!
>>;)

"
It happens so often that we have a name for it. It is called an
off-by-one error or a fencepost error. OK, *two* names.
"

True "off by one" is a common mistake.

However in this case, assuming it was a mistake, both programmers would have
made the same mistake in exactly the same code, at exactly the same
position.

Now that's a bit unlikely isn't it ?! ;)

Mistakes with > or >= are usually random, and not at a fixed position.

>>So the funny part is, the bugs in it kinda prove that it was copied ! ;)
>Common errors are often used as legal proof of copying. Many
>encyclopaedias and directories include deliberate errors for just that
>reason.

"
Maps, too. I once got a bit lost before I realised that the road
I was looking for did not exist.
"

No comment.

Bye,
Skybuck ;) :)

Lew

unread,
May 19, 2012, 5:48:38 PM5/19/12
to
> keyword, well excuse me for not being a java [sic] expert ;)

Clearly not.

Or you wouldn't say things like "The only thing hinting that it might be a
private method is the static keyword". It doesn't hint that. But not being a
Java expert, perhaps you'd best withhold judgment as to what a certain Java
keyword hints. Applied to a method, it states (not hints) that the method
belongs to the class itself, not any particular instance thereof.

The source code is publicly available, and one can thus guess used in the
court case as one might discover should one dig deeply enough. If you had
wanted proof for yourself that the method is private, and if you really did
look at the publicly and easily discoverable source code, you would have found
the proof there, should you have so chosen and acted upon that choice, to the
devil with the court case.

Anyway, whether it's from the court case or not is irrelevant, since we're
responding to your personal judgment: "To me it appears as if rangeCheck is
some low level operating system code or memory management code ...". Your
respondents are doing you the courtesy of providing the information to inform
your judgment so that the doubt, trepidation and uncertainty of "To me it
appears" (which surely must create a yearning for true answers in your mind)
can be replaced with the confidence of "It is".

From the source for Java 7, Copyright 1997, 2011 by Oracle and cited here by
fair use for editorial purposes:

and I quote:

via copy and paste:

private static void rangeCheck(int length, int fromIndex, int toIndex) {

Hey, wait a doggone minute. Your original post quoted that very line. From the
court case, was it not?

How extensively did you read the court documents, and could you please link
your sources?

Your crossposts were utterly inane so I removed them. They won't mind, I'm sure.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Lew

unread,
May 19, 2012, 5:50:04 PM5/19/12
to
Skybuck Flying wrote:
> There is no "rangeCheck" function for java.util.Arrays:

Oh, really?

<http://www.docjar.com/html/api/java/util/Arrays.java.html>

You quoted it verbatim yourself in your first post.

Lew

unread,
May 19, 2012, 6:20:51 PM5/19/12
to
> Skybuck Flying wrote:
>> Joshua Cranmer wrote:
>>> Skybuck Flying wrote:
>>>> There is no "rangeCheck" function for java.util.Arrays:
>>>>
>>>> http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html
>>>>
>>>> To me it appears as if rangeCheck is some low level operating system
>>>> code or memory management code to try and prevent the os or applications
>>>> from crashing or exploits from taking over the system.
>>>
>> "
>>> It's a private method in java.util.Arrays, which is why the API does not
>>> list it. If you actually read the code you'd posted, you would have
>>> realized that.
>> "
>> Nonsense, this code could have come from anywhere.
>>
>> There is no proof that this came from any api [sic] at all.
>>
>> I have yet to see any proof from the court case that this is actually from
>> java.util.Arrays.

How about this, from the final instructions to the jury in the case:

"[Oracle's] technical expert Dr. Mitchell ... opined that rangeCheck, at
least, appeared on handsets, id. ¶ 240, though he never expressed any opinion
that it was important to handset functionality. The closest he came to
expressing any opinion that rangeCheck has any value were his opinions that
(1) rangeCheck was “qualitatively significant to” the Arrays.java file, ..."
<http://www.groklaw.net/articlebasic.php?story=20120516083919975>

The only reason you had "yet to see any proof from the court case that this is
actually from java.util.Arrays" is that you hadn't looked.

>> The only thing hinting that it might be a private method is the static
>> keyword, well excuse me for not being a java [sic] expert ;)

Did you notice the 'private' keyword? Did you not think that relevant to
whether it's a private method?

Lew

unread,
May 19, 2012, 6:35:10 PM5/19/12
to
On 05/19/2012 03:20 PM, Lew wrote:
>> Skybuck Flying wrote:
>>> Joshua Cranmer wrote:
>>>> Skybuck Flying wrote:
>>>>> There is no "rangeCheck" function for java.util.Arrays:
>>>>>
>>>>> http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html
>>>>>
>>>>> To me it appears as if rangeCheck is some low level operating system
>>>>> code or memory management code to try and prevent the os or applications
>>>>> from crashing or exploits from taking over the system.
>>>>
>>> "
>>>> It's a private method in java.util.Arrays, which is why the API does not
>>>> list it. If you actually read the code you'd posted, you would have
>>>> realized that.
>>> "
>>> Nonsense, this code could have come from anywhere.
>>>
>>> There is no proof that this came from any api [sic] at all.
>>>
>>> I have yet to see any proof from the court case that this is actually from
>>> java.util.Arrays.
>
> How about this, from the final instructions to the jury in the case:

Correction: It's from "GOOGLE’S BRIEF RE ORACLE’S FAILURE OF PROOF ON CAUSATION".

It all flows on the one page, nevertheless it's in the record for that court case.

Skybuck Flying

unread,
May 19, 2012, 3:19:33 PM5/19/12
to


"Noob" wrote in message news:jp5olq$bl2$1...@dont-email.me...

Can you please stop abusing my threads.

I think you are Jamie, I already asked you to stay out of my threads.

If you not Jamie, then I ask you as well, to stay out of my threads, because
you are wasting my time.

I come here to discuss technical matters and not personal or even legal
matters for that matter.

Bye,
Skybuck.

Daniel Pitts

unread,
May 19, 2012, 9:47:27 PM5/19/12
to
Skybuck, seriously *you're* the one that abuses threads. Perhaps if you
stopped and thought longer, you wouldn't need to reply to yourself
multiple times. Also, when most of the community expresses how you've
misinterpreted something, it might be a signal that you actually are
wrong. I know, strange that might happen, but sometimes it does.

Don't bother replying to this, I'm not interested in a troll fest.

Skybuck Flying

unread,
May 20, 2012, 11:53:27 AM5/20/12
to


"glen herrmannsfeldt" wrote in message
news:jp3g9r$v22$1...@speranza.aioe.org...

In comp.lang.java.programmer Skybuck Flying <Window...@dreampc2006.com>
wrote:

(snip)

>>> if (fromIndex < 0)
>>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>>> if (toIndex > arrayLen)
>>> throw new ArrayIndexOutOfBoundsException(toIndex);


(snip, someone else wrote)

>> I believe it is checking whether the range fromIndex, fromIndex+1, ...,
>> toIndex-1 -- i.e., a range given as the first index and one past the
>> last index, not an uncommon practice -- is within the array, in which
>> case it has no bugs. (toIndex may legally equal the length of the array
>> when the range extends to the last element, and requiring the range to
>> be specified "the right way around" is not especially perverse.)
>> "

> It's simply not valid. Out of bounds has a very clear meaning
> in programming practice. It's either within bounds or it's not.

But this isn't "programming" it is Java, and Java can do it however
it wants to.

> The bounds of a java array are very clearly defined. Thus the
> only logical conclusion is that the code is simply bugged.
> Either in logic or in description. Either change the
> exception-description or fix the code.

"
Look at the definition of the substring method in String class.
"

String might/could be an exception, but me not interested in strings so
much.

"
It avoids a lot of -1 by the programmer to define it this way.
(Along with consistently starting indexing at zero.)
"

The -1 is what keep programs correct. It's the lack of -1 that will
ultimately lead to bugs, confusion and problems ! ;) :)

Not to mention wrong ranges ! ;)

Learn to use -1 consistently and all will be fine ! ;) :) =D

Bye,
Skybuck.

Skybuck Flying

unread,
May 20, 2012, 11:55:52 AM5/20/12
to


"Daniel Pitts" wrote in message news:Q2Ytr.22260$TC4....@newsfe14.iad...
We were having a nice discussion, no need to start asking people to kill
file me.

It was interesting/educational for everybody I think ! ;) =D

It has shed some led on short comings with java and c++ and ranges for some
! ;)

Bye,
Skybuck.

Message has been deleted

Arne Vajhøj

unread,
May 20, 2012, 2:41:23 PM5/20/12
to
On 5/17/2012 11:26 AM, Skybuck Flying wrote:
> "Fred K" wrote in message
> news:29308868.1994.1337265697084.JavaMail.geo-discussion-forums@pbcuc6...
> On Thursday, May 17, 2012 6:09:23 AM UTC-7, Skybuck Flying wrote:
>> Hello,
>>
>> My hypothesis that a human being cannot write 10 lines of code without
>> making a mistake has been confirmed by either oracle or google or both
>> depending on what you believe ;)
>>
>> The lawsuit apperently mentions these 9 lines of code:
>>
>> "
>> private static void rangeCheck(int arrayLen, int fromIndex, int
>> toIndex) {
>> if (fromIndex > toIndex)
>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>> ") > toIndex(" + toIndex+")");
>
> "
> This is not C.
> "
>
> It's a curly brace language

That does not make it C.

Arne

Arne Vajhøj

unread,
May 20, 2012, 2:46:40 PM5/20/12
to
On 5/18/2012 5:57 AM, Roedy Green wrote:
> On Thu, 17 May 2012 15:09:23 +0200, "Skybuck Flying"
> <Window...@DreamPC2006.com> wrote, quoted or indirectly quoted
> someone who said :
>> So this code seems highly buggy and does somewhat prove that it was copied
>
> Even if it were, so what. Every time you write a sentence you copy
> words from a dictionary. Copying should only apply to complete works.
> You are allowed to copy paragraphs of books. So it seems to be
> partial methods should be fair game.

That is not how copyright works.

Arne

Arne Vajhøj

unread,
May 20, 2012, 3:06:14 PM5/20/12
to
On 5/17/2012 1:11 PM, markspace wrote:
> The internet: it's like an assembly factory for idiots.

I would put it as: the knowledge required to post something
to the internet is not sufficient to guarantee that it is
worth reading.

Arne


Arne Vajhøj

unread,
May 20, 2012, 6:10:27 PM5/20/12
to
On 5/17/2012 9:09 AM, Skybuck Flying wrote:
> My hypothesis that a human being cannot write 10 lines of code without
> making a mistake has been confirmed by either oracle or google or both
> depending on what you believe ;)
>
> The lawsuit apperently mentions these 9 lines of code:
>
> "
> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
> if (fromIndex > toIndex)
> throw new IllegalArgumentException("fromIndex(" + fromIndex +
> ") > toIndex(" + toIndex+")");
> if (fromIndex < 0)
> throw new ArrayIndexOutOfBoundsException(fromIndex);
> if (toIndex > arrayLen)
> throw new ArrayIndexOutOfBoundsException(toIndex);
> }
> "
>
> There is at least 1 major bug in it:
>
> toIndex could equal arrayLen which would still be out of bounds assuming
> zero-index-based arrays.
>
> So for example if the array length is 100, then toIndex is valid for
> range 0 to 99.
>
> And therefore the exception should be raised for equalness to arrayLen
> as well.
>
> So the correct code should probably have been ">=" instead of just ">".
>
> Except if some special outside code assumes that it's ok... I don't know
> where this routine is being used... but by itself it would be flawed.
>
> Also fromIndex could also still go out of range past arrayLen this is
> also not checked.
>
> So this code seems highly buggy and does somewhat prove that it was
> copied ?!
>
> It's a bit unlikely that two programmers make the exact same dumb
> mistake ! ;)

The definition of a bug in code is when the code does not
do what it is supposed to do.

In this case the code does exactly what it is supposed to do
(according to the documentation).

So no bug.

May I suggest that you try reading the docs for a method
so you know what it is supposed to do before you claim that it
contains a bug.

Arne

t

Arne Vajhøj

unread,
May 20, 2012, 6:12:33 PM5/20/12
to
On 5/17/2012 11:26 AM, Skybuck Flying wrote:
> This code is a nice example oh how not to program.
>
> Apperently only a skilled coder/debugger like me seems to be able to
> spot the fallacies in this way too debug-complex code.

You mean that only a complete clueless coder/debugger
would claim some code contains a bug without reading
the documentation for how it should work.

Arne

Arne Vajhøj

unread,
May 20, 2012, 6:14:16 PM5/20/12
to
On 5/17/2012 5:25 PM, Skybuck Flying wrote:
> Not really,
>
> Programmers of all languages must be able to communicate with each other
> through common language and concepts.
>
> One such concept is "range".
>
> It's pretty clearly defined:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
>
> Any computer language deviating from the standard/common meaning of
> range should clearly state so.
>
> Any code deviating from the standard/coming meaning of range should
> clearly state so.

It does!

You just chose not to read it!

> Fortunately for us the code is available, but this is not always the
> case in other programming languages like C where sometimes only headers
> are available.

C function also has documentation.

And unlike you most C programmers will probably read it.

Arne

Arne Vajhøj

unread,
May 20, 2012, 6:21:07 PM5/20/12
to
On 5/17/2012 7:18 PM, Skybuck Flying wrote:
> There is no "rangeCheck" function for java.util.Arrays:
>
> http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html

That only shows public methods.

And the code snippet said private.

So ...

> To me it appears as if rangeCheck is some low level operating system
> code or memory management code to try and prevent the os or applications
> from crashing or exploits from taking over the system.

Th JVM does that fine without this check.


> Almost seems like a deliberate design to make java programs crash...
> perhaps a nice test for the "sand boxing" which after many years has
> proven to be a failure, google for java exploits ;)
>
> One of the reasons why java will not be installed onto my computers now
> and in the future.
>
> Seeing these functions only re-assures me of my decision to do so.

Maybe you should learn:
* the difference between an app and an applet
* the differnce between crash and throwing an exception

Arne


Arne Vajhøj

unread,
May 20, 2012, 6:23:26 PM5/20/12
to
On 5/17/2012 7:18 PM, Skybuck Flying wrote:
> It would be interesting to know where this "rangeCheck" function is from.

http://www.theverge.com/2012/4/19/2961128/google-chief-java-architect-likely-i-copied-sun-code-in-android

explains that.

Arne

Arne Vajhøj

unread,
May 20, 2012, 6:25:16 PM5/20/12
to
On 5/19/2012 2:18 PM, Skybuck Flying wrote:
> Nonsense, this code could have come from anywhere.
>
> There is no proof that this came from any api at all.
>
> I have yet to see any proof from the court case that this is actually
> from java.util.Arrays.

That has been clearly proven in court.

And the source for Arrays.java is available, so you can check
if you think someone lied in court.

> The only thing hinting that it might be a private method is the static
> keyword, well excuse me for not being a java expert ;)

SO you dot think the presence of the private keyword indicates that
it is private?

Interesting!

Arne

Arne Vajhøj

unread,
May 20, 2012, 6:27:11 PM5/20/12
to
No.

The trial was about 3 things:
A) patent violation
B) copyright violations in some specific code
C) copyright violation due to using Java API

This code snippet was part of B.

C is what is generally considered most interesting.

Arne


Arne Vajhøj

unread,
May 20, 2012, 6:30:05 PM5/20/12
to
On 5/20/2012 12:24 PM, Stefan Ram wrote:
> "Skybuck Flying"<Window...@DreamPC2006.com> writes:
>> But this isn't "programming" it is Java, and Java can do it however
>> it wants to.
>
> Yes. But it is not only Java, it also is English used for
> mnemonic identifiers. And in English, phrases like »from
> index« and »to index« have a meaning.
>
> So, if one would name a parameter »maximum« and then specify
> this to mean the maximum plus 1, it would be a bad name.

bad name != bug

especially if it is documented.

Heikki posted the Java docs in another post:

/**
* Checks that fromIndex and toIndex are in range, and throws an
* appropriate exception if they aren't.
*
* @param arrayLen the length of the array
* @param fromIndex the index of the first element of the range
* @param toIndex the index after the last element of the range
* @throws IllegalArgumentException if fromIndex > toIndex
* @throws ArrayIndexOutOfBoundsException if fromIndex < 0
* or toIndex > arrayLen
*/

It is pretty clear how toIndex should be used even with
that name.

Arne

Arne Vajhøj

unread,
May 20, 2012, 6:32:34 PM5/20/12
to
On 5/17/2012 5:16 PM, Skybuck Flying wrote:
> Now it's becoming a computer programming language issue.
>
> What is the definition of "range".
>
> You cannot simply redefine the meaning of "range". As you did by writing
> "inclusive" and then "exclusive" and flipping flopping whenever it suits
> you.
>
> The programming language known as C probably introduced the "curly brace
> language".
>
> Java is based on C and also uses the "curly brace language".
>
> Since Java seems to be based of off C and is actually implemented in C
> it's safe to say that the word known as "range" in computer language
> follows the same meaning as it has in C.
>
> Wikipedia is pretty clear about what "range" means in the programming
> language C:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
>
> Range is always inclusive unless otherwise stated.

But it was otherwise stated in the Java docs, so ....

> Therefore a programmer seeing a prototype of "rangeCheck" without
> actually seeing the body of the code should be safe to assume that range
> encompanses all of the indexes, being inclusive.

A programmer would read the docs and understand what the code does.

Arne

Arne Vajhøj

unread,
May 20, 2012, 6:33:47 PM5/20/12
to
On 5/19/2012 3:01 PM, Skybuck Flying wrote:
> However in this case, assuming it was a mistake, both programmers would
> have made the same mistake in exactly the same code, at exactly the same
> position.
>
> Now that's a bit unlikely isn't it ?! ;)
>
> Mistakes with > or >= are usually random, and not at a fixed position.

But given that the code was correct, then your argumentation is
completely flawed.

Arne

Patricia Shanahan

unread,
May 20, 2012, 7:30:27 PM5/20/12
to
Moreover, the choice of a semi-open range was forced by the
long-established public interfaces.

The rangeCheck method looks like a case of taking a block of code that
would be very frequently repeated in a class and making it into a
private method. Doing it in such a way that every caller had to put "-1"
on one of the arguments would be very strange, and create an unnecessary
risk of mistakes.

Patricia

Keith Thompson

unread,
May 20, 2012, 7:38:09 PM5/20/12
to
Arne, years of experience have shown that arguing with "Skybuck Flying"
is a waste of time. Feel free to waste your time, but please don't
waste ours.

Thank you.

--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Lew

unread,
May 20, 2012, 9:52:26 PM5/20/12
to
Keith Thompson wrote:
> Arne Vajhøj writes:
>> Skybuck Flying wrote:
>>> This code is a nice example oh how not to program.
>>>
>>> Apperently only a skilled coder/debugger like me seems to be able to
>>> spot the fallacies in this way too debug-complex code.
>>
>> You mean that only a complete clueless coder/debugger
>> would claim some code contains a bug without reading
>> the documentation for how it should work.
>
> Arne, years of experience have shown that arguing with "Skybuck Flying"
> is a waste of time. Feel free to waste your time, but please don't
> waste ours.

How is he to know what wastes your time? That's a judgment only you can make.

He is free to post any response to any poster he chooses. If you don't wish to
"waste" your time, you don't have to read his responses to that poster. Any
decent newsreader will organize your view into conversations so that you will
know which of Arne's posts are likely to, in your own, personal, private
judgment, waste your time. It is not Arne's job to judge posts on your behalf,
nor your right to curtail his right to respond.

Keith Thompson

unread,
May 20, 2012, 10:21:31 PM5/20/12
to
Lew <no...@lewscanon.com> writes:
[...]
> It is not Arne's job to judge posts on your behalf,
> nor your right to curtail his right to respond.

I'm not curtailing anybody's right to do anything. I am *asking* someone
not to feed a troll. And with that, I'm done here.

Gene Wirchenko

unread,
May 20, 2012, 11:36:58 PM5/20/12
to
On Sun, 20 May 2012 16:30:27 -0700, Patricia Shanahan <pa...@acm.org>
wrote:

[snip]

>The rangeCheck method looks like a case of taking a block of code that
>would be very frequently repeated in a class and making it into a
>private method. Doing it in such a way that every caller had to put "-1"
>on one of the arguments would be very strange, and create an unnecessary
>risk of mistakes.

Like months in JavaScript dates. They are numbered 0-11, even in
output. It definitely holds the record with me for the stupidest bit
of language design I have ever seen.

An off-by-one error is a very common type of error. Designing a
system in such a way as to make them more likely is really stupid.

Sincerely,

Gene Wirchenko

Joe Pfeiffer

unread,
May 20, 2012, 11:46:28 PM5/20/12
to
Sadly, it seems every new person who encounters Skybuck feels the need
to respond to him for a while before finally learning his lesson. And
for reasons that escape me, trying to clue somebody in on what they can
expect is taken as being a Net Cop.

Gene Wirchenko

unread,
May 20, 2012, 11:48:10 PM5/20/12
to
On Sun, 20 May 2012 18:30:05 -0400, Arne Vajhøj <ar...@vajhoej.dk>
wrote:

>On 5/20/2012 12:24 PM, Stefan Ram wrote:
>> "Skybuck Flying"<Window...@DreamPC2006.com> writes:
>>> But this isn't "programming" it is Java, and Java can do it however
>>> it wants to.
>>
>> Yes. But it is not only Java, it also is English used for
>> mnemonic identifiers. And in English, phrases like »from
>> index« and »to index« have a meaning.
>>
>> So, if one would name a parameter »maximum« and then specify
>> this to mean the maximum plus 1, it would be a bad name.
>
>bad name != bug
>
>especially if it is documented.

Admitting to a mistake does not make it not a mistake.

[snip]

Sincerely,

Gene Wirchenko

Kaz Kylheku

unread,
May 21, 2012, 12:28:57 AM5/21/12
to
On 2012-05-21, Gene Wirchenko <ge...@ocis.net> wrote:
> Like months in JavaScript dates. They are numbered 0-11, even in
> output. It definitely holds the record with me for the stupidest bit
> of language design I have ever seen.

This might be deliberately compatible with the "tm_mon" field in the ISO C
"struct tm" type.

In its defence, it *is* apologetically called "broken down" time. :)

I may just repeat this mistake in the TXR language, because the impelmentation
language C, and doing it differently means inventing another way of
representing time, just for the heck of it, and then converting back and forth.

Lew

unread,
May 21, 2012, 3:04:20 AM5/21/12
to
Joe Pfeiffer wrote:
Keith didn't try to "clue somebody in", he asked Arne to stop posting because
he (Keith) claimed that Arne's responses were wasting his (Keith's) time.
There was nothing in Keith's message to suggest that he was offering advice to
benefit Arne. So your comment is not relevant.

If Keith had evinced any concern whatsoever for Arne, that would have been a
different story. Ditto you - I don't see you showing any concern for Arne
either, just whining about how people thing someone is a "Net Cop".

Furthermore, there are others who read the newsgroup who may benefit from
answers to Skyfreak, even if Skyfreak itself does not. So let Arne post what
he will. Please.

Kenny McCormack

unread,
May 21, 2012, 4:24:17 AM5/21/12
to
In article <lnehqej...@nuthaus.mib.org>,
Keith Thompson <ks...@mib.org> wrote:
>Lew <no...@lewscanon.com> writes:
>[...]
>> It is not Arne's job to judge posts on your
>behalf,
>> nor your right to curtail his right to respond.
>
>I'm not curtailing anybody's right to do anything. I am *asking* someone
>not to feed a troll. And with that, I'm done here.

Don't let the door hit your ass as you go.

Keith - you have to accept that, as the undisputed leader of this group,
when you "ask" someone not to do something, it carries significant weight.
It has the effect of being a ruling from on high. Whether you intend so or
not, the fact is that people fall in line with your wishes.

--
"The anti-regulation business ethos is based on the charmingly naive notion
that people will not do unspeakable things for money." - Dana Carpender

Quoted by Paul Ciszek (pciszek at panix dot com). But what I want to know
is why is this diet/low-carb food author doing making pithy political/economic
statements?

Nevertheless, the above quote is dead-on, because, the thing is - business
in one breath tells us they don't need to be regulated (which is to say:
that they can morally self-regulate), then in the next breath tells us that
corporations are amoral entities which have no obligations to anyone except
their officers and shareholders, then in the next breath they tell us they
don't need to be regulated (that they can morally self-regulate) ...

Kenny McCormack

unread,
May 21, 2012, 4:25:49 AM5/21/12
to
Well said, sir!

Pretty much Usenet 101 stuff, but you are to be commended for speaking truth
to power.

--

First of all, I do not appreciate your playing stupid here at all.

- Thomas 'PointedEars' Lahn -

Skybuck Flying

unread,
May 21, 2012, 3:36:54 AM5/21/12
to


"Arne Vajhøj" wrote in message
news:4fb96cb9$0$283$1472...@news.sunsite.dk...

On 5/17/2012 5:25 PM, Skybuck Flying wrote:
> Not really,
>
> Programmers of all languages must be able to communicate with each other
> through common language and concepts.
>
> One such concept is "range".
>
> It's pretty clearly defined:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
>
> Any computer language deviating from the standard/common meaning of
> range should clearly state so.
>
> Any code deviating from the standard/coming meaning of range should
> clearly state so.

"
It does!
"

No not really, not from that code snippet.

"
You just chose not to read it!
"

No, the only code available is what I posted.

> Fortunately for us the code is available, but this is not always the
> case in other programming languages like C where sometimes only headers
> are available.

"
C function also has documentation.

And unlike you most C programmers will probably read it.

Arne
"

This code snippet came without any documentation.

If the body wasn't present then it would be unclear to what the range would
be.

Only a java expert/experienced programmer might know this odd range
behaviour.

Plenty of other programming language do not follow this odd range behaviour
as well as general math.

Bye,
Skybuck.

Skybuck Flying

unread,
May 21, 2012, 3:46:43 AM5/21/12
to


"Arne Vajhøj" wrote in message
news:4fb96c52$0$283$1472...@news.sunsite.dk...
No my remarks were remarks aimed at general coding practices. It was about
creating unnecessary branch dependencies.

The more dependencies a piece of code has the harder it becomes to debug or
even modify it.

The phenomenon of: "changing something here, and something else somewhere
else breaks" <- this is caused by dependencies.

Less dependencies make code easier to debug, easier to garantuee that it
will work, and easier to modify/keep it flexible.

Furthermore I suspect C/C++ programmers have less time to debug because of
slow compilers, so they less experienced with it, don't care, "bill gates
don't care" and see it as a chore, thus they fail to learn what their coding
practices/dependencies are causing... : a big, buggy, complex, inflexible
mess ;) :)

Bye,
Skybuck.






Skybuck Flying

unread,
May 21, 2012, 3:49:49 AM5/21/12
to


"Patricia Shanahan" wrote in message
news:SI6dnZCFWN4L4yTS...@earthlink.com...
Big nonsense, -1 is necessary to keep the range valid. By not applieing -1
it introduces wrong ranges from a mathematical point of view, thus this will
ultimately lead to buggy programs.

Bye,
Skybuck.


Skybuck Flying

unread,
May 21, 2012, 3:55:11 AM5/21/12
to


"Gene Wirchenko" wrote in message
news:6tdjr75l3ak05u77v...@4ax.com...
This makes sense if one wants to calculate with months for example:

A user gives 13 as the number of months that passed.

Not the question is how many years past and at what month are we ?

years: 13 / 12 = 1 year has passed
remaining months: 13 % 12 = 1 month has passed.

Correct answer is we are now in february, since january already elapsed.

Had it started at 1, your software would have been wrong believe it to be
january=1.
While now january=0 and february=1

Bye,
Skybuck.

Skybuck Flying

unread,
May 21, 2012, 4:00:19 AM5/21/12
to


"Arne Vajhøj" wrote in message
news:4fb96bd5$0$283$1472...@news.sunsite.dk...
No not really, just because the documentation says that "red is now blue"
doesn't make it alright.

There are certain concepts such as range which non-java programmers are used
too.

If java wants to be taken seriously by me then it better take concepts like
range seriously.

I don't take java seriously.

Bye,
Skybuck.

Skybuck Flying

unread,
May 21, 2012, 3:40:25 AM5/21/12
to


"Arne Vajhøj" wrote in message
news:4fb97103$0$293$1472...@news.sunsite.dk...

On 5/17/2012 5:16 PM, Skybuck Flying wrote:
> Now it's becoming a computer programming language issue.
>
> What is the definition of "range".
>
> You cannot simply redefine the meaning of "range". As you did by writing
> "inclusive" and then "exclusive" and flipping flopping whenever it suits
> you.
>
> The programming language known as C probably introduced the "curly brace
> language".
>
> Java is based on C and also uses the "curly brace language".
>
> Since Java seems to be based of off C and is actually implemented in C
> it's safe to say that the word known as "range" in computer language
> follows the same meaning as it has in C.
>
> Wikipedia is pretty clear about what "range" means in the programming
> language C:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
>
> Range is always inclusive unless otherwise stated.

"
But it was otherwise stated in the Java docs, so ....
"

It would be weird to expect a programmer to read a document about something
as common and obvious as "range".

It's like programming a method called "Red" and then in the document it
says: "Red is actually blue".

> Therefore a programmer seeing a prototype of "rangeCheck" without
> actually seeing the body of the code should be safe to assume that range
> encompanses all of the indexes, being inclusive.

"
A programmer would read the docs and understand what the code does.

Arne
"

Not necessarily, only if the programmer was being very thorough and has the
time to do so.

The programmer might skip over things which he/she thinks are obvious.

Bye,
Skybuck.

Skybuck Flying

unread,
May 21, 2012, 4:45:20 AM5/21/12
to


"Arne Vajhøj" wrote in message
news:4fb9714c$0$293$1472...@news.sunsite.dk...
Depends on your points of view.

Anyway it also depends on how the code and documentation was constructed.

Usually programmers write code first and then document it. Sometimes there
might also be a design plan.

But when it comes to APIs and function prototypes it's save to say that the
documentation comes after the code has been written.

So one possible scenerio could have been:

1. The (flawed) code was written.

2. The (flawed) code was used, lot's of other code starts depending on it.

3. The bug was found, but instead of fixing it (and potentially breaking
apps), the documentation was changed to "document the bug".

Another possible scenerio could have been that it was by design ;)

Bye,
Skybuck.






Skybuck Flying

unread,
May 21, 2012, 5:13:25 AM5/21/12
to
It's time to dive into the versioning of java.

But let's start with something easy, something which will put this to rest:

It's time I copy & paste some documentation as well, illustrating my
arguments:

http://docs.oracle.com/javase/1.3/docs/api/index.html

"
public class ArrayIndexOutOfBoundsException
extends IndexOutOfBoundsException

Thrown to indicate that an array has been accessed with an illegal index.
The index is either negative or greater than or equal to the size of the
array.
"

This clearly states that one may expect this particular exception to be
raised for indexes which equal the size of the array.

Thus expecting a rangeCheck function which raises this exception to obey
these rules makes sense, yet it does not.

Bye,
Skybuck.


Skybuck Flying

unread,
May 21, 2012, 5:19:19 AM5/21/12
to
Furthermore the code which is claimed to be from java.utils.Arrays has the
following description for the documentation:

"
This class contains various methods for manipulating arrays (such as sorting
and searching). It also contains a static factory that allows arrays to be
viewed as lists.
The documentation for the sorting and searching methods contained in this
class includes briefs description of the implementations. Such descriptions
should be regarded as implementation notes, rather than parts of the
specification. Implementors should feel free to substitute other algorithms,
so long as the specification itself is adhered to. (For example, the
algorithm used by sort(Object[]) does not have to be a mergesort, but it
does have to be stable.)

"

It pretty clearly states that this documentation is a "description" of the
implementation, and not a technical design.

Therefore it is possible that the implementation is flawed and the
documentation simply documents this flaw.

Furthermore this java.utils.Arrays file doesn't seem to important.

Funny to see that all my hunches are being backed up by facts.

Bye,

Skybuck.


Joshua Cranmer

unread,
May 21, 2012, 10:05:02 AM5/21/12
to
On 5/21/2012 3:40 AM, Skybuck Flying wrote:
> Not necessarily, only if the programmer was being very thorough and has
> the time to do so.
>
> The programmer might skip over things which he/she thinks are obvious.

Ranges having an inclusive start and an exclusive end are the most
common type of range in languages with 0-based arrays.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Joshua Cranmer

unread,
May 21, 2012, 10:08:40 AM5/21/12
to
On 5/21/2012 3:49 AM, Skybuck Flying wrote:
> Big nonsense, -1 is necessary to keep the range valid. By not applieing
> -1 it introduces wrong ranges from a mathematical point of view, thus
> this will ultimately lead to buggy programs.

I recall one of my programming books pointing out that just because it's
correct in a mathematics sense doesn't mean it's correct in a
programming sense.

Joshua Cranmer

unread,
May 21, 2012, 10:10:35 AM5/21/12
to
On 5/21/2012 4:00 AM, Skybuck Flying wrote:
> No not really, just because the documentation says that "red is now
> blue" doesn't make it alright.
>
> There are certain concepts such as range which non-java programmers are
> used too.
>
> If java wants to be taken seriously by me then it better take concepts
> like range seriously.
>
> I don't take java seriously.

And now I expect you're going to whine that since floating point
arithmetic isn't associative, any language that implements floating
point can't be taken seriously. Despite this being an extremely
long-standing, well-held convention.

bugbear

unread,
May 21, 2012, 12:12:28 PM5/21/12
to
Skybuck Flying wrote:

>
> The only thing hinting that it might be a private method is the static keyword, well excuse me for not being a java expert ;)

You might want to stop making a fool of
yourself by commenting in ignorance.

BugBear

Lew

unread,
May 21, 2012, 2:40:01 PM5/21/12
to
Skybuck Flying wrote:
> Furthermore the code which is claimed to be from java.utils.Arrays has the
> following description for the documentation:
>
> "
> This class contains various methods for manipulating arrays (such as sorting
> and searching). It also contains a static factory that allows arrays to be
> viewed as lists.
> The documentation for the sorting and searching methods contained in this
> class includes briefs description of the implementations. Such descriptions
> should be regarded as implementation notes, rather than parts of the
> specification. Implementors should feel free to substitute other algorithms,
> so long as the specification itself is adhered to. (For example, the
> algorithm used by sort(Object[]) does not have to be a mergesort, but it
> does have to be stable.)
>
> "
>
> It pretty clearly states that this documentation is a "description" of the
> implementation, and not a technical design.

Wrong documentation. You want this comment:
/**
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an appropriate exception, if they aren't.
*/

What did you think you were demonstrating?

> Therefore it is possible that the implementation is flawed and the
> documentation simply documents this flaw.

Except that the implementation in question isn't flawed, so it's not possible.

Furthermore your "logic" doesn't demonstrate your conclusion anyway.

> Furthermore this java.utils.Arrays [sic] file doesn't seem to [sic] important.

There is no such file in the Java API. And the usual terminology is t"class",
since the fact that the bytecode is read from a file doesn't signify.

> Funny to see that all my hunches are being backed up by facts.

Not one of the claims, "hunches" or conclusions you've presented here have
been correct, backed up by facts, or even well supported. Of which hunches
do you speak?

--
Lew

Edward A. Falk

unread,
May 23, 2012, 1:40:05 AM5/23/12
to
In article <b3f1b$4fb4f87c$5419acc3$14...@cache60.multikabel.net>,
Skybuck Flying <Window...@DreamPC2006.com> wrote:
>
>"
>private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
> if (fromIndex > toIndex)
> throw new IllegalArgumentException("fromIndex(" + fromIndex +
> ") > toIndex(" + toIndex+")");
> if (fromIndex < 0)
> throw new ArrayIndexOutOfBoundsException(fromIndex);
> if (toIndex > arrayLen)
> throw new ArrayIndexOutOfBoundsException(toIndex);
>}
>"

Executive summary: If the indices here are used as [fromIndex toIndex) --
that is, inclusive-exclusive -- as is often the custom, *and* a
zero-length range is permitted, then this code is correct as written.

Plus, if this was a commonly-used code fragment, any error would have
turned up long ago.

Finally, the keyword "private" means that this function is unavailable
outside of the file that defines it. There would be no reason to document
it. There would also be no reason to hold it to any standard other than
that it perform the specific function for which it was intended. Without
seeing the functions or methods that call it, there's really no true way
to know if it's buggy or not.

--
-Ed Falk, fa...@despams.r.us.com
http://thespamdiaries.blogspot.com/
Message has been deleted

Willem

unread,
May 23, 2012, 5:43:36 AM5/23/12
to
Stefan Ram wrote:
) Yes. But it is not only Java, it also is English used for
) mnemonic identifiers. And in English, phrases like ?from
) index? and ?to index? have a meaning.
)
) So, if one would name a parameter ?maximum? and then specify
) this to mean the maximum plus 1, it would be a bad name.
)
) For example, we can read:
)
) ?The left and right edges of the rectangle are at x and x + width.
) The top and bottom edges are at y and y + height.?
)
) http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawRect(int, int, int, int)
)
) Now, let's take this ?width? to be 1, and x to be 3,
) y = 5, height = 3, we have the following rectangle
) drawn according to the documentation:
)
) 9
) 8 ##
) 7 ##
) 6 ##
) 5 ##
) 4
) 3
) 2
) 1
) 0123456789
)
) When one looks at this rectangle, would one say that its
) width was 1 and its height was 3? Yet this is the way the
) parameters are named!

One would, if one were to define a 'line' to be centered on the pixel.
You seem to define it to be on the edge of the pixel. Both are plausible.

Look at this, for example:
10
9 +---+---+
8 | | |
7 | | |
6 | | |
5 +---+---+
4 | | |
3 | | |
2 | | |
1 +---+---+
0
0123456789

Is it four 4x4 rectangles that together form an 8x8 rectangle,
or is it four 5x5 rectangles that form a 9x9 rectangle?
The latter would be odd, given that 5+5=10 (and not 9).

And once you get into transforming coordinates, anti-aliasing
and whatnot, your definition falls flat on its face.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Message has been deleted
Message has been deleted

Willem

unread,
May 23, 2012, 7:07:09 AM5/23/12
to
Stefan Ram wrote:
) Willem <wil...@toad.stack.nl> writes:
)>And once you get into transforming coordinates, anti-aliasing
)>and whatnot, your definition falls flat on its face.
)
) I do not know what the wording ?your definition? above
) refers to. So, maybe, you could give this definition and
) then show how it ?falls flat on its face? when
) ?transforming coordinates?.

Then you should read my post again. Especially the bits you snipped,
and specifically the bit with the phrase 'you seem to define it ...'.

Willem

unread,
May 23, 2012, 7:11:45 AM5/23/12
to
Stefan Ram wrote:
) Willem <wil...@toad.stack.nl> writes:
)>And once you get into transforming coordinates, anti-aliasing
)>and whatnot, your definition falls flat on its face.
)
) ?An integer interval that has a finite lower or
) upper endpoint always includes that endpoint.?
)
) http://en.wikipedia.org/wiki/Interval_(mathematics)#Integer_intervals

So?

Supose I build a straight fence on the edge of my field, with posts at 1
meter intervals. The fence is 10 posts wide.
Now, I want to build a similar fence (with the same interval) on the edge
of my other field, which is twice as long. How many posts should I use?

(Why is this relevant: In this example, I'm transforming the coordinates,
scaling up by a factor of 2).
Message has been deleted

Jim Janney

unread,
May 23, 2012, 10:46:57 AM5/23/12
to
The complete code is available for inspection: it's distributed with
every copy of the JDK, and can also be found on the web at many places,
for example:

http://cr.openjdk.java.net/~martin/webrevs/openjdk7/timsort/src/share/classes/java/util/TimSort.java.html

And as has been pointed out before, the function *is* documented and the
implementation matches its contract exactly.

It's not a bug. Period.

--
Jim Janney

Willem

unread,
May 23, 2012, 11:42:24 AM5/23/12
to
Stefan Ram wrote:
) Willem <wil...@toad.stack.nl> writes:
)>Then you should read my post again. Especially the bits you snipped,
)>and specifically the bit with the phrase 'you seem to define it ...'.
)
) Ok, this was not a definition given by me, so the rest does not apply.

Obviously you're just here to "win" arguments instead of having an actual
discussion. Grow up.

Bill Leary

unread,
May 23, 2012, 2:34:58 PM5/23/12
to
"Kenny McCormack" wrote in message news:jpcu3h$622$2...@news.xmission.com...
> Keith - you have to accept that, as the undisputed leader of this group,

I'll dispute that. I've never considered him (or anyone else) to be "the
leader." And still don't.

I'm sure you meant comp.lang.c, but one might be inclined to ask "which
group." I note there are three on the "Newsgroups..." line of my reader.

> when you "ask" someone not to do something, it carries significant weight.

On issues related to C, I'll grant you this is probably true.

> It has the effect of being a ruling from on high. Whether you intend so
> or
> not, the fact is that people fall in line with your wishes.

But no, I never felt any impulse to "fall in line" with his wishes.

- Bill

Skybuck Flying

unread,
May 24, 2012, 8:03:00 AM5/24/12
to


"Edward A. Falk" wrote in message news:jpht7l$vnj$2...@blue-new.rahul.net...
Just out of curiosity, if private already means it's private, then what does
the static keyword mean ?

I guess it means the same as a class method in Delphi, which means it's
defined only once and all classes share it ?!?

This might have to do with "virtual method tables" which java might be using
?!? In this case a virtual method entry would be missing to save memory ???

Bye,
Skybuck.

It is loading more messages.
0 new messages