Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Surrender The Illusion of Control
Search
Steve Tooke
September 07, 2015
Programming
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Surrender The Illusion of Control
SwanseaCon 2015
Steve Tooke
September 07, 2015
More Decks by Steve Tooke
See All by Steve Tooke
Ten reasons that BDD won’t save your development process
tooky
0
560
Quality at Startup Speed
tooky
1
140
Let me tell you a Story – CukeUp! AU 2016
tooky
0
68
Intro to BDD – CukeUp! AU 2016
tooky
0
56
Extreme Startup: Socrates UK 2014
tooky
1
180
Other Decks in Programming
See All in Programming
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
350
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
540
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
480
Jetpack Compose Mechanisms
skydoves
2
430
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
230
自サークルのIdPからログアウトできるようになるまで
taiseiue
0
110
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
580
JRuby: Past, Present, and Future
headius
0
220
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
630
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
460
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Test your architecture with Archunit
thirion
2
2.4k
Typedesign – Prime Four
hannesfritz
42
3.2k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
What's in a price? How to price your products and services
michaelherold
247
13k
Optimising Largest Contentful Paint
csswizardry
37
4k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
It's Worth the Effort
3n
188
29k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
610
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Transcript
Surrender The Illusion of Control @tooky – SwanseaConf 2015
Let It Go @tooky – SwanseaConf 2015
Caveat
What is good design?
Why is good design important?
None
None
None
None
None
Reduce the Cost of Change
None
XP
TDD
JUnit
4 Rules of Simple Design
None
None
None
None
None
Your code is your understanding of the problem you're exploring.
So it's only when you have your code in your
head that you really understand the problem. 1 Paul Graham
None
Connascence
None
None
Connascence1 1. The birth of two or more things at
the same time. 2. The act of growing together 1 From wiktionary
two components are connascent if a change in one would
require the other to be modified in order to maintain the overall correctness of the system
Static Connascence 1. Connascence of Name 2. Connascence of Type
3. Connascence of Meaning 4. Connascence of Algorithm 5. Connascence of Position
Dynamic Connascence 6. Connascence of Execution 7. Connascence of Timing
8. Connascence of Value 9. Connascence of Identity
Connascence of Name
Connascence of Name class CardTest < Minitest::Test def test_high_card_beats_low_card high_card
= Card.new("10", "♥") low_card = Card.new("2", "♣") assert high_card.beats?(low_card) end end class Card < Struct.new(:rank, :suit) def beats?(other_card) true end end
Connascence of Type
Connascence of Type public class DiamondTest { @Test public void
first_row_of_A_diamond() { String diamond = Diamond.upTo("A"); assertThat(diamond, is("A")); } @Test public void first_row_of_B_diamond() { String diamond = Diamond.upTo("B"); assertThat(diamond, is("-A-")); } @Test public void first_row_of_C_diamond() { String diamond = Diamond.upTo("C"); assertThat(diamond, is("--A--")); } }
Connascence of Type public class Diamond { public static String
upTo(String letter) { if ("C".equals(letter)) { return "--" + "A" + "--"; } if ("B".equals(letter)) { return "-" + "A" + "-"; } return "A"; } }
public class DiamondTest { @Test public void first_row_of_A_diamond() { String
diamond = Diamond.upTo("A"); assertThat(diamond, is("A")); } // ... } public class Diamond { public static String upTo(String letter) { if ("C".equals(letter)) { return "--" + "A" + "--"; } if ("B".equals(letter)) { return "-" + "A" + "-"; } return "A"; } }
Connascence of Type public class DiamondTest { @Test public void
first_row_of_A_diamond() { String diamond = Diamond.upTo('A'); assertThat(diamond, is("A")); } @Test public void first_row_of_B_diamond() { String diamond = Diamond.upTo('B'); assertThat(diamond, is("-A-")); } @Test public void first_row_of_C_diamond() { String diamond = Diamond.upTo('C'); assertThat(diamond, is("--A--")); } }
Connascence of Type public class Diamond { public static String
upTo(char letter) { if ('C'.equals(letter)) { return "--" + "A" + "--"; } if ('B'.equals(letter)) { return "-" + "A" + "-"; } return "A"; } }
Connascence of Meaning
Connascence of Meaning public class Diamond { public static String
upTo(char letter) { if ('C'.equals(letter)) { return "--" + "A" + "--"; } if ('B'.equals(letter)) { return "-" + "A" + "-"; } return "A"; } }
Connascence of Name > Connascence of Meaning public class Diamond
{ public static final char START_LETTER = 'A'; public static String upTo(char letter) { if ('C'.equals(letter)) { return "--" + START_LETTER + "--"; } if ('B'.equals(letter)) { return "-" + START_LETTER + "-"; } return valueof(START_LETTER); } }
Connascence of Algorithm
Connascence of Algorithm public class Diamond { public static final
char START_LETTER = 'A'; public static String upTo(char letter) { if ('C'.equals(letter)) { return "--" + START_LETTER + "--"; } if ('B'.equals(letter)) { return "-" + START_LETTER + "-"; } return valueof(START_LETTER); } }
Connascence of Algorithm public class Diamond { public static final
char START_LETTER = 'A'; public static String upTo(char letter) { if ('C'.equals(letter)) { return "--" + START_LETTER + "--"; } if ('B'.equals(letter)) { return "-" + START_LETTER + "-"; } return "" + START_LETTER + ""; } }
Connascence of Name > Connascence of Algorithm public class Diamond
{ public static final char START_LETTER = 'A'; public static String upTo(char letter) { return padding(letter) + START_LETTER + padding(letter); } private static string padding(char letter) { int paddingSize = letter - START_LETTER; return StringUtils.repeat("-", paddingSize); } }
Connascence of Position
Connascence of Position class CardTest < Minitest::Test def test_high_card_beats_low_card high_card
= Card.new("10", "♥") low_card = Card.new("2", "♣") assert high_card.beats?(low_card) end end class Card < Struct.new(:rank, :suit) end
Connascence of Position class CardTest < Minitest::Test def test_high_card_beats_low_card high_card
= Card.new("10", "♥") low_card = Card.new("2", "♣") assert high_card.beats?(low_card) end end class Card < Struct.new(:suit, :rank) end
Connascence of Position class CardTest < Minitest::Test def test_high_card_beats_low_card high_card
= Card.new("♥", "10") low_card = Card.new("♣", "2") assert high_card.beats?(low_card) end end class Card < Struct.new(:suit, :rank) end
Connascence of Name > Position class Card def initialize(rank:, suit:)
@rank = rank @suit = suit end # ... end
Connascence of Name > Position class CardTest < Minitest::Test def
test_high_card_beats_low_card high_card = Card.new(rank: "10", suit: "♥") low_card = Card.new(suit: "♣", rank: "2") assert high_card.beats?(low_card) end end
Locality
None
None
Locality class AvailableJobs def jobs [[customer, description]] end def assign_to(worker)
jobs.each do |customer, description| # ... end end end
Locality class AvailableJobs def jobs [[description, customer]] end def assign_to(worker)
jobs.each do |customer, description| # ... end end end
Locality class CompletedJobs def jobs [[customer, description]] end end
Locality class InvoiceClerk def generate_job_invoices(jobs) jobs.each do |customer, description| #
... end end end
Degree
Degree class CompletedJobs def jobs [[customer, reference, description, start_time, finish_time,
rate]] end end
Degree class InvoiceClerk def generate_job_invoices(jobs) jobs.each do |customer, reference, description,
start_time, finish_time, rate| # ... end end end
Degree class CompletedJob attr_reader :customer, :reference, :description, :start_time, :finish_time, :rate
end
Degree class CompletedJobs def jobs [job] end end
Degree class InvoiceClerk def generate_job_invoices(jobs) jobs.each do |job| # ...
end end end
Rules
The further apart two components are use weaker forms of
connascence
When you have a high degree of connascence convert to
a weaker form of connascence
Good Design?
Connascence
Red, Green... what now?2 2 http://silkandspinach.net/2015/05/20/red-green-what-now/
Principles
SOLID
DRY
Law of Demeter
Principles
None
Questions
http://tooky.co.uk
[email protected]
@tooky
Photos good_design_1.jpg: https://www.flickr.com/photos/opalsson/ bad_design.jpg: https://www.reddit.com/r/todayilearned/comments/2dvvja/til_that_in_order_to_preserve_the_states_natural/ greenfield.jpg: https://www.flickr.com/photos/ks_marks/ stuckInTheMud.jpg: https://www.flickr.com/photos/puuikibeach/ unicorn.jpg:
https://www.flickr.com/photos/wayfinder/ jimWeirich.jpg: https://www.flickr.com/photos/fraserspeirs/ celebrate.jpg: https://www.flickr.com/photos/clement127/ modular.jpg: https://www.flickr.com/photos/rahul3/ connected.jpg: https://www.flickr.com/photos/bernd_thaller/ reduceCost.jpg: https://www.flickr.com/photos/68751915@N05/ change.jpg: https://www.flickr.com/photos/petereed/