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
90
File Upload 2015
choonkeat
0
130
Other Decks in Programming
See All in Programming
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
170
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
370
Le côté obscur des IA génératives
pascallemerrer
0
120
NetworkXとGNNで学ぶグラフデータ分析入門〜複雑な関係性を解き明かすPythonの力〜
mhrtech
3
990
Web フロントエンドエンジニアに開かれる AI Agent プロダクト開発 - Vercel AI SDK を観察して AI Agent と仲良くなろう! #FEC余熱NIGHT
izumin5210
3
380
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
230
メモリ不足との戦い〜大量データを扱うアプリでの実践例〜
kwzr
1
840
どの様にAIエージェントと 協業すべきだったのか?
takefumiyoshii
2
590
CSC509 Lecture 03
javiergs
PRO
0
330
私はどうやって技術力を上げたのか
yusukebe
43
17k
実践AIチャットボットUI実装入門
syumai
7
2.4k
ネイティブ製ガントチャートUIを作って学ぶUICollectionViewLayoutの威力
jrsaruo
0
130
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Building Adaptive Systems
keathley
43
2.8k
Why Our Code Smells
bkeepers
PRO
339
57k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.2k
The Invisible Side of Design
smashingmag
301
51k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
A designer walks into a library…
pauljervisheath
209
24k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Balancing Empowerment & Direction
lara
4
680
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