The Dark family

Step 2 -- The Dark family

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:

  • DarkButton.render() returning [Dark Button]
  • DarkCheckbox.render() returning [Dark Checkbox]

Each dark product must render a string that is distinct from its light counterpart, so the two families never get confused.

Hints
Starter code
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]
        pass
Write it on a laptop

The editor and the test runner need a wide screen. Open this page on a desktop browser and your progress will be waiting.