Hello,

> On 8 Ϧ 2014, at 12:12 , Leam Hall <leamhall / gmail.com> wrote:
> 
> Naturally, learning Ruby is helped by linking it to a game. In this case Traveller. Leads me to a question about when something should be an attribute of the primary class or a class in itself.
> 
> In the game you have a character. Characters have stats like Strength, Intelligence, etc. Also things like age, skills, etc. Characters can acquire things like vehicles, ships, and money. It makes sense to make a space ship be a different class.
> 
> In the game characters tend to join some career for sets of 4 years. These careers provide more skills, rank, decorations, etc. Much of the character's nature is defined by the career path they choose. For example, a character might have spent 4 terms (16 years) in the Imperial Navy and earned a rank, learned several skills, attended specialty schools, and earned medals for valor. Each career path has a structure similar to the other careers but the class attributes would vary from career to career. A Navy rank would be different than an Army rank.
> 
> So the question is, should the career and subsumed attributes be a part of the character class or a class unto itself?

IMHO that's the most difficult programming problem: design :-) 

I often reach a point where my program works, but then I find out that my models (design) are wrong, or not *as dynamic as they should* and re-write the entire thing (when possible/sensible to do so).

I don't think anyone can answer the question from the introduction you gave. In order for anyone to really help, you should provide at least *some* chunk of code, to see how it is structured.

Reasoning in terms of models (e.g. databases) I'd say that it's a better approach to create a different class for the attribute and just connect the attributed to the character, once the character has earned these attributes.

> 
> Thanks!
> 
> Leam
> -- 
> http://31challenge.net
> http://31challenge.net/insight


Have a nice day! :-)

Panagiotis (atmosx) Atmatzidis

email:	atma / convalesco.org
URL:	http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

"As you set out for Ithaca, hope the voyage is a long one, full of adventure, full of discovery [...]" - C. P. Cavafy