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
150
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
140
A Programmer’s Red Pill: Pure, Functional, and Typed
choonkeat
0
180
GraphQL for web devs who don't need it
choonkeat
1
210
TDD for people who don't need it
choonkeat
1
70
File Upload 2015
choonkeat
0
110
Other Decks in Programming
See All in Programming
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
450
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
260
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
530
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Jakarta EE meets AI
ivargrimstad
0
230
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Haze - Real time background blurring
chrisbanes
1
510
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
CSC305 Lecture 26
javiergs
PRO
0
140
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Into the Great Unknown - MozCon
thekraken
33
1.5k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
4 Signs Your Business is Dying
shpigford
181
21k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
The Cost Of JavaScript in 2023
addyosmani
45
7k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
It's Worth the Effort
3n
183
28k
The Pragmatic Product Professional
lauravandoore
32
6.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
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