Skip to content

Instantly share code, notes, and snippets.

@mlopes
Last active December 27, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlopes/7378989 to your computer and use it in GitHub Desktop.
Save mlopes/7378989 to your computer and use it in GitHub Desktop.
# Tell - The de-coupling allows me to write the example without having to write an example of the Keychain class
class EncryptionKey:
def __init__(self, keychain):
self.keychain = keychain
def decrypt(self, password):
if _decrypt(password):
self.keychain.unlock()
# Ask - The tight coupling causes strong dependencies
class Keychain:
def unlock(self, password):
try:
decrypted_key = encrypted_key.decrypt(password)
self.locked = False
except:
self.locked = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment