A froggy visitor
From CSSEMediaWiki
Revision as of 10:38, 15 July 2010 by John Hofman (Talk | contribs)
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.