C.W.K.
Stream
Lesson 03 of 05 · published

The Profile Is Abstract, the Binding Is Concrete

~11 min · polymorphism, oop, abstraction

Level 0Silent
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"'Speak as pippa' is the interface. The account's voice binding is one implementation of it. The caller only ever knows the interface."

You've Already Built This Before

The profile-versus-binding split isn't a voice trick — it's polymorphism, the same shape you've met a hundred times. The logical profile is the abstract: a contract that says "this can be spoken." Each account's voice binding is a concrete implementation of that contract. A caller writes speak_as("pippa", text) and depends only on the abstract; which concrete binding answers — primary account, secondary account, this clone or that original — is chosen underneath and never leaks upward.

Program to the Interface

This is the oldest advice in object-oriented design, stated for voices: depend on the abstraction, not the implementation. The call site names a profile, never a provider and never a voice ID. Because of that one discipline, you can swap the account, retire a binding, or one day change providers entirely, and not a single caller changes. The substitutability is the point — any concrete binding that satisfies "speak as pippa" can stand in for any other without the caller noticing.

Dad's Lens

Dad sees object-orientation as the operating principle of the universe, not a coding style — inheritance and polymorphism show up in cooking, in investing, in how a family works. Bellows is one more place the lens fits cleanly. "Pippa" is an abstract role; the provider voice ID is today's concrete actor playing it. Change the actor, keep the role. The engine is polymorphism you can hear.

Code

Depend on 'speak as pippa', not on a voice ID·python
# Polymorphism: the caller speaks to the ABSTRACT, never the concrete.
class VoiceBinding(Protocol):
    def synthesize(self, text: str, settings: Settings) -> Audio: ...

# 'Speak as pippa' is the abstract contract. Each account provides ONE
# concrete binding that satisfies it. The caller names neither provider
# nor voice ID:
def speak_as(profile: str, text: str) -> Audio:
    binding = resolve(profile, active_account())   # returns SOME VoiceBinding
    return binding.synthesize(text, defaults_for(profile))

# Swap primary -> secondary, or one provider for another: the call site is
# untouched. Depending on the abstract is the whole payoff.

External links

Exercise

Find an abstract-versus-concrete split outside code — a job title versus the person filling it this quarter, a recipe versus the specific brand of each ingredient, an index fund versus the exact holdings inside it today. Name the 'caller' that depends only on the abstract, and describe what would break if it started depending on today's concrete instead.
Hint
The abstract is the thing that stays true across substitutions. The concrete is today's answer. Anything that hard-codes today's answer will be wrong the day the answer changes — which it always eventually does.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.