P
pek
Hello everyone and thnx for any help..
I have a little structure problem. I don't quite know how to model my
objects. Any help is appreciated.
So, the problem is this. I have a class named Motherboard. Now, I know
motherboards support modules such as CPU, Memory etc. So I have to
create a spec for each module. Then I want to create some, let's say
for now, CPU Modules that have name, the specs etc. I want to select a
CPU and find out if the motherboard supports this CPU module.
My current model is the following.
I have a class (probably an Interface) ModuleSpec. For each separate
module (CPU, Memory etc.) you implements this and have it's
specifications that a motherboard needs to know (CPU Socket etc.).
Then I have a Module class (also probably an Interface) that each
separate module implements (CPUModule, MemoryModule) etc. And finally
a Motherboard class that has a list of ModuleSpec.
Now, ModuleSpec has a method isCompatible(Module module) which is
called to each module by the Motherboard class every time you try to
add a module (Motherboard.addModuleSpec(ModuleSpec spec)). This
returns a boolean.
What I don't like about my current model is that ModuleSpec and Module
is different interfaces while i KNOW that almost anything a ModuleSpec
has a Module MUST have. So it's kinda useless to define the same
things in both classes.
On the other hand, let's take CPUModuleSpec for example. It has a list
of compatible sockets. CPUModule has only one Socket (the one it has).
Also, a motherboard can have more than one Memory module, so I put as
many memory specs as needed by the motherboard and don't have a number
that tells how many (which could also be the case).
Any comments/ideas etc. welcome.
Thank you.
I have a little structure problem. I don't quite know how to model my
objects. Any help is appreciated.
So, the problem is this. I have a class named Motherboard. Now, I know
motherboards support modules such as CPU, Memory etc. So I have to
create a spec for each module. Then I want to create some, let's say
for now, CPU Modules that have name, the specs etc. I want to select a
CPU and find out if the motherboard supports this CPU module.
My current model is the following.
I have a class (probably an Interface) ModuleSpec. For each separate
module (CPU, Memory etc.) you implements this and have it's
specifications that a motherboard needs to know (CPU Socket etc.).
Then I have a Module class (also probably an Interface) that each
separate module implements (CPUModule, MemoryModule) etc. And finally
a Motherboard class that has a list of ModuleSpec.
Now, ModuleSpec has a method isCompatible(Module module) which is
called to each module by the Motherboard class every time you try to
add a module (Motherboard.addModuleSpec(ModuleSpec spec)). This
returns a boolean.
What I don't like about my current model is that ModuleSpec and Module
is different interfaces while i KNOW that almost anything a ModuleSpec
has a Module MUST have. So it's kinda useless to define the same
things in both classes.
On the other hand, let's take CPUModuleSpec for example. It has a list
of compatible sockets. CPUModule has only one Socket (the one it has).
Also, a motherboard can have more than one Memory module, so I put as
many memory specs as needed by the motherboard and don't have a number
that tells how many (which could also be the case).
Any comments/ideas etc. welcome.
Thank you.