SlideShare a Scribd company logo
1 of 30
1Confidential Crowdworks, Inc. All Rights Reserved.
苦いお酒が好きな人のための
コードの苦味の味わい方
“熟成されたコードとその発酵方法の探求”
2016年5月29日
株式会社クラウドワークス エンジニア
安田篤史
2Confidential Crowdworks, Inc. All Rights Reserved.
皆さま、お酒はすきですか!?
3Confidential Crowdworks, Inc. All Rights Reserved.
苦い酒が好きな僕たちは
苦いコードも好きになれるはず!
(諸説あり)
4Confidential Crowdworks, Inc. All Rights Reserved.
苦いお酒が好きな人のための
コードの苦味の味わい方
“熟成されたコードとその発酵方法の探求”
2016年5月29日
株式会社クラウドワークス エンジニア
安田篤史
5Confidential Crowdworks, Inc. All Rights Reserved.
苦さを味わう3つの知識
コードの熟成
味わうタイミング
なぜ苦いコードを味わうのか
6Confidential Crowdworks, Inc. All Rights Reserved.
コードの熟成
7Confidential Crowdworks, Inc. All Rights Reserved.
 表面的その場しのぎ
 例外の例外 (任意個)
 原理主義者が作り上げたアレ
 ここじゃなかった発想の逆転
8Confidential Crowdworks, Inc. All Rights Reserved.
 表面的その場しのぎ
 例外の例外 (任意個)
 原理主義者が作り上げたアレ
 ここじゃなかった発想の逆転
9Confidential Crowdworks, Inc. All Rights Reserved.
1. 「原則としてログインしたユー
ザーは自由に記事を投稿できる」
10Confidential Crowdworks, Inc. All Rights Reserved.
1. 「原則としてログインしたユー
ザーは自由に記事を投稿できる」
2. 「ただし、閲覧専用のユーザーは
記事を投稿できなくする」
11Confidential Crowdworks, Inc. All Rights Reserved.
1. 「原則としてログインしたユー
ザーは自由に記事を投稿できる」
2. 「ただし、閲覧専用のユーザーは
記事を投稿できなくする」
3. 「ただし、下書き保存は可能とす
る」
12Confidential Crowdworks, Inc. All Rights Reserved.
1. 「原則としてログインしたユー
ザーは自由に記事を投稿できる」
2. 「ただし、閲覧専用のユーザーは
記事を投稿できなくする」
3. 「ただし、下書き保存は可能とす
る」
4. 「ただし、ブラックリストユー
ザーは下書き保存もできない」
13Confidential Crowdworks, Inc. All Rights Reserved.
1. 「原則としてログインしたユー
ザーは自由に記事を投稿できる」
2. 「ただし、閲覧専用のユーザーは
記事を投稿できなくする」
3. 「ただし、下書き保存は可能とす
る」
4. 「ただし、ブラックリストユー
ザーは下書き保存もできない」
例外は
増える!!
14Confidential Crowdworks, Inc. All Rights Reserved.
def post
current_user
.posts
.create(post_params)
end
ユーザは自由に投稿できる
15Confidential Crowdworks, Inc. All Rights Reserved.
def post
if current_user.read_only?
redirect_to :back
else
current_user
.posts
.create(post_params)
end
end
閲覧専用ユーザーはpostできない
16Confidential Crowdworks, Inc. All Rights Reserved.
def post
if current_user.read_only? 
&& !params[:draft] == “1”
redirect_to :back
else
current_user
.posts
.create(post_params)
end
end
下書きはできる
17Confidential Crowdworks, Inc. All Rights Reserved.
def post
if current_user.read_only? 
&& !params[:draft] == ”1”
redirect_to :back
else
if BlackList.listed?(current_user)
raise AccessForbiden
current_user
.posts
.create(post_params)
end
end
ブラックリストユーザは下書きできない
18Confidential Crowdworks, Inc. All Rights Reserved.
def post
if current_user.read_only? 
&& !params[:draft] == ”1”
redirect_to :back
else
if BlackList.listed?(current_user)
raise AccessForbiden
current_user
.posts
.create(post_params)
end
end
ブラックリストユーザは下書きできない
あっという
間に
くそコー
ド!!!
19Confidential Crowdworks, Inc. All Rights Reserved.
 表面的その場しのぎ
 例外の例外 (任意個)
 原理主義者が作り上げたアレ
 ここじゃなかった発想の逆転
