Created
September 19, 2011 13:02
-
-
Save nicholasjhenry/1226452 to your computer and use it in GitHub Desktop.
Pat Maddox's example from Streamlined Object Modeling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://tech.groups.yahoo.com/group/domaindrivendesign/message/6654 | |
class Target { | |
public void strike(missile) { | |
missile.setCoordinates(self.coordinates); | |
missile.launch(); | |
markDestroyed(); | |
} | |
} | |
class PatsHouse extends Target { | |
public void strike(missile) { | |
raise new BadIdeaError("Whoa whoa who, I don't want to die"); | |
} | |
} | |
as opposed to the Missile class being invasive: | |
class Missile { | |
public void strike(target) { | |
setCoordinates(target.coordinates); | |
launch(); | |
target.markDestroyed(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment