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
より良いコードの書き方(初級編)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
muzun
February 24, 2015
Education
340
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
より良いコードの書き方(初級編)
リーダブルコード第一部
muzun
February 24, 2015
More Decks by muzun
See All by muzun
PRML 6章 カーネル法@長岡
muzun
0
1.6k
Other Decks in Education
See All in Education
Fundamentos, Caracteristicas y Aplicaciones de los Modulos NumPy , Matplotlib y Pandas
robintux
0
240
アラムコSTEAMチャレンジ 実践報告書
codeforeveryone
0
230
Πλουτοκρατία: Η Τυραννία του Μαμμωνά και η Μεταανθρώπινη Δουλεία
amethyst1
0
310
2026年度春学期 統計学 第11回 分布の「型」を考える - 確率分布モデルと正規分布 (2026. 6. 11)
akiraasano
PRO
0
180
SFプロトタイピング体験(滝中学校)
yusk1450
PRO
0
130
Soluciones al examen de Geografía 2026. JUNIO (Convocatoria Ordinaria)
juanmartin2026
1
10k
Science Tokyo University for International Research Excellence scheme_April 2026
sciencetokyo
PRO
0
120
観察、仮説、実行、検証、計画、提案を一年で3000回トレーニングする方法/3000 Thinking Loops in 365 Days
moriyuya
5
1.3k
AIってなぁに?
kenichiota0711
0
750
Carbohydrates: Classification, Structure & Chemical Properties
pawan5505
0
210
Throw Yourself In! - How I've learned English and What I'm Facing
georgeorge
1
260
!コスパよくインターンに受かる方法!
ruribou
1
350
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
410
RailsConf 2023
tenderlove
30
1.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
How GitHub (no longer) Works
holman
316
150k
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
190
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
320
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
よりよいコードの書き方 1 / 12 1 よりよいコードの書き方 (初級編) 2015年2月24日 発表 岩橋研究室M1
木村 大輝
よりよいコードの書き方 2 / 12 2 読みやすいコードを書こう
よりよいコードの書き方 3 / 12 3 なぜ読みやすいコード? • プログラミングは共同作業 • 半年後の自分は他人
よりよいコードの書き方 4 / 12 4 気をつける点 ✔ 明確な名前 ✔ 整ったコード
✔ コードの意図をコメント
よりよいコードの書き方 5 / 12 5 明確な名前をつける tmp = (1 -
a) * d + a * s; ダメな例 変数名tmp, a, d, sが何を表しているのか分からない
よりよいコードの書き方 6 / 12 6 明確な名前をつける mixed_value = (1 -
ratio) * dest_value + ratio * src_value; 良い例 → 値を混合するコードだと推測できる
よりよいコードの書き方 7 / 12 7 整ったコードを書く details = argv[1] location
= argv[2] phone = argv[3] emal = argv[4] url = aergv[5] ダメな例 タイプミスしている
よりよいコードの書き方 8 / 12 8 整ったコードを書く details = argv[1] location
= argv[2] phone = argv[3] emal = argv[4] url = aergv[5] タイプミスしている 良い例
よりよいコードの書き方 9 / 12 9 コメントにコードの意図を書く // 重みで割る value =
value / weight; ダメな例 コメントがなくてもコードを見れば理解できる
よりよいコードの書き方 10 / 12 10 コメントにコードの意図を書く // 複数枚の画像から ratio の割合で合成
for (…) { (valueに対する繰り返し処理) weight = weight + ratio[i]; } value = value / weight; 良い例 →コメントは処理の目的を理解することを助ける
よりよいコードの書き方 11 / 12 11 まとめ 書いたコードが 読み手にとって理解しやすいか を考えよう!
よりよいコードの書き方 12 / 12 12 出典 • リーダブルコード ▶ Dustin
Boswell (著) ▶ Trevor Foucher (著) ▶ より良いコードを書くための シンプルで実践的なテクニック ▶ http://www.amazon.co.jp/dp/4873115655 • ここでの紹介事例は本書の 一例ですので一読を推奨