kata-business-rules
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:My solution to Dave Thomas's business rules kata; an exercise to build a maintainable solution in the face of massively changing requirements.
# It's Business Time

Welcome to my solution of the [Business Rules code kata](http://codekata.pragprog.com/2007/01/kata_sixteen_bu.html#more)!

## How to read this code

1. Start off by reading the [Business Rules code kata](http://codekata.pragprog.com/2007/01/kata_sixteen_bu.html#more) to get familiar with the requirements.
2. Start following my [commit history](https://github.com/densitypop/kata-business-rules/commits/master?page=2) from the first commit to the last to see my progression.
3. Look at the [Cucumber features](https://github.com/densitypop/kata-business-rules/tree/master/features/) to see how the program is to be run.
4. Look at the [specs](https://github.com/densitypop/kata-business-rules/tree/master/spec/lib) 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](http://github.com/densitypop/kata-business-requirements/master/commits).

## 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](http://github.com/aslakhellesoy/cucumber) for full stack testing
- [Aruba](http://github.com/aslakhellesoy/aruba) to drive Cucumber from the CLI
- [RSpec](http://github.com/rspec/rspec) for its beautiful spec-like output
- [Bundler](http://github.com/carlhuda/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


本源码包内暂不包含可直接显示的源代码文件,请下载源码包。