I'm currently working on one of the assignments in the the Cattle Drive . I want to know if it's bad design to call multiple methods from another ? From my main method I want to call one method and from that one method I want to have option to call one or more methods depending on the condition. So main() calls methodA() and methodA() may call methodB() , methodD(), and methodF() or methodA() may only call methodC() it depends on the conditions calculated in methodA().
Also is it correct to say that this question is about code design?
That's difficult to answer in the abstract. Generally speaking, it's perfectly fine to have a decision (if-else) in a method, and part of the resulting branches may involve calling different methods. Something to consider is whether each of your methods performs exactly one task. If you can say that methodA() performs the same task when it calls B, D, and F, as it does when it calls C, just for different starting inputs, then your design is fine. I can't think of the Cattle Drive problem that would fit this analogy, but give it go, and your nitpicker will let you know if it makes sense. That's what we're for!
What's a year in metric? Do you know this metric stuff tiny ad?
Devious Experiments for a Truly Passive Greenhouse!