Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Binary Search Date: Wed, 06 Apr 2011 15:24:46 -0400 Organization: albasani.net Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net ffF76HAJM9GjfOy5j/uEtgnAfCgxe0CZmJylfEUpi3QA8+mHdBj9413fkDz2xMH92A3q3mA8WlhHGmg7I/H/1g== NNTP-Posting-Date: Wed, 6 Apr 2011 19:24:46 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="wm7v4vZ+BymrdMQcRW5tLHotc3I+5PuOLYAiDFDti/l62fcGqG+NtEKWdSE65+njhdgHEESE8j32VZtnYQjJpXiBUekuYp03p8HFFJpy3KuI3/ANgHFQCnjdH4+Hj6kw"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: Cancel-Lock: sha1:+TvY6kwTq1DoNDdN9HIjkN+82XU= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2901 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