Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10895
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.saix.net!news.saix.net.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Tue, 20 Dec 2011 08:47:58 -0600 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Design Question |
| References | <Xns9FBFC38D782BCjpnasty@94.75.214.39> <4eee8447$0$291$14726298@news.sunsite.dk> |
| From | ilAn <idonot@wantspam.net> |
| Date | Tue, 20 Dec 2011 16:47:57 +0200 |
| Message-ID | <m2obv3paea.fsf@wantspam.net> (permalink) |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin) |
| Cancel-Lock | sha1:WefUfKVEUR5l1DgeIzgkbRbCrtg= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Forwarded | by - (DeleGate/9.9.1) |
| Lines | 30 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-mexxTUMssMn+RA7tPe3HYhxue1PDOJAObBFUgL8oHPqkf3Mq/mx7tyK0GqidJdOor7NdWfXlVA5JxFw!2juYfMSQ+K4xA5TGwZ8LCqDhOYUKOmgQsiPQU4u3U+o9FJRYIJhi2zTORLo= |
| 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 | 2441 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10895 |
Show key headers only | View raw
Arne Vajhøj <arne@vajhoej.dk> writes: > On 12/18/2011 7:13 PM, Novice wrote: >> >> Am I right in thinking that I should actually have an abstract class, maybe >> called AbstractScore, and that it should have two subclasses, Interim Score >> and FinalScore? AbstractScore could have all of the "common code" in it >> while InterimScore and FinalScore could each do the stuff that was unique >> to itself, like setting the Title appropriately, setting the text of the >> button, and reacting to the appropriate button in actionPerformed(). In >> other words, the actionPerformed() in InterimScore would only react to Quit >> while the actionPerformed() in FinalScore would only react to Exit. Then, >> my game should instantiate InterimScore during the game and FinalScore when >> the user wants to end the game. >> >> Or is there a better way? > > The abstract class with two sub classes must be the OO way. Or you could consider the user of an interface, two classes that implement that interface - and a factory class that returns the correct one. You should pass some kind of object to the factory class, maybe in the constructor; from which it can work out what type of class to return. (Maybe the Game itself as a class/interface.) This would allow you to add other types of class that implement the interface for scenarios you have not yet imagined. -- ilAn
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Design Question Novice <novice@example..com> - 2011-12-19 00:13 +0000
Re: Design Question Arne Vajhøj <arne@vajhoej.dk> - 2011-12-18 19:24 -0500
Re: Design Question ilAn <idonot@wantspam.net> - 2011-12-20 16:47 +0200
Re: Design Question Arne Vajhøj <arne@vajhoej.dk> - 2011-12-20 10:39 -0500
Re: Design Question markspace <-@.> - 2011-12-18 19:23 -0800
Re: Design Question Novice <novice@example..com> - 2011-12-19 13:26 +0000
Re: Design Question Novice <novice@example..com> - 2011-12-19 13:28 +0000
Re: Design Question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-12-19 07:16 -0400
Re: Design Question Novice <novice@example..com> - 2011-12-19 13:49 +0000
Re: Design Question Martin Gregorie <martin@address-in-sig.invalid> - 2011-12-19 22:22 +0000
Re: Design Question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-12-19 20:13 -0400
Re: Design Question Lew <lewbloch@gmail.com> - 2011-12-20 07:37 -0800
Re: Design Question Arne Vajhøj <arne@vajhoej.dk> - 2011-12-20 10:42 -0500
Re: Design Question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-12-20 17:46 -0400
Re: Design Question Martin Gregorie <martin@address-in-sig.invalid> - 2011-12-20 20:40 +0000
Re: Design Question Novice <novice@example..com> - 2011-12-19 13:34 +0000
Re: Design Question Roedy Green <see_website@mindprod.com.invalid> - 2011-12-19 06:25 -0800
Re: Design Question Gene Wirchenko <genew@ocis.net> - 2011-12-19 11:38 -0800
Re: Design Question Lew <lewbloch@gmail.com> - 2011-12-20 07:42 -0800
Re: Design Question Gene Wirchenko <genew@ocis.net> - 2011-12-20 11:51 -0800
Re: Design Question soulspirit@gmail.com - 2011-12-20 14:55 -0800
Re: Design Question Gene Wirchenko <genew@ocis.net> - 2011-12-20 15:25 -0800
Re: Design Question soulspirit@gmail.com - 2011-12-21 01:11 -0800
Re: Design Question Gene Wirchenko <genew@ocis.net> - 2011-12-21 11:08 -0800
Re: Design Question soulspirit@gmail.com - 2011-12-21 15:27 -0800
Re: Design Question Gene Wirchenko <genew@ocis.net> - 2011-12-21 18:06 -0800
csiph-web