Side-effects Within The Business Logic Core
summary
Argues for an imperative shell / functional core that moves effects out so business logic stays testable and pure, showing a potato-service refactor that replaces a 92-field config with two simple values. Cites an empirical result: one in four projects use mocking frameworks, external dependencies are mocked two-thirds of the time and business logic one-third. Recommends describing effects with Task/IO, running a few CI integration tests or Testcontainers for the thin shell, using fakes for stable regression checks, and deleting brittle mocks.
AI-written summary · about
chapters (20)
- 0:00Introduction to talk
- 1:06Happyland pure functions
- 2:33Mocking objects study findings
- 6:02Types of test doubles
- 8:11Stubbing with potato service
- 10:41Mocks for state observation
- 13:12Explicit state in design
- 15:41Challenges with essential effects
- 17:25Stubbing external dependencies
- 18:51Logic and effects entanglement
- 21:00Costs of mocking objects
- 22:50Over-abstraction pitfalls
- 24:35Functional core imperative shell
- 27:06Refactoring to pure core
- 28:50Effect handling in Scala
- 30:13Testing imperative shell
- 31:15State-based property testing
- 31:57When mocking is justified
- 34:22Opinions on TDD approach
- 35:41Q&A session
