Product interfaces and the Light family

Step 1 -- Product interfaces and the Light family

The Abstract Factory pattern builds families of related products that must match, without hard-coding which concrete classes you use. We are building a themed UI kit. Every widget is a product, and each theme provides a matching set of products.

Two abstract products, Button and Checkbox, are already defined for you. Each declares a render() method that returns a plain string (imagine the drawn widget). Your job is to implement the first concrete family: the Light theme.

Implement:

  • LightButton.render() returning the string [Light Button]
  • LightCheckbox.render() returning the string [Light Checkbox]

Return the strings exactly, including the square brackets.

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):
        # TODO: return the light button string, e.g. [Light Button]
        pass

class LightCheckbox(Checkbox):
    def render(self):
        # TODO: return the light checkbox string, e.g. [Light 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.