Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: StatsTable object Date: Mon, 12 Sep 2011 18:52:08 +0200 Lines: 38 Message-ID: <9d6rlrFb8U1@mid.individual.net> References: <9ac3f834-0633-434c-86b0-49ed543f3e81@z18g2000yqb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net LdpBoZmmRJaQ7k8QghrzZQWMnwk1bKeMks1NMrXfWZ+WY1YdA= Cancel-Lock: sha1:29mUp/tSxH2mDga3cGpcELbW9FU= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: <9ac3f834-0633-434c-86b0-49ed543f3e81@z18g2000yqb.googlegroups.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7897 On 12.09.2011 10:23, bob wrote: > I'm creating an object that represents a table of sports stats with > the player name as the first column and stat name as first row. > Here's an example: > > Touchdowns Yards Rushing Yards Passing > Dan Marino 2 200 55 > Chad Henne 8 700 53 > Brett Favre 7 300 44 > Emmitt Smith 4 400 108 > > What's the best way to represent this object in Java? > > I'm thinking of this: > > class StatsTable { > vector strings; > int numColumns; > int numRows; > } > > What do you all think of this representation? I think it would be > better if it had a more 2-dimensional feel, but I don't want to > complicate things. Dunno. I would start with the public interface, i.e. define what you want to do with it. Only then I would think about representation. Just one thing: in 2011 I would certainly *not* use Vector. And I'd make my fields private. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/