Skip to content

Instantly share code, notes, and snippets.

@lastlegion
Last active September 1, 2020 00:11
Show Gist options
  • Save lastlegion/932187758b4e219c79f41a68a6d2a2c3 to your computer and use it in GitHub Desktop.
Save lastlegion/932187758b4e219c79f41a68a6d2a2c3 to your computer and use it in GitHub Desktop.
class Repository:
def __init__(self, db: str):
self.db = db
def get_data(self):
return 'Hello World'
class Service:
def __init__(self, repsoitory: Repository):
self.repsoitory = repsoitory
def process(self):
return self.repsoitory.get_data()
class UI:
def __init__(self, service: Service):
self.service = service
def render(self):
print(self.service.process())
if __name__ == '__main__':
ui = UI(Service(DAL(db=os.getenv('db'))))
ui.render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment