Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
より良いコードの書き方(初級編)
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
CLASSIFICATION OF CRUDE DRUGS
pawan_pharm
0
200
Comentario del plano urbano de Madrid hasta 1860 (1ª parte )
juanmartin2026
1
100k
批判的応用言語学ワークショップ(2026-08-12 お茶の⽔⼥⼦⼤学)
terasawat
0
200
観察、仮説、実行、検証、計画、提案を一年で3000回トレーニングする方法/3000 Thinking Loops in 365 Days
moriyuya
5
1.4k
実践プレゼンテーション・デザイン
dragon2
1
360
【2026年サマースクール用ZEPメタバース校舎操作ガイド】
ainischool
0
130
Requirements Analysis and Prototyping - Lecture 3 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.8k
Modulo : abc
robintux
0
220
セキュリティ担当がいない中小医療機関を院外のRISSはどう支えるべきか / How External RISS Can Help Small Medical Institutions
eller86
1
210
El Clima de España. Tema 2 (PPT)
juanmartin2026
0
7k
Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
3.5k
吉岡研究室紹介(2026年度)
kentaroy47
0
210
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
14
40k
A Tale of Four Properties
chriscoyier
163
24k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
290
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.2k
Bash Introduction
62gerente
615
220k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
480
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
330
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
440
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
380
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 • ここでの紹介事例は本書の 一例ですので一読を推奨