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
190
GraphQL for web devs who don't need it
choonkeat
1
210
TDD for people who don't need it
choonkeat
1
72
File Upload 2015
choonkeat
0
120
Other Decks in Programming
See All in Programming
『改訂新版 良いコード/悪いコードで学ぶ設計入門』活用方法−爆速でスキルアップする!効果的な学習アプローチ / effective-learning-of-good-code
minodriven
29
4.8k
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
980
WebDriver BiDiとは何なのか
yotahada3
1
100
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
390
動作確認やテストで漏れがちな観点3選
starfish719
5
880
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
450
2025.01.17_Sansan × DMM.swift
riofujimon
2
670
DMMオンラインサロンアプリのSwift化
hayatan
0
270
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
140
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
250
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
220
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
3
630
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Designing Experiences People Love
moore
139
23k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Gamification - CAS2011
davidbonilla
80
5.1k
Building Adaptive Systems
keathley
39
2.4k
Thoughts on Productivity
jonyablonski
68
4.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
How GitHub (no longer) Works
holman
312
140k
Building an army of robots
kneath
302
45k
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