Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!gegeweb.org!eternal-september.org!feeder.eternal-september.org!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 19 Dec 2012 06:24:02 -0600 Date: Wed, 19 Dec 2012 12:24:00 +0000 From: lipska the kat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: proper use of .java files (layout) 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> <5dmdnU7yCZQ1MEzNnZ2dnUVZ_sidnZ2d@earthlink.com> In-Reply-To: <5dmdnU7yCZQ1MEzNnZ2dnUVZ_sidnZ2d@earthlink.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 40 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-JFKlcix5ZNa9XwJFpG+yLinBllGgMtmJT2a0DjmmbDyChb/qu7PQiuI7jFWjWlceQm+n6RroqsVQZbf!WDgiuPgS35LrVRpDilOPbhfkQ4PbZgXYZkoG6fe6pnnZxVULAPQ9aKhvWl36tCDvKOzkbZBIMJg= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3486 Xref: csiph.com comp.lang.java.programmer:20520 On 19/12/12 12:06, Patricia Shanahan wrote: > On 12/18/2012 6:07 PM, Eric Sosman wrote: > ... >> 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. > > I think there are a lot of games based on mass produced packs of playing > cards. That gives a solid basis for a class Card. It should not be > Comparable because there is no common ordering. > > Each game would need its own Comparator, assuming cards can be > compared in the game. It would also need its own value of Deck, a > collection of cards that is used in that game. To progress the design a little I'd suggest that maybe, Card is an abstract class that exposes (at least) two methods, show() and hide(); The default implementations do nothing. I can't think of a card game that doesn't do at least one of these. I can also see Pack which contains n Card[s] depending on type (54 hcds cards is one pack I can think of) and also Deck which contains a number of Cards required to play the game, at this point the 'rules' are irrelevant. The contents of Pack and Deck may be the same for some games, in this case Deck has a constructor that takes a Pack, semantically however they are different. lipska -- Lipska the KatŠ: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun