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
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Life Without Footguns (Part 2)
Chew Choon Keat
March 26, 2021
More Decks by Chew Choon Keat
See All by Chew Choon Keat
Life Without Footguns (Part 1)
choonkeat
0
190
A Programmer’s Red Pill: Pure, Functional, and Typed
choonkeat
0
250
GraphQL for web devs who don't need it
choonkeat
1
250
TDD for people who don't need it
choonkeat
1
110
File Upload 2015
choonkeat
0
150
Other Decks in Programming
See All in Programming
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
500
New "Type" system on PicoRuby
pocke
1
470
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
320
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.2k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
540
3Dシーンの圧縮
fadis
1
650
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
440
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.5k
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
320
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
0
140
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
250
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
430
Faster Mobile Websites
deanohume
310
31k
GraphQLとの向き合い方2022年版
quramy
50
15k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
It's Worth the Effort
3n
188
29k
Become a Pro
speakerdeck
PRO
31
6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Google's AI Overviews - The New Search
badams
0
1k
How to Talk to Developers About Accessibility
jct
2
220
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
What's in a price? How to price your products and services
michaelherold
247
13k
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