This is a simple refactoring exercise that is meant to teach about dependency inversion and dependency injection.
The documentation is in this blog bost and in the presentation in the doc directory.
The "Birthday Greetings Service" does 3 things:
- Read employee records from a file
- Filter employees whose birthday is today
- Send a personalized greetings message by email
The current architecture is in the following picture:
Our goal is to move to this architecture:
Try to do the refactoring gradually, keeping all tests passing at all times.
Run all the tests. One test will fail. Change production code so that all tests pass.
Read the blog post and/or the included presentation.
Added Go and PHP versions thanks to Cursor and Claude