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
GitHub Copilot を使って自作ライブラリを作ってみよう/ Let's create...
Search
Shintani Teppei
August 30, 2023
Programming
0
310
GitHub Copilot を使って自作ライブラリを作ってみよう/ Let's create your own library using GitHub Copilot!
https://timeedev.connpass.com/event/292962/
こちらのイベントでの登壇資料です
Shintani Teppei
August 30, 2023
Tweet
Share
More Decks by Shintani Teppei
See All by Shintani Teppei
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
8
820
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
160
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
440
Ruby の型に関する活動をやっている話 / Activities related to Ruby types
euglena1215
3
260
そろそろ理解する includes / Understanding includes
euglena1215
1
830
習うより慣れる Ruby AST / Ruby AST is better to get used to than to learn.
euglena1215
2
420
Railsでエンドポイントごとのテストカバレッジを測定する / Measuring Test Coverage per Endpoint in Rails
euglena1215
1
420
初めてrails/railsにバグレポートを出してみた
euglena1215
0
200
XXXSerializer#to_json を地道に置き換えている話
euglena1215
0
150
Other Decks in Programming
See All in Programming
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
160
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Contemporary Test Cases
maaretp
0
130
RubyLSPのマルチバイト文字対応
notfounds
0
120
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
530
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
110
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
How to Ace a Technical Interview
jacobian
276
23k
Six Lessons from altMBA
skipperchong
27
3.5k
How to train your dragon (web standard)
notwaldorf
88
5.7k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Being A Developer After 40
akosma
86
590k
A designer walks into a library…
pauljervisheath
203
24k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
How STYLIGHT went responsive
nonsquared
95
5.2k
Transcript
גࣜձࣾλΠϛʔɹShintani Teppei GitHub Copilot Λͬͯ ࣗ࡞ϥΠϒϥϦΛ࡞ͬͯΈΑ͏ @euglena1215 ʲϋΠϒϦου։࠵ʳGitHub CopilotͰ͘։ൃੜ࢈ੑ
ࣗݾհ ৽୩ ฏʢ@euglena1215ʣ • גࣜձࣾλΠϛʔ • όοΫΤϯυΤϯδχΞ • ͖ͳΧϨʔϧʔδϟϫΧϨʔதਏ Έͳ͞Μͷ͓͢͢ΊΧϨʔϧʔΛʮ#CopilotͰ͘։ൃੜ
࢈ੑʯͰπΠʔτϙετͯ͠ڭ͍͑ͯͩ͘͞
3
ืूਓͷਪҠ 4 ※1ɿ20224Qͱ20214Qͷൺֱ ίϩφՒʹ͓͍ͯɺ աڈʹྫΛݟͳ͍ఔͷ ՃతߴΛ࣮ݱɻ
એ λΠϛʔɺ ·ͩ GitHub Copilot for Business ༨ͬͯ·͢ɻ
એ ۀͰ GitHub Copilot Λ͍͍ͨํ λΠϛʔʂ ·ͣΧδϡΞϧ໘ஊ͔Βʂ ʮλΠϛʔ ΧδϡΞϧ໘ஊʯͰݕࡧ🔍
גࣜձࣾλΠϛʔɹShintani Teppei GitHub Copilot Λͬͯ ࣗ࡞ϥΠϒϥϦΛ࡞ͬͯΈΑ͏ @euglena1215 ʲϋΠϒϦου։࠵ʳGitHub CopilotͰ͘։ൃੜ࢈ੑ
͜Μͳํ͚ͷൃදͰ͢ • GitHub Copilot ࠷ۙΑ͘ฉ͚͘Ͳ݁ہ·ͩͬͨ͜ͱ͕ͳ͍... ◦ → GitHub Copilot ศར͡ΌΜɻͪΐͬͱ৮ͬͯΈΑ͏͔ͳ
• GitHub Copilot Λ͍͜ͳ͍ͯ͠Δํʮ͔ΔʙʯͱπΠʔτ ͠ͳ͕ΒσϞͷԠԉΛ͓ئ͍͠·͢ʂ
࣍ 1. ͳͥࣗ࡞ϥΠϒϥϦͳͷ͔ 2. ࣮ࡍʹ࣮ͯ͠ΈΔ 3. ͬͯΈͯͲ͏ײ͔ͨ͡
࣍ 1. ͳͥࣗ࡞ϥΠϒϥϦͳͷ͔ 2. ࣮ࡍʹ࣮ͯ͠ΈΔ 3. ͬͯΈͯͲ͏ײ͔ͨ͡
1. ͳͥࣗ࡞ϥΠϒϥϦͳͷ͔ ۀΞϓϦέʔγϣϯ • ݻ༗ͷυϝΠϯϩδοΫΛ࣋ͭ • ۀΞϓϦέʔγϣϯͷίʔυؙ͕ʑެ։͞Ε͍ͯΔ͜ͱগͳ͍ ʢ㲈 σʔληοτ͕গͳ͍ʣ •
ݻ༗ͷυϝΠϯϩδοΫ͕গͳ͍ • ༏लͳϥΠϒϥϦ͕Φʔϓϯιʔεͱͯͨ͘͠͞Μެ։͞Ε͍ͯΔ ʢ㲈 σʔληοτ͕ଟ͍ʣ ࣗ࡞ϥΠϒϥϦ
1. ͳͥࣗ࡞ϥΠϒϥϦͳͷ͔ ۀΞϓϦέʔγϣϯ • ݻ༗ͷυϝΠϯϩδοΫΛ࣋ͭ • ۀΞϓϦέʔγϣϯͷίʔυؙ͕ʑެ։͞Ε͍ͯΔ͜ͱগͳ͍ ʢ㲈 σʔληοτ͕গͳ͍ʣ •
ݻ༗ͷυϝΠϯϩδοΫ͕গͳ͍ • ༏लͳϥΠϒϥϦ͕Φʔϓϯιʔεͱͯͨ͘͠͞Μެ։͞Ε͍ͯΔ ʢ㲈 σʔληοτ͕ଟ͍ʣ ࣗ࡞ϥΠϒϥϦ ิɿ • ͋͘·Ͱ૬ରతͳ • ࣗۀΞϓϦέʔγϣϯΛ։ൃ͢Δࡍʹ GitHub Copilot Λ͍ͬͯͯɺੜ࢈ੑͷ্Λײ͍ͯ͡·͢ɻ • ۀΞϓϦέʔγϣϯͷ։ൃʹ͓͍ͯ GitHub Copilot ͕ ༗༻Ͱͳ͍ͱ͍͏Ͱͳ͍͜ͱΛ͝ೝ͍ࣝͩ͘͞ɻ
࣍ 1. ͳͥࣗ࡞ϥΠϒϥϦͳͷ͔ 2. ࣮ࡍʹ࣮ͯ͠ΈΔ 3. ͬͯΈͯͲ͏ײ͔ͨ͡
2. ࣮ࡍʹ࣮ͯ͠ΈΔ σϞΛ౿·͑ͳ͕Βհ͍͖ͯ͠·͢ɻ σϞͰར༻ͨ͠ιʔείʔυɿ https://github.com/euglena1215/20230830_github_copilot_demo
my_active_model gem Λ࡞தɻࠓ࣮Ͱ͖͍ͯΔͷ͜͜·Ͱɻ 2. ࣮ࡍʹ࣮ͯ͠ΈΔ - લఏ attribute :foo ͱॻ͘ͱ
ରԠͨ͠ίϯετϥΫλɺ getterɺsetter ͕ఆٛ͞ΕΔɻ
attribute ʹҾΛՃͯ͠ɺvalid? ͰܕͷݕূΛߦ͍͍ͨɻ 2. ࣮ࡍʹ࣮ͯ͠ΈΔᶃ - valid? ͷ࣮ ΫϥεͰࢦఆͨ͠ܕͱ͕Ұ க͍ͯ͠Ε
true Λฦ͢ɻ
DEMO 2. ࣮ࡍʹ࣮ͯ͠ΈΔᶃ - valid? ͷ࣮
ઃఆ͞Ε͍ͯΔશ attribute ʹରͯ͠ܕΛݕূͯ͠ ΄͍͠ͷͰఆٛ͞Εͨશ attribute ใΛฦ͢ϝ ιουΛͬͯϧʔϓΛճͦ͏ͱ͢Δͱ...
type ʹ :integer, :string ͳͲͷγϯϘϧͰ ͳ͘ɺ Integer, String ͳͲͷΫϥε͕ ͞ΕΔ͜ͱΛఆ࣮͕ͨ͠ఏҊ͞Ε
ͨɻʢ੯͍͠ʂʣ
ඞਢ߲ΛࢦఆͰ͖Δ required ΦϓγϣϯҰ ॹʹఏҊ͞Εͨɻ͋ͬͯΑͦ͞͏ɻ
ࠓճఏҊΛར༻ͤͣɺܕͷݕূͷ෦ ΛΓग़ͨ͠ valid_type? ϝιου Λ࣮͢Δ͜ͱʹɻ
private ϝιουͱͯ͠ఆٛ͠Α͏ͱ “private” · Ͱೖྗ͢Δͱ valid_type? ϝιουͷఆ͕ٛఏҊ ͞Εͯ...
type Ҿʹ߹ΘͤͯܕͷݕূΛߦ͏࣮ ͕ఏҊ͞Εͨ 🎉
boolean ͷݕূఆ͍ͯ͠ͳ͔ͬͨ ͷͷɺ͋ͬͨํ͕Αͦ͞͏ͳͷͰऔ ΓࠐΉ͜ͱʹɻ
boolean ͷݕূఆ͍ͯ͠ͳ͔ͬͨ ͷͷɺ͋ͬͨํ͕ྑͦ͞͏ͩͱߟ͑ औΓࠐΉ͜ͱʹɻ ͜ΕͰ valid? ϝιουʹΑΔ ܕͷݕূ࣮ྃ 🎉🎉🎉
to_h ΛՃͯ͠࿈ྻʢHashʣͱͯ͠ฦ͍ͨ͠ɻ 2. ࣮ࡍʹ࣮ͯ͠ΈΔᶄ - to_h ͷ࣮
DEMO 2. ࣮ࡍʹ࣮ͯ͠ΈΔᶄ - to_h ͷ࣮
ϝιου໊Λೖྗ͚ͨͩ͠ͰҰൃͰద ͳ࣮͕ఏҊ͞Εͨ 🎉
Enumerable#each_with_object ීஈ ͋·Γ͏͜ͱ͕ͳ͔ͬͨͷͰษڧʹ ͳͬͨɻ
Enumerable#each_with_object ීஈ ͋·Γ͏͜ͱ͕ͳ͔ͬͨͷͰษڧʹ ͳͬͨɻ ͜ΕͰ to_h ϝιουͷ࣮ྃ🎉🎉🎉
to_json ΛՃͯ͠JSONͱͯ͠ฦ͍ͨ͠ɻ 2. ࣮ࡍʹ࣮ͯ͠ΈΔᶅ - to_json ͷ࣮
DEMO 2. ࣮ࡍʹ࣮ͯ͠ΈΔᶅ - to_json ͷ࣮
ͪ͜Βϝιου໊Λೖྗ͢Δ͚ͩͰ ҰൃͰదͳ࣮͕ఏҊ͞Εͨ 🎉
͖ͬ͞ఆٛͨ͠ to_h ϝιου͕ ΘΕͯΔʂ
͖ͬ͞ఆٛͨ͠ to_h ϝιου͕ ΘΕͯΔʂ ͜ΕͰ to_json ϝιου ࣮ྃ🎉🎉🎉
࣍ 1. ͳͥࣗ࡞ϥΠϒϥϦͳͷ͔ 2. ࣮ࡍͲΜͳײ͡ͳͷ͔ 3. ͬͯΈͯͲ͏ײ͔ͨ͡
3. ͬͯΈͯͲ͏ײ͔ͨ͡ GitHub Copilot Λ͏͜ͱͰࣗ࡞ϥΠϒϥϦ࡞ͷϋʔυϧ͕άοͱԼ͕ͬͨʂ - ͖Δલʹ࠷ݶ্͛ΒΕΔ - ࣗ࡞ϥΠϒϥϦ͢Δલʹ͖ͯ͠·͍͕ͪ... -
GitHub Copilot Λ͑ߴʹ։ൃͰ͖ΔͷͰɺ͖Δલʹ࠷ݶͷ࣮Λ্͛ΒΕΔʂ - ֶशڭࡐͱͯ͠⭕ - ීஈΘͳ͍ϝιουͷ͍Ͳ͜ΖΛΕΔ - ϥΠϒϥϦಛ༗ͷநతͳίʔυఏҊͯ͘͠ΕΔ
3. ͬͯΈͯͲ͏ײ͔ͨ͡ GitHub Copilot Λ͏͜ͱͰࣗ࡞ϥΠϒϥϦ࡞ͷϋʔυϧ͕άοͱԼ͕ͬͨʂ - ͖Δલʹ࠷ݶ্͛ΒΕΔ - ࣗ࡞ϥΠϒϥϦ͢Δલʹ͖ͯ͠·͍͕ͪ... -
GitHub Copilot Λ͑ߴʹ։ൃͰ͖ΔͷͰɺ͖Δલʹ࠷ݶͷ࣮Λ্͛ΒΕΔʂ - ֶशڭࡐͱͯ͠⭕ - ීஈΘͳ͍ϝιουͷ͍Ͳ͜ΖΛΕΔ - ϥΠϒϥϦಛ༗ͷநతͳίʔυఏҊͯ͘͠ΕΔ ॳڃऀʹͱͬͯ։ൃͷิॿྠͱͯ͠ɺதڃɾ্ڃऀʹͱͬͯ։ൃͷ ϒʔελʔͱͯ͠ GitHub Copilot ΛҰՈʹҰ͍͔͕Ͱ͠ΐ͏͔ʁ