Last active
August 3, 2017 08:15
-
-
Save FagnerMartinsBrack/0a2e40687eb18b9a64d9034c69636b58 to your computer and use it in GitHub Desktop.
(Medium) The Role Of Affordance In Software Design
This file contains 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
class Soldier { | |
handEquip(weapon) { | |
this.equipedWeapon = weapon; | |
} | |
useHandEquipmentAgainst(enemy) { | |
this.equipedWeapon.shoot(enemy); | |
} | |
} | |
class MachineGun { | |
open(bottle) { | |
alert('*Opening A Bottle With The Machine Gun*'); | |
} | |
shoot(enemy) { | |
alert('*Shooting The Machine Gun Against The Enemy*'); | |
} | |
} | |
// ... | |
const john = new Soldier(); | |
john.handEquip(new MachineGun()); | |
john.useHandEquipmentAgainst(new Soldier()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment