Refactoring Techniques for Elixir, Ecto, and Phoenix
summary
Shows concrete refactorings applied to a working tic‑tac‑toe app (called Pokemon go 2.0 / knots and crosses) so code before/after is visible and tests still pass; uses Elixir pattern matching and multiple function heads to replace nested if/case, moves GenServer logic into a Game struct module, uses with/else for readable pipelines, switches maps to structs, applies Ecto.Multi and Repo.aggregate for transactional DB work, and uses Phoenix plugs and overridden action to surface friendly errors.
AI-written summary · about
chapters (15)
- 0:00Intro
- 0:30WHAT IS REFACTORING?
- 6:13WINNING CRITERIA
- 9:54APPLICATION STRUCTURE
- 13:55WHY REFACTOR?
- 14:24CASE TO FUNCTION
- 15:17MOVE CALLBACK CODE TO FUNCTIONS
- 19:21CASE TO PIPELINE
- 22:23USE STRUCTS
- 23:34MOVE CODE TO STRUCT MODULE
- 24:44COUNTING
- 28:17ECTO.MULTI
- 31:43OVERRIDING ACTION
- 32:01FIND WITH PLUG
- 34:36SUMMARY








