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
読みやすいコードを書くために気をつけていること/ be-careful-when-writin...
Search
Masatoshi Moritsuka
February 06, 2020
Programming
200
0
Share
読みやすいコードを書くために気をつけていること/ be-careful-when-writing-readable-code
Masatoshi Moritsuka
February 06, 2020
More Decks by Masatoshi Moritsuka
See All by Masatoshi Moritsuka
Rails の CLI ツールの書き方/writing-rails-cli-tool
sanfrecce_osaka
0
43
Time.zone.parse('dark')/time-zone-parse-dark
sanfrecce_osaka
0
110
外部APIが絡むテストをちょっといい感じに書く/a-little-nice-writing-external-api-testing
sanfrecce_osaka
0
30
gem_rbs_collection へのコントリビュートから始める Ruby の型の世界/contributing-gem-rbs-collection
sanfrecce_osaka
0
580
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
470
パターンマッチ使ってるかい?(kyobashi.rb)/use-ruby-s-pattern-matching-on-kyobashi-rb
sanfrecce_osaka
0
250
ApplicationController の継承を分割してエラーを減らした話/dividing-application-controller
sanfrecce_osaka
1
400
Input object ではじめる入力値検証/input-value-validation-using-input-object
sanfrecce_osaka
0
600
実例で学ぶRailsアプリケーションデバッグ入門 〜ログインできちゃってました編〜/rails-application-debug-introduction
sanfrecce_osaka
2
920
Other Decks in Programming
See All in Programming
GoogleCloudとterraform完全に理解した
terisuke
1
190
when storing skills in S3 file
watany
3
1.5k
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
390
Making the RBS Parser Faster
soutaro
0
680
AI Agent と正しく分析するための環境作り
yoshyum
1
140
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
5
5k
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
140
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
110
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.7k
From Formal Specification to Property Based Test
ohbarye
0
2.4k
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
190
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Speed Design
sergeychernyshev
33
1.6k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
230
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
350
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
190
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
500
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
130
4 Signs Your Business is Dying
shpigford
187
22k
Balancing Empowerment & Direction
lara
6
1.1k
Accessibility Awareness
sabderemane
1
110
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Transcript
ಡΈ͍͢ίʔυΛॻͨ͘Ίʹ ؾΛ͚͍ͭͯΔ͜ͱ ௩ɹਅ(@sanfrecce_osaka) 2020/2/6ɹOmotesando.rb #omotesandorb
ࣗݾհ ➤ ௩ ਅ ➤ GitHub: @sanfrecce-osaka ➤ Twitter: @sanfrecce_osaka
➤ Qiita: @sanfrecce_osaka ➤ 9݄: େࡕ → ொా ➤ ruby-jpͷॅਓ ➤ גࣜձࣾϥάβΠΞ
ձࣾհ ➤ RubyɾRailsͷडୗ։ൃձࣾ ➤ at ொా ➤ ձࣾͷۙลͰՈ͕͍҆ʂ ➤ ະܦݧ͔ΒͰ2ϲ݄ͷݚम༗
➤ We are hiring!
ʲએʳMachida.rb͡Ί·ͨ͠
લஔ͖ ➤ ࣮RubyMineωλͰͦ͏ͱͯ͠அ೦͠·ͨ͠ ➤ ʮؾΛ͚͍ͭͯΔ͜ͱʯͳͷͰ࣮ફͰ͖͍ͯΔͱݶΒͳ͍ ➤ Ұ෦͜Ε͔Β͍ͬͯ͜͏ͱՃͨ͠ͷ͋Γ·͢ ➤ ίʔυྫશ͘༻ҙͰ͖ͯͳ͍Ͱ͢ ➤
ҙݟɾҟ͋ΕࢦఠΒ͑Δͱ͋Γ͕͍ͨͰ͢
ΠϯλʔϑΣʔεʹؾΛ͚ͭΔ ➤ ྑ͍ΠϯλʔϑΣʔεͱ(ݸਓతݟղ) ➤ ڍಈɾҾ͕ཧղ͍͢͠ ➤ ܕ͕ͳͯ͘ཧղͰ͖Δ(͋ͬͨํ͕ศར͚ͩͲ)
ΠϯλʔϑΣʔεͷཁૉ(ϝιουͷ߹) ➤ ໊લ ➤ ɾॲཧ༰͕දݱ͞Ε͍ͯΔ͔ ➤ ೖྗ ➤ ԿΛड͚औΔ͔ ➤
͍ͭɾͲ͜Ͱड͚औΔ͔ ➤ ग़ྗ ➤ ԿΛฦ͔͢
໋໊େࣄ ➤ ͍͞͞ͳͷͰ໋໊͢Δ ➤ ୯७ͳ݅ఆࣜΛϝιουʹΓग़͢ ➤ ϒϩοΫΛprocΛฦ͢ϝιουʹΓग़͢ ➤ ໋໊ͰखΛൈ͘ͱ͋ͱͰΊͪΌͪ͘Όਏ͍ ➤
໌ͷࣗผਓ ➤ ଞਓࣗͷ಄ͷதͷίϯςΩετΘ͔Βͳ͍ ➤ ్த͔Βࢀըͨ͠ਓʹྺ࢙తܦҢഎܠΘ͔Βͳ͍
None
ͦͷଞ ➤ ࠷ॳࡶʹॻ͘ ➤ ൚༻తʹ࡞Βͳ͍ ➤ ࠷ॳ͔Β100%ೲಘͷ͍͘ίʔυॻ͚ͳ͍ ➤ ϘʔΠεΧτɾϧʔϧʹଇͬͯίʔυΛॻ͘ ➤
ׂΕ૭ཧ ➤ SOLIDݪଇ
ʲࢀߟʳSOLIDݪଇ ➤ ୯Ұͷݪଇ(Single Responsibility Principle) ➤ ΦʔϓϯɾΫϩʔζυͷݪଇ(Open/closed principle) ➤ Ϧείϑͷஔݪଇ(Liskov
substitution principle) ➤ ΠϯλʔϑΣʔεͷ๏ଇ(Interface segregation principle) ➤ ґଘؔٯసͷݪଇ(Dependency inversion principle)
ࢀߟʹͳΔ υΩϡϝϯτɾॻ੶
Ruby on RailsΛͬͨ։ൃͰࢀরͯ͠Α͍υΩϡϝϯτ https://qiita.com/hanachin_/items/76a24bcef889edb59d19
style guide ➤ ruby-style-guide ➤ https://github.com/fortissimo1997/ruby-style-guide/blob/ japanese/README.ja.md ➤ rails-style-guide ➤
https://github.com/satour/rails-style-guide/blob/master/ README-jaJA.md ➤ rspec-style-guide ➤ https://github.com/willnet/rspec-style-guide ➤ ReactVueɺCSSʹstyle-guide͕͋Δ
Ϧʔμϒϧίʔυ
ίʔυίϯϓϦʔτ
Sandi Metzຊ
ΦϒδΣΫτࢦઃܭݪଇͱ https://qiita.com/UWControl/items/98671f53120ae47ff93a
ϓϥεЋ
ίϛοτ ϝοηʔδ
ίϛοτϝοηʔδΛॻ͘ͱ͖ʹؾΛ͚͍ͭͯΔ͜ͱ https://sinsoku.hatenablog.com/entry/2019/08/17/020954
ίϛοτϝοηʔδ͔ͬ͠Γॻ͘ཧ༝ ➤ ϨϏϡΞʔָ͕ ➤ ҙਤɾഎܠ͕Θ͔Δ ➤ ίʔυΛಡ·ͳͯ͘େےΛཧղͰ͖Δ ➤ ϨϏϡʔΠָ ➤
ޙʹϖΞɾϞϒϨϏϡʔ͕͋ͬͯରԠͰ͖Δ ➤ ͋ͱͰίʔυΛಡΉਓָ ➤ ྺ࢙తܦҢ͕Θ͔Δ ➤ ಡΉࡍͷใ͕૿͑Δ
ࣗͷ߹(ۀಉ͡ײ͡Ͱ͢) https://github.com/pocke/ruboty-ruby-jp/pull/24
͝ਗ਼ௌ ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