Re: Binary Search
Mike Schilling wrote:
Fair point. This was simpler before generics, when the Comparator could accept
either K's [sic] or T's [sic] :-)
Without further consideration I won't yet claim this is one of those times,
but sometimes simpler is not better.
The generics notion, with which I agree but others might not, is that the
complexity of generics buys you locked-down type assertions.
In the simpler way, you compare Ts and Ks willy-nilly, without really saying
so. Sure it works, but it's hidden.
With generics, you have to show the type relationship explicitly. This seems
consistent with Java's policy of dragging out every possible elucidation of
your algorithm, data structures and type structures at compile time without
regard for index-finger RMI. This is supposed to be good, both documenting
and enforcing the type analysis.
But the downside is that rigorous, explicit, very-carefully-thought-out and
thorough analysis is hard work. Work that professionals do anyway. Tough
programmers, tough on bugs. Hoo-rah!
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg