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
Surrender The Illusion of Control
Search
Steve Tooke
September 07, 2015
Programming
310
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
550
Quality at Startup Speed
tooky
1
140
Let me tell you a Story – CukeUp! AU 2016
tooky
0
60
Intro to BDD – CukeUp! AU 2016
tooky
0
55
Extreme Startup: Socrates UK 2014
tooky
1
150
Other Decks in Programming
See All in Programming
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.7k
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
180
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
1B+ /day規模のログを管理する技術
broadleaf
0
110
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
13
6.7k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
120
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
12
4.4k
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
350k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
13
6.3k
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
170
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.5k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
870
How to train your dragon (web standard)
notwaldorf
97
6.7k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
RailsConf 2023
tenderlove
30
1.5k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
430
Building Adaptive Systems
keathley
44
3.1k
BBQ
matthewcrist
89
10k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
400
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
GraphQLとの向き合い方2022年版
quramy
50
15k
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/