Push your side effects to the edge
summary
A Laravel script that syncs supplier stock and pricing starts as a cursor over Product models, calling a remote client and saving each product; tests are slow and full of DB mocks. The refactor extracts single‑product logic into pure functions, keeps HTTP and DB calls at the integration layer, and turns most specs into fast unit tests while retaining a few integration tests. The tradeoff is more small files and tests, but faster feedback and clearer rules for price updates versus product deactivation using the client response.
AI-written summary · about
chapters (16)
- 0:00Quest for better software
- 1:07Legacy code dilemma
- 9:57Typical code consequences
- 13:04Dependency injection
- 20:12Functions context and side effects
- 24:46Car analogy for optimization
- 28:06Side effects to the edge
- 33:25Pure functions benefits
- 36:14When to use approach
- 38:03Design tradeoffs
- 41:35Q&A
- 41:56Tradeoffs with managers
- 44:47Office background theme
- 45:33Combining architectures
- 47:22Purifying codebases
- 50:17Mixed architecture worries
related talks
24mCache for Commerce Performance and Optimization for High Volume Sales
20mStateful Web Service: A Distributed Lambda Function for Client-Server Interactions
49mSmart serverless architecture for smart manufacturing
32mTips and tricks: data science prototype into production
21mLive-coding demo
02h 08mGoing serverless with PHP and Bref.sh
44mSpring + Kotlin = Modern + Reactive + Productive
46mContinuous Experimentation
