140 likes | 238 Views
Welcome to CAMDUG Dojo Day. Thank you to our hosts, Granta Design (We’re hiring!) Sorry for the lack of internet. Welcome! What is Software Craftsmanship? What is Test-Driven Development (TDD)?. Introduction. Pair Programming Aim for one assertion per test
E N D
Welcome to CAMDUG Dojo Day Thank you to our hosts, Granta Design (We’re hiring!) Sorry for the lack of internet
Welcome! • What is Software Craftsmanship? • What is Test-Driven Development (TDD)? Introduction
Pair Programming • Aim for one assertion per test • Give your tests fully descriptive names • TestThat_Foo_ShouldReturnBar_WhenBazIsFalse Method Name Condition Expectation Session Basics
Introduction to TDD Roman Numerals 2 paired iterations
Given a positive integer number determine its Roman numeral representation. • You cannot write numerals like IM for 999 • I can be subtracted from V and X only; X can be subtracted from L and C only; C can be subtracted from D and M only • V, L and D can never be subtracted • I = 1 • V = 5 • X = 10 • L = 50 • C = 100 • D = 500 • M = 1000 Roman Numerals Kata
Cementing your knowledge Minefield kata 2 paired iterations
Write a program to output a hint-field where each square is a * for a mine or the number of adjacent mine-squares if the square does not contain a mine. Minefield kata
Example input4 3*.....*..... • Example output*21112*10111 Minefield kata
Lunch Thanks to our sponsor Red Gate http://j.mp/rickyleeks
TDD in the real world Bank accounts 1 paired iteration
Write a system to model a bank account • Implement these three basic behaviours: • Deposit • Withdraw • Check balance Bank account
An objective work-out Bank account kata 1 paired iteration New rules http://j.mp/objectcalisthenics
One level of indentation per method • Don’t use the ELSE keyword • Wrap all primitives and Strings • First class collections • One dot per line • Don’t abbreviate • Keep all entities small • No classes with more than two instance variables • No getters/setters/properties Object calisthenics
Close Thank you for coming! Please join us at The Flying Pig