My take on this is that you are making the mistake of trying to encapsulate program logic into your class hierarchy.
That is, you are trying to avoid
my $dealer; if( $vehicleType eq 'car' ) { $dealer = CarDealer->new(); { elsif( $vehicleType eq 'bike' ) { $dealer - BikeDealer->new(); } else { die "Unknown Vehicle type: $vehicleType"; }
And by doing so, you are pushing the decision into the class hierarchy and compounding its complexity in the process.
There simply isn't enough commonality between the two to root them in a common ancestry.
For (say) a supermarket where the only variables in a purchase might be pack size and quantity, it might make some sense; but for something with as many configurable options as cars and bikes, using inheritance to avoid an early boolean decision seems like a Code Smell of the contrived complexity variety.
In reply to Re: Builder design pattern with lots of parameters - trying to declutter design
by BrowserUk
in thread Builder design pattern with lots of parameters - trying to declutter design
by tospo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |