Created
July 8, 2020 16:03
-
-
Save carlosble/2e5daa2f2be6c24d31b5d0c2ecf62ca5 to your computer and use it in GitHub Desktop.
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 Sensor: | |
"""Lo vamos a simular""" | |
def is_detecting_movement(self) -> bool: | |
pass | |
class Recorder: | |
"""Lo vamos a simular""" | |
def start_recording(self): | |
pass | |
def stop_recording(self): | |
pass | |
class Controller: | |
sensor: Sensor # dependency | |
recorder: Recorder # dependency | |
def __init__(self, sensor: Sensor, recorder: Recorder): | |
self.sensor = sensor | |
self.recorder = recorder | |
def record_movement(self): | |
if self.sensor.is_detecting_movement(): | |
self.recorder.start_recording() | |
else: | |
self.recorder.stop_recording() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment