Metaclasses

Talk it through out loud with your AI coach.

The problem

  • hard
  • Pro

You're building a plugin system and want every subclass of a Plugin base class to register itself automatically when its class is defined. A colleague proposes a metaclass. Explain what a metaclass is, how you'd use one here, and whether there's a simpler option.

What a strong answer covers

  • What creates a class and what a metaclass changes.
  • How a metaclass could register plugins.
  • Lighter alternatives that solve the same problem.
  • When a metaclass is genuinely justified, and what it costs.

Common mistake: Reaching for a metaclass first, when a subclass hook on the base class does the same job more plainly.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud