Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: proper use of .java files (layout) Date: Tue, 18 Dec 2012 21:07:22 -0500 Organization: A noiseless patient Spider Lines: 82 Message-ID: References: <20fa5c05-6fcc-47ed-9e80-a44975887928@googlegroups.com> <50cfcd0b$0$293$14726298@news.sunsite.dk> <50cfd4b9$0$295$14726298@news.sunsite.dk> <50d1144b$0$290$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 19 Dec 2012 02:07:26 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="ffb8f7085759b339c1002252b48331a4"; logging-data="4765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JSceFTnTSKQMAaCxOAed0" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <50d1144b$0$290$14726298@news.sunsite.dk> Cancel-Lock: sha1:pAWBKyKfGJyNtXJqWnnPAPy5PjM= Xref: csiph.com comp.lang.java.programmer:20505 On 12/18/2012 8:11 PM, Arne Vajhøj wrote: > On 12/18/2012 1:49 PM, Eric Sosman wrote: >> On 12/18/2012 12:23 PM, Patricia Shanahan wrote: >>> On 12/18/2012 9:13 AM, Gene Wirchenko wrote: >>>> On Tue, 18 Dec 2012 08:53:58 -0500, Eric Sosman >>>> wrote: >>>> >>>>> On 12/18/2012 12:10 AM, Gene Wirchenko wrote: >>>> >>>> [snip] >>>> >>>>>> And how would you handle the aces? >>>>>> >>>>>> A-6-4-3-2 is ace high, but A-5-4-3-2 is actually 5-4-3-2-A (a >>>>>> five-high straight). >>>>> >>>>> In some "high-low" games, A-5-4-3-2 can be both a >>>>> five-high straight *and* an Ace with four low cards, >>>>> possibly winning both the "high" and "low" shares of >>>>> the pot. >>>> >>>> Right. I have rarely ever played high-low and forgot about them. >>>> Does anyone else have an exception to ambush us with? >>> >>> I think that sort of issue could be handled by having game-dependent >>> Comparator implementations, rather than making Card >>> Comparable. >> >> A comparator might have a hard time declaring "Ace is lower >> than Deuce" and "Ace is higher than Deuce" simultaneously ... >> >> And then, there are games where two identical ranks in the >> same hand can have different values. With A-A-9, for example, a >> Blackjack player would get the desired total of 21 by counting >> one Ace as a 1 and the other as an 11. (This appears to be the >> class of game the O.P. is interested in.) > > If the logic can be described precisely, then it can be > implemented in code. Yes. But my principal point in all of this is that it cannot always be implemented in *simple* code. Given the variety of card games, it is folly to try to capture the notion of "card" in a single, game-independent way. The same holds true for many other problem domains as well: It is fruitless to model "a card" or "a stock market" or "a person" in isolation from the model in which the card/market/person will be represented. The fundamental strength of O-O is that *sometimes* such problem-oblivious models can be created, and *sometimes* the next problem in line will be able to re-use the model. The fundamental fallacy of O-O zealots is that such models are independent of the problem; they nearly always aren't. > I somewhat suspect that stuff like this will not result > in pretty code. (Shrug.) If you want to model something, you choose your own level of fidelity. An old story tells of an engineer, a physicist, and a mathematician tasked with finding the wind resistance of a proposed design for a railway locomotive. The engineer suggests building a full-scale wind tunnel, putting a mock-up of the locomotive inside, and measuring the drag with a simple spring scale. "Wasteful!" cries the physicist. "The whole thing is fully explained by the following enormous system of partial differential equations, for which we can get numerical solutions with only six and a half months' time on the world's largest supercomputer." "Tut-tut," says the mathematician. "You empiricists are all alike, rushing to measurements and approximations when a simple grasp of theory would render everything clear to the suitably rigorous mind. Now attend: Consider a spherical train ..." (You think I'm kidding? There exist astrophysical models of stellar structure in *one* dimension: radial distance from center. So much for angular momentum and solar flares, eh?) -- Eric Sosman esosman@comcast-dot-net.invalid