How Programming in Other Languages Made my Ruby Code Better
summary
Shows concrete refactorings: converting ActiveRecord models into structs-as-data to stop in-object state and save an HTTP request by making renew a class method, moving business logic into functional-like services that return new data objects (tests become simpler), and adopting explicit dependency injection so tests swap coffee-machine implementations. Cites Go and Elixir influences, a real 140-line experiment service, and static-analysis metrics that drop severity from E to A after changes, proving measurable improvements in maintainability and testability.
AI-written summary · about
chapters (6)
- 0:00Start
- 6:51Structs to the rescue
- 10:30Stateless business logic
- 16:05Reduce side effects caused by states, improving test effectiveness and code maintainability Simplify tests by reducing context setup Slim down model objects removing third-party interactions Expose the business logic in a centralized place, with clear and easy to test methods
- 19:32Simplify tests by being able to better isolate dependencies Improved unit testing (use integration tests for comprehensive coverage) Speed up tests by not having to test unnecessary code due to internal state changes
- 20:04Dependency injection








