Home » Stars! Clones, Extensions, Modding » FreeStars » Design Delimma
Design Delimma |
Fri, 13 June 2003 15:26 |
|
LEit | | Lt. Commander | Messages: 879
Registered: April 2003 Location: CT | |
|
I've got an OO design delimma, if anyone can help, I'd appreciate it.
I'm trying to design a Ship class that is composed of a collection of Components.
Each component can be of a certain type (armor, shield, weapon, and several others). Some components can have capabilities of more then one type (armor with some shielding). So far it's pretty easy, use inheritance for the types, and multiple inheritance for the multiple type components.
The complication is that I'd like to be able to read a file of components:
Croby Sharmor, type shield, (generic details, cost, mass, etc), shield strength 65, armor strength 60.
Most shields don't have armor, this one is special. There are some components that have 5 or more sub capabilities, and I'd even like to leave that open, so defining a class for each possible combination is impractical. I want to read a file and make a list of components from that file.
Two options I've considered are:
Make Component class generic enough to handle every combination (put shield and armor and all other variables into it) and have it return some default value if a particular component isn't defined.
The other idea is have Component have a list of Capabilities, and you add to the list as needed. Then you can ask a Component to give you the Armor Capability. This is what I'm currently leaning toward, I feel it's a better design, however, it'll be slightly harder to code.
[Updated on: Thu, 19 June 2003 11:20]
- LEitReport message to a moderator
|
|
|
|
|
Design Delimma
By: LEit on Fri, 13 June 2003 15:26
|
|
|
Re: Design Delima
By: gible on Fri, 13 June 2003 20:47
|
|
|
Re: Design Delima
|
|
|
Re: Design Delima
By: LEit on Mon, 16 June 2003 21:35
|
|
|
Re: Design Delima
|
|
|
Re: Design Delima
By: LEit on Mon, 16 June 2003 23:28
|
|
|
Re: Design Delima
|
|
|
Re: Design Delima
By: LEit on Wed, 18 June 2003 13:09
|
|
|
Re: Design Delima
|
|
|
Re: Design Delimma
By: JeffMC on Thu, 26 June 2003 00:59
|
|
|
Re: Design Delimma
By: Ptolemy on Fri, 26 March 2004 07:07
|
|
|
Re: Design Delimma
By: LEit on Fri, 26 March 2004 13:09
|
|
|
Re: Design Delimma
By: Ptolemy on Fri, 26 March 2004 14:21
|
|
|
Re: Design Delimma
By: multilis on Fri, 09 April 2004 13:42
|
|
|
Re: Design Delimma
By: Ptolemy on Sat, 10 April 2004 02:00
|
|
|
Re: Design Delimma
By: Ashlyn on Sat, 10 April 2004 02:07
|
|
|
Re: Design Delimma
By: Ptolemy on Sat, 10 April 2004 02:10
|
|
|
Re: Design Dilemma
By: Ashlyn on Sat, 10 April 2004 02:19
|
|
|
Re: Design Delimma
By: multilis on Sat, 10 April 2004 11:15
|
|
|
Re: Design Dilemma
|
|
|
Re: Design Dilemma
By: multilis on Sat, 10 April 2004 13:38
|
|
|
Re: Design Dilemma
By: Kotk on Sun, 11 April 2004 13:15
|
|
|
Re: Design Delimma
By: LEit on Sun, 11 April 2004 14:57
|
|
|
Re: Design Delimma
By: Kotk on Mon, 12 April 2004 06:29
|
|
|
Re: Design Delimma
By: LEit on Tue, 13 April 2004 15:04
|
|
|
Re: Design Delimma
By: multilis on Tue, 13 April 2004 15:32
|
|
|
Re: Design Delimma
By: Ptolemy on Tue, 13 April 2004 15:49
|
Goto Forum:
Current Time: Mon Jul 01 22:57:00 EDT 2024
|