Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 2.1 KB

File metadata and controls

38 lines (31 loc) · 2.1 KB

Template Method — where it lives outside this repo

Cited, real implementations to study (or point an agent at) when designing or reviewing template-shaped code.

Python standard library

Major ecosystems

  • Django class-based views. The request pipeline (dispatch → handler → response) is fixed; get_queryset, get_context_data and friends are the named hooks — the subclass form at a true framework boundary. docs.djangoproject.com/en/stable/topics/class-based-views/
  • Scrapy spiders. The crawl loop, scheduling, and retries belong to the framework; parse() is your extraction step. docs.scrapy.org

What to notice across all of them

Every citation above is a framework boundary: the code that owns the loop and the code that owns a step are maintained by different people — that asymmetry is what justifies subclass hooks. Inside one codebase that asymmetry is absent, and passing callables (this unit's Skeleton) gives the same fixed spine with composition instead of a class per variant. When reviewing, ask who owns the loop: someone else → hooks are fine; you → pass the steps.