Click here to Skip to main content
15,881,381 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
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 
VuNic wrote:
The Boosters.GetBooster() can be applied for both the scenarios?


I think so. In the first scenario, the constructor can call GetBooster to get a concrete instance, though I think it would be much more preferable for Rocket to have a Build() method.

In the second scenario, and this may be over the top, consider that we know that a rocket, among other things, has some form of propulsion mechanism, otherwise it wouldn't be a rocket. Now, a rocket might have a main engine, boosters, stages, ion engines, so forth, a whole slew of combinations of things. So if rocket is to have a "has a" relationship to booster, the concept of booster needs to be abstracted to "propulsion systems", ideally a collection of this abstraction type. The GetBooster factory might return a collection specific to the rocket's requirements. You can define specific collections as a concrete type (there's most likely a limited, well defined set of configurations). Each type (the configuration of propulsion systems) probably has specific launch behaviors. Therefore, the type itself contains all the logic for how to proceed with a launch, going from main engine firing, booster firing, stages, and final orbit maneuverings with ion engines. So, why should the rocket itself know how to do this? The rocket is just a container for a particular configuration. Maybe the rocket performs some coordination with other systems, but the execution of the launch should be delegated to the configuration type.

Which is where functional programming can be used, not only for "computing" the launch, but also for ensuring that configurations, using discriminated unions, are permitted.

Smile | :)

Marc

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 
GeneralRe: Database Modeling - Conditional Relationships Pin
Leslie Sanford12-May-12 8:42
Leslie Sanford12-May-12 8:42 
AnswerRe: Database Modeling - Conditional Relationships Pin
Eddy Vluggen13-May-12 4:32
professionalEddy Vluggen13-May-12 4:32 
AnswerRe: Database Modeling - Conditional Relationships Pin
jschell14-May-12 9:24
jschell14-May-12 9:24 
Questionhow to design base class? Pin
wan.rui@qq.com10-May-12 17:09
wan.rui@qq.com10-May-12 17:09 
AnswerRe: how to design base class? Pin
walterhevedeich10-May-12 19:29
professionalwalterhevedeich10-May-12 19:29 
AnswerRe: how to design base class? PinPopular
Pete O'Hanlon10-May-12 21:52
mvePete O'Hanlon10-May-12 21:52 
GeneralRe: how to design base class? Pin
wan.rui@qq.com10-May-12 22:11
wan.rui@qq.com10-May-12 22:11 
GeneralRe: how to design base class? Pin
BobJanova15-May-12 0:48
BobJanova15-May-12 0:48 
GeneralRe: how to design base class? Pin
wan.rui@qq.com10-May-12 22:15
wan.rui@qq.com10-May-12 22:15 
GeneralRe: how to design base class? Pin
TorstenH.15-May-12 0:00
TorstenH.15-May-12 0:00 
QuestionActive Directory Pin
Franklin lloyd10-May-12 7:13
Franklin lloyd10-May-12 7:13 
AnswerRe: Active Directory Pin
jschell10-May-12 9:27
jschell10-May-12 9:27 
QuestionSingle web solution vs web app + mobile web app Pin
logicaldna8-May-12 22:56
logicaldna8-May-12 22:56 
AnswerRe: Single web solution vs web app + mobile web app Pin
Aniruddha Loya9-May-12 7:34
Aniruddha Loya9-May-12 7:34 

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.