A froggy visitor
From CSSEMediaWiki
(Difference between revisions)
(Wiped it out) |
John Hofman (Talk | contribs) |
||
Line 1: | Line 1: | ||
Homework excercise for us! | Homework excercise for us! | ||
+ | |||
+ | This exercise was introduced during a discussion about this [[Frogs design]] example. The question was raised concerning the "exportXML()" method of the frog class: | ||
+ | |||
+ | [[Image:Frog_export_exercise.gif]] | ||
+ | |||
+ | Is this method good, evil, or the lesser of two evils? | ||
+ | |||
+ | * This method contradicts the [[Model the real world]] maxim. A frog does not know about exporting itself and should not be able to. | ||
+ | |||
+ | * If the frog did not know how to export itself then another class would need internal access to achieve this. However, this will break the [[Encapsulation boundary]]. |
Revision as of 10:38, 15 July 2010
Homework excercise for us!
This exercise was introduced during a discussion about this Frogs design example. The question was raised concerning the "exportXML()" method of the frog class:
Is this method good, evil, or the lesser of two evils?
- This method contradicts the Model the real world maxim. A frog does not know about exporting itself and should not be able to.
- If the frog did not know how to export itself then another class would need internal access to achieve this. However, this will break the Encapsulation boundary.