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
320
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
880
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
170
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
520
Ruby の型に関する活動をやっている話 / Activities related to Ruby types
euglena1215
3
280
そろそろ理解する includes / Understanding includes
euglena1215
1
860
習うより慣れる Ruby AST / Ruby AST is better to get used to than to learn.
euglena1215
2
440
Railsでエンドポイントごとのテストカバレッジを測定する / Measuring Test Coverage per Endpoint in Rails
euglena1215
1
440
初めてrails/railsにバグレポートを出してみた
euglena1215
0
210
XXXSerializer#to_json を地道に置き換えている話
euglena1215
0
150
Other Decks in Programming
See All in Programming
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
Spatial Rendering for Apple Vision Pro
warrenm
0
110
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
820
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
103 Early Hints
sugi_0000
1
230
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
790
From Translations to Multi Dimension Entities
alexanderschranz
2
130
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
テストコード書いてみませんか?
onopon
2
130
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
520
39k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Optimizing for Happiness
mojombo
376
70k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Facilitating Awesome Meetings
lara
50
6.1k
Faster Mobile Websites
deanohume
305
30k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Speed Design
sergeychernyshev
25
670
A Tale of Four Properties
chriscoyier
157
23k
Unsuck your backbone
ammeep
669
57k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
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 ΛҰՈʹҰ͍͔͕Ͱ͠ΐ͏͔ʁ