Briefle
LearnGlossaryPricing

Briefle words · Code & architecture

Strategy pattern

Putting one interchangeable behavior behind a common interface so it can be swapped without changing the code that uses it.

Say it to an AI

TypeScript Enemy model for a shoot-'em-up using composition over inheritance: one Enemy class that takes a movement and a list of abilities behind a shared Ability interface (strategy pattern). No subclasses per combination like FlyingShooterEnemy.

How an expert would brief the stronger version of “Game enemies”.

See it

Try it as a puzzle →

A mobile shoot-'em-up models enemies that walk or fly and can shoot or heal.

Study A · the weaker one
Study B · the stronger one

Why: B's 'Ability' interface lets 'Fly', 'Shoot' and 'Heal' plug into the same 'update()' loop.

Related words

  • Single responsibility principle
  • Flag argument
  • Side effect
  • Parameter object
  • Long parameter list
  • Named arguments
  • Options object
  • Utils file

Room 3 · Functions & structure

Learn “Strategy pattern” in a five-minute lesson

Start free
AI can build almost anything. The bottleneck is saying what you want.
WordsPricingTermsPrivacyRefundsContact
© 2026 Briefle