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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ryosuke Nishigami
December 13, 2022
Technology
620
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
コード生成を利用した新規プロジェクトの成功と失敗
Ryosuke Nishigami
December 13, 2022
Other Decks in Technology
See All in Technology
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
740
Code for Security プロジェクト紹介 2026年10月
yu23ki14
0
110
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
790
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
120
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
5
1.2k
Tofu-Controller lightning talk @ Containerday 2026
gionn
0
120
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
360
CTO Night|NotionのAIエージェントとFDE
kzkhykw1991
0
240
Browser Spec: Testing Hotwire with Ruby
takahashim
1
130
FinOps Agentが生んだ技術負債:コスト自動調査の落とし穴と解消までの道のり
oasis1994liveforever
2
150
⾮構造化データを価値に変える AI エージェント基盤とその組織
ivry_presentationmaterials
0
200
フィンテック養成勉強会#68
finengine
0
160
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
970
So, you think you're a good person
axbom
PRO
2
2.2k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
Building Flexible Design Systems
yeseniaperezcruz
330
41k
How to train your dragon (web standard)
notwaldorf
96
6.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Exploring anti-patterns in Rails
aemeredith
4
540
Git: the NoSQL Database
bkeepers
PRO
433
67k
Docker and Python
trallard
47
4.2k
Designing Experiences People Love
moore
143
24k
From π to Pie charts
rasagy
1
400
First, design no harm
axbom
PRO
2
1.3k
Transcript
Copyright (C) GENDA Inc. All Rights Reserved. コード生成を利用した 新規プロジェクトの成功と失敗 株式会社GENDA
西上良祐 - 2022.12.13
Copyright (C) GENDA Inc. All Rights Reserved. ・ ゲームセンターのDXプロジェクトで店舗スタッフ向けの社内ツールを開発 ・
その社内ツールのGo API実装時に得られたコード生成の成功事例と失敗事例を お伝えします 2 本日お伝えすること
Copyright (C) GENDA Inc. All Rights Reserved. ・ 自己紹介 ・
株式会社GENDAの概要 ・ ゲームセンターDXの概要 ・ コード生成の成功と失敗 ・ まとめ 3 目次
Copyright (C) GENDA Inc. All Rights Reserved. 株式会社GENDA テックリード Go
/ React.js 趣味 - オンライン麻雀 - ボドゲ - モダンアート - アヴァロン - etc. 4 にしがみりょうすけ 西上 良祐 @_nishisuke 自己紹介
Copyright (C) GENDA Inc. All Rights Reserved. 社名 代表取締役社長 設立
資本金 株式会社GENDA 申 真衣 2018年5月 23億3,228万円(資本準備金等含む) 従業員数 連結:約4,000名(パート・アルバイト含む/2022年1月末日現在) 所在地 東京都港区東新橋1-9-1 東京汐留ビルディング17F 5 GENDA概要
Copyright (C) GENDA Inc. All Rights Reserved. 6 世界中の人々の人生を より楽しく
ASPIRATION
Copyright (C) GENDA Inc. All Rights Reserved. アミューズメント施設運営事業 オンラインクレーンゲーム事業 (持株比率:100%)
株式会社GENDA GiGO Entertainment キャラクターライセンス事業 (持株比率:51%) 株式会社トーキョー キャラクター メーカーズ セールスプロモーション事業 (持株比率:100%) 株式会社エスピーエスエス 中国事業 (持株比率:79.5%) 伍彩汇业(广州)贸易有限公司 株式会社GENDA Games アミューズメントマシンレンタル事業 オンラインクレーンゲーム事業 (持株比率:100%) 株式会社GENDA 持株会社 米国事業 (持分法適用会社 持株比率:50%) Kiddleton, Inc. 株式会社ダイナモアミューズメント VRコンテンツ事業 (持分法適用会社 持株比率:20.8%) 7 GENDAグループ企業
Copyright (C) GENDA Inc. All Rights Reserved. 日本全国(約250店舗)および海外にてアミューズメント施設を運営(2022/11/15現在) 世界的な日本アニメブームを背景に、クレーンゲーム需要が急速に拡大中 8
アミューズメント施設運営
Copyright (C) GENDA Inc. All Rights Reserved. アミューズメント施設でしか遊べなかったクレーンゲームを インターネットを通じて遠隔操作し、いつでもどこでも遊べることが価値となっているサービス コロナ禍によって成長が加速化している事業
オタクレ 2022/03 サービス開始 その他のオンラインクレーンゲームサービス 9 オンラインクレーンゲーム
Copyright (C) GENDA Inc. All Rights Reserved. ・ GENDAの主要な事業の1つである、株式会社GENDA GiGO
Entertainment(以下 GGE)のアミューズメント施設運営事業のDX化 ・ ゲームセンター運営の課題 ◦ 紙を印刷し、それに加筆し作業指示をする ◦ 景品情報の参照や売上のチェックが事務室のPCでしかできない ▪ クレーンとの往復が必要 ・ 店舗の作業を効率化する店舗スタッフ用ツール「GiGO Navigation Apps」を開 発 10 ゲームセンターDXの概要
Copyright (C) GENDA Inc. All Rights Reserved. 11 システム構成と担当チーム
Copyright (C) GENDA Inc. All Rights Reserved. 12 システム構成と担当チーム
Copyright (C) GENDA Inc. All Rights Reserved. ・ REST API
・ JSONを受け取りJSONを返す ・ クリーンアーキテクチャ 13 Go APIの概要
Copyright (C) GENDA Inc. All Rights Reserved. ・ 今回のAPI実装に伴いコードを生成させた ・
そこで得られた成功事例と失敗事例を紹介 14 コード生成の成功と失敗
Copyright (C) GENDA Inc. All Rights Reserved. ・ Request/Response BodyのGoの構造体
・ DIの初期化部分 ・ DBテーブルに対応するGoの構造体 ・ インターフェイスのモック実装 ・ テストのテンプレート 15 APIを実装するにあたりコード生成したもの
Copyright (C) GENDA Inc. All Rights Reserved. 16 Request/Responce BodyのGoの構造体
Copyright (C) GENDA Inc. All Rights Reserved. ツール https://github.com/OpenAPITools/openapi-generator コマンド
生成されたGoコード抜粋 17 docker run -v "${PWD}:/local" openapitools/openapi-generator-cli generate \ -i ./path/to/openapi.yaml -g go \ -o /output/dir --package-name packagename; type PostUserRequest struct { Name *string `json:"name,omitempty"` } Request/Responce BodyのGoの構造体
Copyright (C) GENDA Inc. All Rights Reserved. 18 ・ 課題となったこと
◦ 業務委託メインで開発していたため、バリデーションに広く普及しているライブラリを採用し たくなった ▪ https://github.com/go-playground/validator ・ 結果 ◦ 生成した構造体を編集するのは現実的でなかった ◦ APIの実装からOpenAPI.ymlを生成すべきだった Request/Responce BodyのGoの構造体 失敗事例
Copyright (C) GENDA Inc. All Rights Reserved. ・ Request/Response BodyのGoの構造体
・ DIの初期化部分 ・ DBテーブルに対応するGoの構造体 ・ インターフェイスのモック実装 ・ テストのテンプレート 19 APIを実装するにあたりコード生成したもの
Copyright (C) GENDA Inc. All Rights Reserved. ツール https://github.com/google/wire コマンド
20 // 簡易的なDIのコード type Bar struct { fooer Fooer } type Fooer interface { Foo() string } type MyFooer struct {} func (b MyFooer) Foo() string { return "Hello foo" } // WireのOutput func NewBar() Bar { myFooer := &MyFooer{} bar := Bar{ fooer: myFooer, } return bar } DIの初期化部分 wire
Copyright (C) GENDA Inc. All Rights Reserved. // main.go type
Fooer interface { Foo() string } type MyFooer struct {} func (b MyFooer) Foo() string { return "Hello foo" } func provideMyFooer() MyFooer { return MyFooer{} } type Bar struct { fooer Fooer } // wire.go var Set = wire.NewSet( wire.Struct(new(MyFooer), "*"), wire.Bind(new(Fooer), new(*MyFooer)), wire.Struct(new(Bar), "*")) func NewBar() Bar { wire.Build(Set) return Bar{} } 21 DIの初期化部分 成功事例
Copyright (C) GENDA Inc. All Rights Reserved. ・ Request/Response BodyのGoの構造体
・ DIの初期化部分 ・ DBテーブルに対応するGoの構造体 ・ インターフェイスのモック実装 ・ テストのテンプレート 22 APIを実装するにあたりコード生成したもの
Copyright (C) GENDA Inc. All Rights Reserved. ツール https://github.com/xo/xo コマンド
DB ➡ Goの構造体 // 生成された構造体 type User struct { ID uint64 `json:"id"` Age uint64 `json:"age"` Name string `json:"name"` } 23 usersテーブル id SERIAL age SMALLINT UNSIGNED name VARCHAR(50) DBテーブルに対応するGoの構造体 xo schema mysql://u:p@host:3306/db -o path/to/output
Copyright (C) GENDA Inc. All Rights Reserved. ・ 行ったこと ◦
「テーブル設計 ➡ 構造体を生成」を行い、実装コストを下げようとした ・ 結果 ◦ 最初期は楽だった ◦ リレーションの設定がデフォルトだとできない ▪ 初回の生成物だけコミット、その後は人間が編集するのが正解だった 24 DBテーブルに対応するGoの構造体 成功事例 かつ 失敗事例
Copyright (C) GENDA Inc. All Rights Reserved. ・ Request/Response BodyのGoの構造体
・ DIの初期化部分 ・ DBテーブルに対応するGoの構造体 ・ インターフェイスのモック実装 ・ テストのテンプレート 25 APIを実装するにあたりコード生成したもの
Copyright (C) GENDA Inc. All Rights Reserved. ツール https://github.com/sanposhiho/gomockhandler コマンド
// main.go type Fooer interface { Foo() string } モックを生成 (生成物は次ページ) 26 インターフェイスのモック実装 gomockhandler -source=main.go -destination=m.go
Copyright (C) GENDA Inc. All Rights Reserved. // Output type
MockFooer struct { ctrl *gomock.Controller recorder *MockFooerMockRecorder } func NewMockFooer(ctrl *gomock.Controller) *MockFooer { // Snip } func (m *MockFooer) Foo() string { // Snip } // 使い方 ctrl := gomock.NewController(t) mockFooer := NewMockFooer(ctrl) mockFooer.EXPECT().Foo() .Return("Hey") 27 インターフェイスのモック実装 成功事例
Copyright (C) GENDA Inc. All Rights Reserved. ・ Request/Response BodyのGoの構造体
・ DIの初期化部分 ・ DBテーブルに対応するGoの構造体 ・ インターフェイスのモック実装 ・ テストのテンプレート 28 APIを実装するにあたりコード生成したもの
Copyright (C) GENDA Inc. All Rights Reserved. ツール https://github.com/cweill/gotests コマンド
29 テストのテンプレート gotests -all main.go // main.go type MyFooer struct {} func (b MyFooer) Foo() string { return "Hello foo" } テストテンプレートを生成 (生成物は次ページ)
Copyright (C) GENDA Inc. All Rights Reserved. func TestMyFooer_Foo(t *testing.T)
{ tests := []struct { name string b MyFooer want string }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { b := MyFooer{} if got := b.Foo(); got != tt.want { t.Errorf("MyFooer.Foo() = %v, want %v", got, tt.want) } }) } } 30 テストのテンプレート
Copyright (C) GENDA Inc. All Rights Reserved. func TestMyFooer_Foo(t *testing.T)
{ tests := []struct { name string b MyFooer want string }{ {"case1", MyFooer{}, "Hey"}, {"case2", MyFooer{}, "Foo"} } for _, tt := range tests { // Snip } } 31 テストのテンプレート 成功事例
Copyright (C) GENDA Inc. All Rights Reserved. 32 ・ 生成対象がシンプルかどうかで生成するか決める
・ 初回だけ生成するか、開発方法としてコード生成を採用するかは検討の余地が ある ・ テンプレートコードの生成は、失敗にはなりづらい まとめ
Copyright (C) GENDA Inc. All Rights Reserved. GENDA Creators Blog
募集要項/採用情報 We are hiring! 世界一のエンターテイメント企業に向けて、 エンジニアを絶賛募集中です エンターテイメントやDXに興味がある方、お待ちしています 33