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
160
A Programmer’s Red Pill: Pure, Functional, and Typed
choonkeat
0
220
GraphQL for web devs who don't need it
choonkeat
1
220
TDD for people who don't need it
choonkeat
1
90
File Upload 2015
choonkeat
0
130
Other Decks in Programming
See All in Programming
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
2.2k
複雑なドメインに挑む.pdf
yukisakai1225
5
1.2k
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
AIコーディングAgentとの向き合い方
eycjur
0
270
rage against annotate_predecessor
junk0612
0
170
為你自己學 Python - 冷知識篇
eddie
1
350
概念モデル→論理モデルで気をつけていること
sunnyone
1
110
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.6k
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
430
個人軟體時代
ethanhuang13
0
320
Featured
See All Featured
Docker and Python
trallard
45
3.6k
Done Done
chrislema
185
16k
Balancing Empowerment & Direction
lara
3
620
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
The Pragmatic Product Professional
lauravandoore
36
6.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
GraphQLとの向き合い方2022年版
quramy
49
14k
Navigating Team Friction
lara
189
15k
A Modern Web Designer's Workflow
chriscoyier
696
190k
The Invisible Side of Design
smashingmag
301
51k
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