Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Test-Driven Development
Search
Sam Starling
December 07, 2012
Programming
150
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Test-Driven Development
Sam Starling
December 07, 2012
More Decks by Sam Starling
See All by Sam Starling
Dashing
samstarling
0
90
Scala Patterns in the Linked Data Writer
samstarling
0
120
University of Manchester – Careers Talk
samstarling
0
97
Other Decks in Programming
See All in Programming
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
170
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.4k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
610
RTSPクライアントを自作してみた話
simotin13
0
630
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
130
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
13
6.2k
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
370
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
740
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
190
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
Claspは野良GASの夢をみるか
takter00
0
210
Vite+ Unified Toolchain for the Web
naokihaba
0
340
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
330
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
The SEO Collaboration Effect
kristinabergwall1
1
490
Ruling the World: When Life Gets Gamed
codingconduct
0
260
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
740
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
470
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.8k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The browser strikes back
jonoalderson
0
1.3k
Transcript
Sam Starling, BBC Future Media Test-Driven Development
Does it work the way it should? Have I broken
anything on the way? Is this task done yet?
Does it work the way it should? Have I broken
anything on the way? Is this task done yet?
Does it work the way it should? Have I broken
anything on the way? Is this task done yet?
Have I done everything I needed to? Does everything I’ve
done still work? Can I go to the pub yet?
Have I done everything I needed to? Does everything I’ve
done still work? Can I go to the pub yet?
Have I done everything I needed to? Does everything I’ve
done still work? Can I go to the pub yet?
How do you test-drive code?
RED Write a failing test GREEN Make the test pass
REFACTOR Make any changes
Why do you test-drive code?
1: Confidence
2: Documentation
function sum(a, b) { return a + b }
public function getBeacon($seedRandom = false) { // toggle a seeded
random number for unit testing if ($seedRandom) { mt_srand(0); } $beaconTokens = array( 's' => 'News', 't' => ($this->getBeaconToken() ?: 0), 'i' => ($this->getAssetId() ?: 0), 'p' => ($this->getSectionId() ?: 0), 'a' => ($this->getEdition() ?: 0), 'u' => ($this->getAsseturi() ?: 0), 'r' => 0, // http_referrer 'q' => 0, // query_string 'z' => mt_rand(1, 10000)); foreach ($beaconTokens as $key => $value) { $this->beacon .= sprintf('~RS~%s~RS~%s', $key, $value); } return $this->beacon . '~RS~'; }
itStoresABeaconValue() itUpdatesABeaconValue() itCanOverrideABeaconValue() ...
3: Coupling & Cohesion
4: Cleaner Code
Growing Object-Oriented Software Guided by Tests
It’s a skill! Learn it by using it
bbc.co.uk/jobs/digitalmediascheme Graduate Scheme
[email protected]