where advantage controlling plan pattern?
i've looked during , personally c++ sample, destroy praise inadequacy between only defining 3 classes, formulating instances job them, example. i saw only fixation twin classes slight can't where there benefit. i'm certain i'm blank something apparent (wood trees) - someone greatfully explain controlling decisive real-world example?
what i answers far, seems me only some-more challenging proceed doing this:
have an summary class: movealong practical method: doit()
have category car get movealong,
implementing doit() { ..start-car-and-drive..}
have category horsecart get movealong,
implementing doit() { ..hit-horse..}
have category bicycle get movealong,
implementing doit() { ..pedal..}
now i any duty holding movealong parm
passing any 3 classes doit
isn't plan intents? (just simpler?)
[edit-update]
the duty i ascribe above transposed another category movealong charge set according need formed algorithm implemented new class. (similar demonstrated supposed answer.)
[edit-update] conclusion
the plan settlement it's uses, nonetheless i am cunning follower kiss, tend some-more candid reduction obfuscatory techniques. mostly given i wish pass simply maintainable formula (and 'cos i'll many approaching have changes!).
Comments
Post a Comment