20Confidential Crowdworks, Inc. All Rights Reserved.
味わうタイミング
21Confidential Crowdworks, Inc. All Rights Reserved.
技術的投資が
技術的負債に進化する
今その時!
22Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
23Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
未来への借金的
コードをコミット!
24Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
未来への借金的
コードをコミット!
早い!
安い!
うまい!
25Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
時間経過とともに、
メンテナンスコストが
上昇したりする
26Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
メンテナンスコストが
ビジネス的なベネフィット
を上回り、
見事な技術的負債に進化!
27Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
みずみずしい、
フレッシュな味わい
28Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
みずみずしい、
フレッシュな味わい歴史の重みを感じる
ビターな味わい
29Confidential Crowdworks, Inc. All Rights Reserved.
経過時間
みずみずしい、
フレッシュな味わい歴史の重みを感じる
ビターな味わい今ここ!!
30Confidential Crowdworks, Inc. All Rights Reserved.
なぜ、苦いコードを味わうのか

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

苦いお酒が好きな人のためのコードの苦味の味わい方

  • 1. 1Confidential Crowdworks, Inc. All Rights Reserved. 苦いお酒が好きな人のための コードの苦味の味わい方 “熟成されたコードとその発酵方法の探求” 2016年5月29日 株式会社クラウドワークス エンジニア 安田篤史
  • 2. 2Confidential Crowdworks, Inc. All Rights Reserved. 皆さま、お酒はすきですか!?
  • 3. 3Confidential Crowdworks, Inc. All Rights Reserved. 苦い酒が好きな僕たちは 苦いコードも好きになれるはず! (諸説あり)
  • 4. 4Confidential Crowdworks, Inc. All Rights Reserved. 苦いお酒が好きな人のための コードの苦味の味わい方 “熟成されたコードとその発酵方法の探求” 2016年5月29日 株式会社クラウドワークス エンジニア 安田篤史
  • 5. 5Confidential Crowdworks, Inc. All Rights Reserved. 苦さを味わう3つの知識 コードの熟成 味わうタイミング なぜ苦いコードを味わうのか
  • 6. 6Confidential Crowdworks, Inc. All Rights Reserved. コードの熟成
  • 7. 7Confidential Crowdworks, Inc. All Rights Reserved.  表面的その場しのぎ  例外の例外 (任意個)  原理主義者が作り上げたアレ  ここじゃなかった発想の逆転
  • 8. 8Confidential Crowdworks, Inc. All Rights Reserved.  表面的その場しのぎ  例外の例外 (任意個)  原理主義者が作り上げたアレ  ここじゃなかった発想の逆転
  • 9. 9Confidential Crowdworks, Inc. All Rights Reserved. 1. 「原則としてログインしたユー ザーは自由に記事を投稿できる」
  • 10. 10Confidential Crowdworks, Inc. All Rights Reserved. 1. 「原則としてログインしたユー ザーは自由に記事を投稿できる」 2. 「ただし、閲覧専用のユーザーは 記事を投稿できなくする」
  • 11. 11Confidential Crowdworks, Inc. All Rights Reserved. 1. 「原則としてログインしたユー ザーは自由に記事を投稿できる」 2. 「ただし、閲覧専用のユーザーは 記事を投稿できなくする」 3. 「ただし、下書き保存は可能とす る」
  • 12. 12Confidential Crowdworks, Inc. All Rights Reserved. 1. 「原則としてログインしたユー ザーは自由に記事を投稿できる」 2. 「ただし、閲覧専用のユーザーは 記事を投稿できなくする」 3. 「ただし、下書き保存は可能とす る」 4. 「ただし、ブラックリストユー ザーは下書き保存もできない」
  • 13. 13Confidential Crowdworks, Inc. All Rights Reserved. 1. 「原則としてログインしたユー ザーは自由に記事を投稿できる」 2. 「ただし、閲覧専用のユーザーは 記事を投稿できなくする」 3. 「ただし、下書き保存は可能とす る」 4. 「ただし、ブラックリストユー ザーは下書き保存もできない」 例外は 増える!!
  • 14. 14Confidential Crowdworks, Inc. All Rights Reserved. def post current_user .posts .create(post_params) end ユーザは自由に投稿できる
  • 15. 15Confidential Crowdworks, Inc. All Rights Reserved. def post if current_user.read_only? redirect_to :back else current_user .posts .create(post_params) end end 閲覧専用ユーザーはpostできない
  • 16. 16Confidential Crowdworks, Inc. All Rights Reserved. def post if current_user.read_only? && !params[:draft] == “1” redirect_to :back else current_user .posts .create(post_params) end end 下書きはできる
  • 17. 17Confidential Crowdworks, Inc. All Rights Reserved. def post if current_user.read_only? && !params[:draft] == ”1” redirect_to :back else if BlackList.listed?(current_user) raise AccessForbiden current_user .posts .create(post_params) end end ブラックリストユーザは下書きできない
  • 18. 18Confidential Crowdworks, Inc. All Rights Reserved. def post if current_user.read_only? && !params[:draft] == ”1” redirect_to :back else if BlackList.listed?(current_user) raise AccessForbiden current_user .posts .create(post_params) end end ブラックリストユーザは下書きできない あっという 間に くそコー ド!!!
  • 19. 19Confidential Crowdworks, Inc. All Rights Reserved.  表面的その場しのぎ  例外の例外 (任意個)  原理主義者が作り上げたアレ  ここじゃなかった発想の逆転
  • 20. 20Confidential Crowdworks, Inc. All Rights Reserved. 味わうタイミング
  • 21. 21Confidential Crowdworks, Inc. All Rights Reserved. 技術的投資が 技術的負債に進化する 今その時!
  • 22. 22Confidential Crowdworks, Inc. All Rights Reserved. 経過時間
  • 23. 23Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 未来への借金的 コードをコミット!
  • 24. 24Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 未来への借金的 コードをコミット! 早い! 安い! うまい!
  • 25. 25Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 時間経過とともに、 メンテナンスコストが 上昇したりする
  • 26. 26Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 メンテナンスコストが ビジネス的なベネフィット を上回り、 見事な技術的負債に進化!
  • 27. 27Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 みずみずしい、 フレッシュな味わい
  • 28. 28Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 みずみずしい、 フレッシュな味わい歴史の重みを感じる ビターな味わい
  • 29. 29Confidential Crowdworks, Inc. All Rights Reserved. 経過時間 みずみずしい、 フレッシュな味わい歴史の重みを感じる ビターな味わい今ここ!!
  • 30. 30Confidential Crowdworks, Inc. All Rights Reserved. なぜ、苦いコードを味わうのか

