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
システムリニューアルと サーバーサイドKotlin
Search
Hidenori Maehara
August 24, 2017
Technology
4
6.8k
システムリニューアルと サーバーサイドKotlin
Hidenori Maehara
August 24, 2017
Tweet
Share
More Decks by Hidenori Maehara
See All by Hidenori Maehara
How to Test Server-side Kotlin #kotlinfest
maeharin
11
39k
electron-vueで僕が考えた最強メモアプリ作っている話 / create memo app by electron-vue
maeharin
0
2.3k
10年前のレガシーシステムをVue.js TypeScript Elementでフルリニューアルしている話 #vuejs_meetup6
maeharin
18
44k
10年前のレガシーシステムをサーバーサイドKotlinでフルリニューアルしている話 #jjug_ccc #ccc_g2
maeharin
17
22k
KotlinとSpring BootとDoma2でAPIサーバーを作る #m3kt
maeharin
5
6.2k
Other Decks in Technology
See All in Technology
ナレッジグラフとLLMの相互利用
koujikozaki
0
420
LINEヤフーのフロントエンド組織・体制の紹介
lycorp_recruit_jp
1
1.2k
なにもしてないのにNew Relicのデータ転送量が増えていたときに確認したこと
tk3fftk
2
230
GC24 Recap: Interface Internals
task4233
0
130
20240912 JJUGナイトセミナー
mii1004
0
140
不動産tech Product Night#2_AIことはじめ_GA橋本
takehikohashimoto
0
190
「認証認可」という体験をデザインする ~Nekko Cloud認証認可基盤計画
logica0419
2
440
サーバー管理しないサーバーサービスManaged DevOps Pool
kkamegawa
0
130
より快適なエラーログ監視を目指して
leveragestech
4
1.4k
OCI で始める!! Red Hat OpenShift / Get Started OpenShift on OCI
oracle4engineer
PRO
1
180
実務における脅威モデリングを考えよう
nikinusu
0
620
持続可能なソフトウェア開発を支える『GitHub CI/CD実践ガイド』
tmknom
6
1.4k
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
327
20k
Why You Should Never Use an ORM
jnunemaker
PRO
53
8.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
26
1.9k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
Speed Design
sergeychernyshev
22
430
Fashionably flexible responsive web design (full day workshop)
malarkey
401
65k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
103
48k
VelocityConf: Rendering Performance Case Studies
addyosmani
322
23k
Designing Experiences People Love
moore
138
23k
Learning to Love Humans: Emotional Interface Design
aarron
270
40k
Transcript
システムリニューアルと サーバーサイドKotlin 〜Rubyエンジニア meets Kotlin〜 エムスリー株式会社 前原 @maeharin
自己紹介 • 前原 秀徳 • @maeharin(まえはりん) • エムスリー株式会社 エンジニア •
チームリーダー、グループ会社取締役等を歴任 • 自慢:ブログ記事が、はてぶ1200 ◦http://maeharin.hatenablog.com/
エムスリーって何の会社? ・医療に関するWebサービスを多数展開 ・全世界で約400万人の医師会員 ・日本で約25万人の医師会員
今、私たちは10年に一度の システムリニューアルをしてます!
システムリニューアルの対象システム 医師のキャリア支援事業 (年間売上、数十億規模)
システムリニューアルの背景 • ビジネスに対する、開発スピードの低下 とある事業の今期開発予定だけで 約600人日(2年半) という見積りが!
なぜ時間がかかる? (1)複雑なアーキテクチャ • 複数のサブシステムが存在。データとロジックが重複 • 長年の改修でアーキテクチャが限界 データ重複 200テーブル・2000カラムのう ち、半分くらい重複 ※DB以外に生Luceneも
ロジック重複 複雑な依存関係
なぜ時間がかかる? (1)複雑なアーキテクチャ • 複数のサブシステムが存在。データとロジックが重複 • 長年の改修でアーキテクチャが限界 データ重複 規模感: 200テーブル・2000カラム ※DB以外に生Luceneも
ロジック重複 複雑な依存関係 かなり簡素化してこれ...(^ω^)
主要システム Ruby on Rails なぜ時間がかかる? (2)10年前のシステムが... • ビジネス上優先度の高いシステムはRuby on Railsになっている
• しかし、相対的に優先度低いシステムは10年前のJavaシステム ◦ =>この部分の優先度が高まってきた Javaの独自FW viewの部分はXSLT! 10年前の Javaシステム 7年前の Javaシステム
補足:XSLTとは
補足:XSLTとは
補足:XSLTとは 2001〜2002年頃の技術...(^ω^)
つらい_(:3」∠)_
リニューアルだ!
リニューアル後のアーキテクチャ 重複DBや重複ロジックを廃止 APIに一元化!
リニューアル後の技術スタック 控えめに見積もって 生産性2倍以上! WEBアプリ APIサーバー スマホアプリ
SpringFoxでAPIドキュメント(Swagger)生成 APIドキュメント 自動生成
swagger-codegenでgemを自動生成 Railsアプリ用のgemを自 動生成
なぜサーバーサイドにKotlin?
背景 • Rubyエンジニア10名くらいのチーム(Javaもそこそこ) • 対象システムの規模感:200テーブル、2000カラムくらい • フロントはゆるく。コアはカッチリやりたいモチベーション ◦型が欲しい(型一揆)
Kotlin採用理由(私のチームの場合) • 型:あり。(型推論、null safetyも嬉しい) • エムスリーにはたろう (@ngsw_taro) がいる! Kotlinスタートブック絶賛発売中! エムスリー株式会社
日本Kotlinユーザーグループ代表 長澤 太郎 たろう(@ngsw_taro) • 社内共有ライブラリ:使える(JavaとRuby版が提供されている) • フレームワーク:Spring Boot(問題なし) • 言語の将来性:きっとある(Google I/OでAndroid開発公式言語に) • IDE:IntelliJ IDEA community(無料) • 学習コスト:Rubyエンジニアが親しみやすい構文(後述)
Rubyエンジニアが親しみやすい構文 少しご紹介
リスト操作 Ruby Kotlin a.map {i -> i * 10} a.reduce
{sum,n -> sum + n} a.groupBy {i -> i % 2} a.filter {i -> i % 2 == 0} a.map {|i| i * 10} a.reduce {|sum,n| sum + n} a.group_by {|i| i % 2} a.select {|i| i % 2 == 0}
Set, Range Ruby Kotlin val setA = setOf(1,1,2,3,4) val setB
= setOf(1,2,3,4,5) println(setA + setB) (1..10).forEach {println(it)} set_a = Set.new([1,1,2,3,4]) set_b = Set.new([1,2,3,4,5]) puts set_a + set_b (1..10).each {|i| puts i}
if式 Ruby Kotlin val job = if (name == "taro")
{ "エバンジェリスト" } else { "エンジニア" } job = if name == "taro" "エバンジェリスト" else "エンジニア" end
lambda Ruby Kotlin fun foo(cb: () -> Unit) { println("start")
cb() println("done") } foo({ println("doing") }) def foo(cb) puts "start" cb.call puts "done" end foo(-> { puts "doing" })
演算子オーバーロード Ruby Kotlin class Id(val int: Int) { operator fun
plus(that: Id) = Id(this.int + that.int) } val id1 = Id(1) val id2 = Id(2) println(id1 + id2) class Id attr_reader :int def initialize(int) @int = int end def +(that) Id.new(@int + that.int) end end id1 = Id.new(1) id2 = Id.new(2) p id1 + id2
拡張関数 Ruby Kotlin fun Int.p(): Unit = println(this) 1.p() class
Integer def p; puts self; end end 1.p
スクリプト言語っぽく使うことも可能 list-folders.kts import java.io.File val folders = File(args[0]).listFiles { file
-> file.isDirectory() } folders?.forEach { folder -> println(folder) } ターミナル $ kotlinc -script list-folders.kts .
親しみやすい!
リニューアルの進捗・所感 • 開始3ヶ月で進捗50%くらい • サーバーサイドKotlinは自分のチームでは正解 ◦Kotlinの動的言語と静的言語の特徴がチームにフィット ◦Kotlin x Spring Bootは問題なく動く
◦Kotlin自体の学習コストは問題にならなかった • Kotlinかわいい(^ω^)ペロペロ
エムスリー love Kotlin • 別件のリニューアルにもサーバーサイドKotlinを採用予定 • 新規Androidアプリ開発はKotlin • 新規Webアプリ開発の際にも積極的にKotlinを検討
WE'RE HIRING! Kotlinerの方々、 一緒にやりましょう!