Welcome to my solution of the Business Rules code kata!
- Start off by reading the Business Rules code kata to get familiar with the requirements.
- Start following my commit history from the first commit to the last to see my progression.
- Look at the Cucumber features to see how the program is to be run.
- Look at the specs to see how code works (start with order, to line item, to item).
- Contact me with any questions.
This kata focuses on being able to easily add new business rules to a system that is not very well specified. Early on I realized that the easiest way to make it flexible would be to avoid using "if" statements for business rule branching. My approach was to create an "indication" on an item that would indicate the item has extra steps required after being purchased. I saw some nice ways to use this indication right away. However, following strict BDD, "do the simplest thing that could possibly work" was my mantra. Therefore I started with an in-memory store. I was fascinated to see by the end that the requirements drove me to a fairly sophisticated implementation of the dispatch pattern. This progress is easy to see if you follow my commit history.
- I let the business requirements drive my solution
- Isolated example of command-object pattern
- RSpec specdoc output (
rspec -fd
) reads very nicely - Cucumber driving the full stack from CLI all the way down
- No "if" statements :)
- "Big ball of mud" approach made it easy to get a handle on the requirements 37e2504029ca344b9ca8db6b0181ac61c9452d52
- Had a difficult time with YAGNI at the beginning; got over it pretty quickly
- Output table isn't very flexible be2111e4005d7943db5072ef3ba2a84af21ed51a
- Started out with a "big ball of mud" covered only by a couple scenarios; no specs 37e2504029ca344b9ca8db6b0181ac61c9452d52
- Cucumber for full stack testing
- Aruba to drive Cucumber from the CLI
- RSpec for its beautiful spec-like output
- Bundler for its dependency management superpowers
git clone git://github.com/densitypop/kata-business-rules.git
cd kata-business-rules
bundle install
cucumber features
rspec spec