Editor's Notes

  1. こんにちは。「%タイトル」を発表させていただければと思います。クラウドワークスの方から来た安田あつしです。
  2. ところで、皆様お酒はお好きですか?甘いお酒もありますが、特にお酒は苦い方が良いという方はどれくらい、いらっしゃいますでしょうか??
  3. 時間がないので一気にいきますと、苦いお酒が好きな我々は苦いコードが大好きなはずです。異論は認めます。
  4. と、いうわけで本日は苦いコードの味わい方についてお話ししたいとおみます。。
  5. 苦さを味わうためには、次の3つの観点が重要です。一つはどうやってコードが熟成・発酵していくのかの知識、もう一つは苦味を味わうタイミングについての知識、最後はなぜ苦いコードを味わうのかというポエミーな知識です。
  6. まずは一つ目、熟成につにて見てみましょう
  7. 代表的な熟成方法はこちらに示したとおりいろいろああるのですが
  8. 例外の例外がわかりやすいところです。実例を見てきましょう。
  9. ビジネスロジックは最初は単純で、例えば「ログインしたーユーザーは記事を投稿できる」みたいなのから始まり、
  10. 例外規定が設けられ
  11. 例外の例外が設けられ
  12. 例外の例外の例外が設けられる、それがビジネスロジックです。
  13. 例外は増える!
  14. このように、ビジネスロジックの進歩によりコードの熟成は進みます。 ここに、妙な命名の変数であるとか、びっくりする依存関係などが組み合わさることで複雑な味わいのコードに仕上がっていきます。
  15. このように、ビジネスロジックの進歩によりコードの熟成は進みます。 ここに、妙な命名の変数であるとか、びっくりする依存関係などが組み合わさることで複雑な味わいのコードに仕上がっていきます。