Click here to Skip to main content
15,900,702 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Localization - market possibilities vs. custom tool Pin
hoernchenmeister22-May-12 4:32
hoernchenmeister22-May-12 4:32 
QuestionHandling errors - What is a good balance? Pin
Troy.compdr17-May-12 7:50
Troy.compdr17-May-12 7:50 
AnswerRe: Handling errors - What is a good balance? Pin
jschell17-May-12 11:16
jschell17-May-12 11:16 
AnswerRe: Handling errors - What is a good balance? Pin
Luc Pattyn17-May-12 12:20
sitebuilderLuc Pattyn17-May-12 12:20 
AnswerRe: Handling errors - What is a good balance? Pin
RobCroll18-May-12 2:48
RobCroll18-May-12 2:48 
AnswerRe: Handling errors - What is a good balance? Pin
Ron Beyer24-May-12 17:40
professionalRon Beyer24-May-12 17:40 
QuestionSimple composition - Your thoughts? Pin
Eytukan14-May-12 23:15
Eytukan14-May-12 23:15 
AnswerRe: Simple composition - Your thoughts? Pin
Nagy Vilmos14-May-12 23:38
professionalNagy Vilmos14-May-12 23:38 
It depends on how you want to interact with the composite member.
I will often use an interface for the composite member that forces certain behavior on the parent.
To continue with your example. Can a rocket exist without the booster? Yes, then it does not belong in the constructor; no, then it must be initialised.

I would have:
Java
interface BoosterInterface {
    Booster getBooster();
    Boostertype getBoosterType();
    Boostertype getBoosterPower();
    void initBooster(Boostertype bt, BoosterPower bp);
    void setBooster(Booster bl);
    void setBoosterType(Boostertype bt);
    void setBoosterPower(BoosterPower bp);
}

class Rocket
        impliments BoosterInterface {
    // ya da ya
}


Having the interface means that you can of course force behaviour to the containing class.
My two pennies worth.


Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

GeneralRe: Simple composition - Your thoughts? Pin
Eytukan14-May-12 23:43
Eytukan14-May-12 23:43 
AnswerRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon14-May-12 23:48
mvePete O'Hanlon14-May-12 23:48 
GeneralRe: Simple composition - Your thoughts? Pin
Nagy Vilmos15-May-12 1:25
professionalNagy Vilmos15-May-12 1:25 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 1:56
mvePete O'Hanlon15-May-12 1:56 
GeneralRe: Simple composition - Your thoughts? Pin
Eytukan15-May-12 4:36
Eytukan15-May-12 4:36 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 4:53
mvePete O'Hanlon15-May-12 4:53 
AnswerRe: Simple composition - Your thoughts? Pin
BobJanova15-May-12 0:46
BobJanova15-May-12 0:46 
AnswerRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 1:51
mvaMarc Clifton15-May-12 1:51 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 1:57
mvePete O'Hanlon15-May-12 1:57 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 2:45
mvaMarc Clifton15-May-12 2:45 
GeneralRe: Simple composition - Your thoughts? Pin
Pete O'Hanlon15-May-12 3:25
mvePete O'Hanlon15-May-12 3:25 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 4:57
mvaMarc Clifton15-May-12 4:57 
GeneralRe: Simple composition - Your thoughts? Pin
Eytukan15-May-12 4:41
Eytukan15-May-12 4:41 
GeneralRe: Simple composition - Your thoughts? Pin
Marc Clifton15-May-12 5:06
mvaMarc Clifton15-May-12 5:06 
GeneralRe: Simple composition - Your thoughts? Pin
Eytukan15-May-12 18:32
Eytukan15-May-12 18:32 
QuestionDatabase Modeling - Conditional Relationships Pin
Leslie Sanford11-May-12 8:34
Leslie Sanford11-May-12 8:34 
AnswerRe: Database Modeling - Conditional Relationships Pin
R. Giskard Reventlov11-May-12 9:49
R. Giskard Reventlov11-May-12 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.