Created
          May 11, 2014 21:23 
        
      - 
      
- 
        Save jonathonnordquist/35d5e66dc9e07a2829ba to your computer and use it in GitHub Desktop. 
Revisions
- 
        jonathonnordquist revised this gist May 11, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ Intro ===== Lots of untested software out there. Can make progress without process, keep info in head and just fire it out (bad thing.) 
- 
        jonathonnordquist created this gist May 11, 2014 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ Lots of untested software out there. Can make progress without process, keep info in head and just fire it out (bad thing.) Other professions don't do this. Professionals design first, then make stuff. Results are better and faster (stronger, harder.) Process is what matters, it adds structure to production and improves quality. Some people don't bother with tests or only test afterword. Lots of things are part of the process inclding conventions, standards, ect. TDD is part of the process. Tests document code, catch future errors, save time. Tests just a tool. TDD Process =========== - Decide what the code will do - Write a test that will pass if the code does that thing - Run the test, see it fail - Write code - Run the test, see it past - Keep repeating process for everything Very important to see the test fail first, bad tests don't fail at all and that's no use. When back testing, write code, break the code, see it fail, fix the code. Advantages ========== - Design and plan before you code - Document design - Proof that code implements design - *Encourage desing of testable code* Building the plan gives better results! Testable Code == Good Code Backtesting can reveal overly complicated code. Tests first prevent over complication because the tests themselves are simple. Testable code is: ================= - Modular - Decoupled design - Methods of limited scope - Smaller methods - Reduced cyclometic complexity (measure of how many paths there are through the code) Red/Green: after writing code and gettin pass then refactor. TDD leads to immediate gains in code speed (even if it doesn't feel this way.) ------------------------------------------------------------------------------ Getting to the awesome takes time to learn! =========================================== Rules suck. These aren't laws written in stone. Use judgement. ================================================================ - Some things are too hard to test - Some tests are too trivial to be useful - Overtesting is possible, don't repeat tests - Exploratory coding without tests is OK, back test and refactor if the exploratory code is going to be production code (spike and stabalize)