Skip to content

My solution to Dave Thomas's business rules kata; an exercise to build a maintainable solution in the face of massively changing requirements.

Notifications You must be signed in to change notification settings

densitypop/kata-business-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

It's Business Time

Welcome to my solution of the Business Rules code kata!

How to read this code

  1. Start off by reading the Business Rules code kata to get familiar with the requirements.
  2. Start following my commit history from the first commit to the last to see my progression.
  3. Look at the Cucumber features to see how the program is to be run.
  4. Look at the specs to see how code works (start with order, to line item, to item).
  5. Contact me with any questions.

Focus

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.

What went well

  • 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

What went not so well

  • 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

Tools

  • 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

Run it yourself

git clone git://github.com/densitypop/kata-business-rules.git
cd kata-business-rules
bundle install
cucumber features
rspec spec

About

My solution to Dave Thomas's business rules kata; an exercise to build a maintainable solution in the face of massively changing requirements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages