.NET version of Sandro Mancuso refactoring kata (see links).
git clone https://github.com/orient-man/TripServiceKata.git
cd TripServiceKata
git checkout demo-start
Useful git aliases:
prev = checkout HEAD^1
next = "!git checkout `git rev-list HEAD..demo-end | tail -1`"
goto = "!f() { git reset --hard && git clean -fd && git checkout $1; }; f"
Imagine a social networking website for travelers
- You need to be logged in to see the content
- You need to be a friend to see someone else's trips
- You cannot change production code if not covered by tests
- Just automated ("safe") refactorings (via IDE) are allowed, if needed to write the test
Start testing from shortest do deepest branch
- because getting to deepest requires big setup i.e. sample data, mocks, fakes etc.)
- allows to understand better what the code does
Starting from the deepest branch to the shortest (different than testing)
- method does too much (feature envy)
- Single Responsibility Principle!
- Write readable and maintainable code
- code must express business rules
- Strive for simplicity
- Know your tools well (i.e. frameworks, editor)
- Work in small and safe increments
- commit often
- Embrace change, be brave
- Boy scout rule / No broken windows