Path: csiph.com!usenet.pasdenom.info!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: Tue, 18 Dec 2012 03:50:37 -0600 Date: Tue, 18 Dec 2012 09:50:36 +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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <9_6dnbVv5aTwoU3NnZ2dnUVZ8kOdnZ2d@bt.com> Lines: 52 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-i0Et95/P32z6UflvioIbG4w46w22a1kTtWicIrhgLBVVVlJG0oxpH6H0eELkSEx1WNAEPQZ5huGza5p!FWBlJHCs4cGDb160gtPzbF6+nDo9VKK/EZFrCElMRSfrqp77peuC9wqkelHlQK96HsBkDbWGwF4= 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: 3796 Xref: csiph.com comp.lang.java.programmer:20434 On 18/12/12 04:06, Stefan Ram wrote: > markspace<-@.> writes: >> I was actually thinking about that. I don't like the idea of trying to >> encode most of the values of a face card as enums. > > I do not like the idea of designing a card game /before/ > I know exactly /which/ card game it is at all. I need to > know the rules of this card game and what exactly has to be > programmed (e.g., human players or also computer [AI] > players?). Only then I start to design. > > But often not even then do I do a beforehand OOD. Instead, > I start out procedurally, using OOP only where it is obvious. > Then I start to see OO patterns in the procedural code, > so I then refactor into OOD and eventually arrive at an > »object-oriented program«. Then I suggest with respect that you do not 'get' OO. The idea of designing computer systems as a series of communicating abstractions of real world human concepts (Classes) came about exactly because procedural programming was shown to be unsuitable for large scale complex systems. Starting out with a procedural design then trying to force it into an OO model seems to be a lot of work to me. A better approach would be to come up with a high level abstraction first, in this case 'CardGame' Then we start to break the problem down, immediately we can split the word into two classes, Card and Game, we have already halved the problem. Now we take Card, in the real word we know that we don't play a game with a single card, we know that a card is a member of a pack of 54, another word pops out Pack ... this is a new class. We can now go away and develop a Pack of Cards independently of our game ... and it will be reusable to boot... THIS is OO Notice that until now I know nothing about what game I might be 'designing' in fact I venture to suggest that we will discover, in the end that a Game' is nothing more than a set of rules that we can apply to our Deck. Our Deck is made up of a number of cards from one or more (reusable) Packs. Our Game will use a reusable Dealer who has a shuffle and deal methods. Once we have all these Classes in place we can start thinking about the rules of the game. The detail comes at the end, not at the beginning. Just my POV lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun