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
Life Without Footguns (Part 2)
Search
Chew Choon Keat
March 26, 2021
Programming
0
180
Life Without Footguns (Part 2)
Chew Choon Keat
March 26, 2021
Tweet
Share
More Decks by Chew Choon Keat
See All by Chew Choon Keat
Life Without Footguns (Part 1)
choonkeat
0
170
A Programmer’s Red Pill: Pure, Functional, and Typed
choonkeat
0
220
GraphQL for web devs who don't need it
choonkeat
1
230
TDD for people who don't need it
choonkeat
1
91
File Upload 2015
choonkeat
0
130
Other Decks in Programming
See All in Programming
Blazing Fast UI Development with Compose Hot Reload (droidcon London 2025)
zsmb
0
450
例外処理を理解して、設計段階からエラーを見つけやすく、起こりにくく
kajitack
2
120
モテるデスク環境
mozumasu
3
1.4k
Designing Repeatable Edits: The Architecture of . in Vim
satorunooshie
0
240
AIのバカさ加減に怒る前にやっておくこと
blueeventhorizon
0
150
Migration to Signals, Resource API, and NgRx Signal Store
manfredsteyer
PRO
0
140
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
200
CSC305 Lecture 11
javiergs
PRO
0
320
予防に勝る防御なし(2025年版) - 堅牢なコードを導く様々な設計のヒント / Growing Reliable Code PHP Conference Fukuoka 2025
twada
PRO
13
2.7k
MCPサーバー「モディフィウス」で変更容易性の向上をスケールする / modifius
minodriven
4
810
自動テストのアーキテクチャとその理由ー大規模ゲーム開発の場合ー
segadevtech
0
440
CSC509 Lecture 09
javiergs
PRO
0
290
Featured
See All Featured
It's Worth the Effort
3n
187
28k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Writing Fast Ruby
sferik
630
62k
Automating Front-end Workflow
addyosmani
1371
200k
Practical Orchestrator
shlominoach
190
11k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6k
The Language of Interfaces
destraynor
162
25k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
A Tale of Four Properties
chriscoyier
161
23k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Transcript
Life Without Footguns @choonkeat March 2021
About • Basic • C, Perl, Java • Javascript &
Ruby on Rails for 10 years • Go and Elm in the past few years • @choonkeat
About • Basic • C, Perl, Java • Javascript &
Ruby on Rails for 10 years • Go and Elm in the past few years • @choonkeat How to do things How to NOT do things
Anyone happy with this? nope
Why is it common to see this? well…
It was clean when I started
Since data is all here, add a Method
A magnet to add more Method
Does every Method use all the data? nope
“You wanted a banana but what you got was a
gorilla holding the banana and the entire jungle.” — Joe Armstrong (Erlang) Funny quip
“You wanted to call the formatUserName method but you’d have
to wait for Zookeeper to boot and Kafka to connect” — Me Has costs
:. Method = Footgun banana-gorilla-jungle code is less maintainable and
less reusable
Write plain functions instead
A Function With Exact Arguments just the banana without gorilla
or jungle
A Good Thing ™ a function with exact arguments is
a maintainable and reusable unit of code
No Method = No Interface? But Interface is a Good
Thing ™, right?
❤ Interface is a Good Thing ™
Any Writer can “Write” 😘
Different Dependency Same “Write” 🥰
Can “interface” be a function?
But Different Dependency… 😖
Digression
Nobody: Functional programming articles: instead of add(3, 5) when
you curry, you can get add3(5) !!!11!!1 Digression
What’s “currying” actually good for
What’s “currying” actually good for
None
Call without that last argument…
Currying 🥘
Different Dependency Same “Write” sounds familiar?
Different Dependency Same “Write” sounds familiar?
Currying = Interface with Functions no wonder these functions are
always so simple. no ceremony to use
Implementing an “interface” is… hint: not method
sounds familiar? A Function With Exact Arguments
sounds familiar? A Function With Exact Arguments
A Good Thing ™ a function with exact arguments is
a maintainable and reusable unit of code