A single theme is not a family yet. The whole point of Abstract Factory is that each family has a parallel set of products. Add the Dark theme so we have a second, interchangeable family.
Implement:
Each dark product must render a string that is distinct from its light counterpart, so the two families never get confused.
class Button:
"""Abstract product: a clickable button."""
def render(self):
raise NotImplementedError
class Checkbox:
"""Abstract product: a toggle checkbox."""
def render(self):
raise NotImplementedError
class LightButton(Button):
def render(self):
return "[Light Button]"
class LightCheckbox(Checkbox):
def render(self):
return "[Light Checkbox]"
class DarkButton(Button):
def render(self):
# TODO: return the dark button string, e.g. [Dark Button]
pass
class DarkCheckbox(Checkbox):
def render(self):
# TODO: return the dark checkbox string, e.g. [Dark Checkbox]
passThe editor and the test runner need a wide screen. Open this page on a desktop browser and your progress will be waiting.
A single theme is not a family yet. The whole point of Abstract Factory is that each family has a parallel set of products. Add the Dark theme so we have a second, interchangeable family.
Implement:
Each dark product must render a string that is distinct from its light counterpart, so the two families never get confused.
Press Run Tests or ββ© to check your solution.