 |
|
mca
|
|
Odense, Denmark
Jan 1970 time: 06:13
|
|
I just browsed through the four commented classes and wondered about the TF.getTFInfo method: Why did you put five or so "getters" (attack, defence, money, goods, food) into one method? What is the reason that there's not a separate method for each?
Martin
[This message has been edited by mca (edited September 01, 1999).]
|
|
|  |
 |
|
mca
|
|
Odense, Denmark
Jan 1970 time: 06:13
|
|
For usual ways of doing a lot of things already figured out, I have found the book "Design Patterns: Elements of Reusable Object-Oriented Software" by Gamma et al. from Addison-Wesley (ISBN 0-201-63361-2) to be a great source of exactly that. I highly recommend it.
Martin
|
|
|  |
 |
|
F_Smith
|
|
Austin, Tx 78728
May 1999 time: 05:13
|
|
May I disagree?
I believe each 'parameter' (or whatever you like to call variables in a class that can be set/retrieved by the macro code) should have an independent 'get' method and 'set' method.
The 'IO' component should allow for access to each of these by reading the 'macro' code and then calling the required method.
For example, (assuming we were using XML), if you wanted to create a civ you'd write a text file something like:
[Civ]
[Population]100[/Population]
[Location]20, 30[/Location]
[OtherParam]Blah blah[/OtherParam]
[/Civ]
I've substituted '[' in place of '<', since the browser interperets the '<' and '>' as a tag.
The 'IO' component would read this in, parse the tags and route the values accordingly.
[This message has been edited by F_Smith (edited September 02, 1999).]
|
|
|  |
 |
|
mca
|
|
Odense, Denmark
Jan 1970 time: 06:13
|
|
Re getters and setters:
I must admit that I don't like the idea "generic" getters/setter much, even though I was the one to bring it up. F_Smith makes an excellent suggestion in the "Coding organization for Clash" thread: to use the Bean component model. Also, the Java reflection API can be used by the scripting language to get/set/etc, AFAIK.
Martin
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:13. Apolyton Time is 00:13. |
top of page
|
|
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|