Más contenido relacionado
La actualidad más candente (20)
Similar a Scalable Generator: Using Scala in SIer Business (ScalaMatsuri) (20)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
- 1. Scalable Generator: Using Scala in SIer Business
2014.9.6
Yugo
Maede
!
TIS
Inc.
Copyright © 2014 TIS Inc. All rights reserved.
- 2. My profile
Work
in
Strategic
technology
center
of
TIS
Inc.!
have built in-house application framework and tools!
Evaluating Scala!
Koka-Ninja!
Twitter : @yugolf
• TIS株式会社 戦略技術センター!
• 社内エンジニアリング基盤の構築!
• Scalaの活用検証!
• 甲賀忍者
自己紹介
Copyright © 2014 TIS Inc. All rights reserved. 2
- 3. My articles
執筆記事紹介
-‐ ITPro “Is it easy to switch the build tool from Maven to Gradle?”!
-‐ @IT “Your dream will definitely come true. What is Web Components?”!
-‐ CodeZine “Introduction to Play Framework”
• ITPro 「ビルドツールの移行性 MavenからGradleへの乗り換えは容易か」!
• @IT 「あなたの知らない超絶便利なWebを叶える仕様Web Componentsとは」!
• CodeZine 「ScalaのWebアプリケーションフレームワーク「Play Framework」入門」
TIS技術ブログ
Tech-‐Sketch
http://tech-‐sketch.jp/
Copyright © 2014 TIS Inc. All rights reserved. 3
- 4. Agenda
Background!
A barriers of using Scala!
Introduce code generator!
Demonstration!
Summary •背景!
アジェンダ
•Scala採用の壁!
•コードジェネレータの紹介!
•デモ!
•まとめ
Copyright © 2014 TIS Inc. All rights reserved. 4
- 5. Background : About TIS
-‐ TIS
is
System
Integrator
Entrusted development on various scale!
!
-‐ Our cover fields!
TISについて
The enterprise like bank, insurance, credit card, manufacturing
and so on
• SIer 大・中・小 受託開発!
• 主な対象分野 金融・カード・産業!
!
Copyright © 2014 TIS Inc. All rights reserved. 5
- 6. Background : Our activities in the past
To
improve
the
efficiency
of
development
これまでの取り組み
-‐ In-‐house
application
framework
(for
development
by
Java)!
-‐ Code generator!
-‐ Development tools and guide (for test, CI etc)!
-‐ Training for developer in my company!
-‐ about framework, Jenkins, Maven, JUnit etc
• 生産性の向上を目指して
• 社内向けアプリケーション開発基盤
(=Java)!
• コードジェネレータ!
• 開発効率化ツール/ガイド(テスト効率化・CI etc)!
• 社内教育!
• フレームワーク・Jenkins・Maven・JUnit etc
Copyright © 2014 TIS Inc. All rights reserved. 6
- 7. More Improvement
更なる改革
It’s
difficult
to
improve
the
efficiency
only
by
framework,
generator,
and
some
tools.
focus on improving of programing itself!
Java ▶︎ Scala Generator
Libraries Java
Scala
CI
Test
Tool
Framework
Libraries
Libraries
フレームワーク・ジェネレータ・その他周辺ツールの整備だけでは困難!
プログラミングそのものの効率化へ
Copyright © 2014 TIS Inc. All rights reserved. 7
- 8. The barrie of using Scala
-‐ A
shortage
of
tools
and
libraries
for
developing
enterprise
applications
-‐ Stability-‐oriented
customers
and
developers!
-‐ Difficult to learn and teach Scala!
!
-‐ Can we really improve the efficiency of development by Scala?
Scalaを採用する壁
• エンタープライズ向けのライブラリやツールの不足
• 安定志向の開発現場や顧客!
• 習得や教育の難しさ!
!!
本当にScalaで開発が効率化出来るのか?
Copyright © 2014 TIS Inc. All rights reserved. 8
- 9. How does development change by switching to
-‐ The
number
of
codes
decrease
compared
to
Java.
-‐ If
we
master
Scala,
productivity
must
increase.
-‐ Can't
completely
say
that
it
has
rapid
effect,
but
it
has
high
potential.
-‐ After
all,
Does
it
depends
on
personal
ability?
!
-‐ Yes.
I’d
like
to
make
the
following;
Scalaで何が変わる?
excellent
developers
can
show
their
ability.
• Scalaの簡潔性によりJavaに比べコード量が激減する。
• Scalaの習熟度があがれば生産性が上がる。
• 決して、即効性は高いとは言えないが大きな伸びしろを秘めている。
• 結局プログラマの能力次第?
• Yes。能力の高いプログラマが力を発揮できる世界を作りたい。
Copyright © 2014 TIS Inc. All rights reserved. 9
- 10. Is that true? The number of steps will decrease.
If the total amount of source codes decreased, but we need to decrease
the programing part except framework.
auto
Xenlon
Seasar2
Java
Framework Application
hand
made
hand
made
hand
made
Play2
全体のコード量が減ったとしても、実装量が減らないと意味がない。
Copyright © 2014 TIS Inc. All rights reserved.
Scala
Framework Application
the
previous
development using
Scala/Play2
10
hand
made
本当に実装コードは減る?
- 11. hand
made
auto
Xenlon
Seasar2
Copyright © 2014 TIS Inc. All rights reserved.
hand
made
auto
How shall we solve?
We should automate programing which is able to be automated.!
-> need a Code Generator
add-‐on
Play2
自動化出来るところは自動化する。 ▶ コードジェネレータ
11
解決するには?
Java
Framework Application
the
previous
development
Scala
Framework Application
using
Scala/Play2
- 12. Automation by the code generator
コードジェネレータによる自動化
-‐ Automate
simple
works,
and
programers
focus
on
essential
business
logics.
-‐ The
automation
isn't
100%,
it's
important
to
develop
business
logic
by
hand
-‐ automate
-‐ The
structure
of
code
does
not
depend
on
programing
language.
-‐ The
code
depends
on
a
framework.
-‐ not
automate
-‐ Business
logic
• 機械的に実装出来る部分は自動化し、プログラマーは本質的な ビジネスロジックの実装に注力
• 100%自動生成ではなく、ビジネスロジックをScalaで実装する事に価値
<自動化>
• 実装言語によって構造が変わらない部分(シンプルにならない)
• フレームワークによって記述が異なる部分(FWの壁)
<非自動化>
• ビジネスロジック
Copyright © 2014 TIS Inc. All rights reserved. 12
- 13. Generator features
-‐ Based
on
Play
Framework
and
Slick
(Typesafe
products).
-‐ Source
codes
are
generated
from
DB
schema.
ジェネレータの特徴
-‐ Import
Application
structures
into
the
Repository
in
the
generating
process.
-‐ Allow
you
to
edit
the
application
structures
in
the
repository.
-‐ Don't
have
to
install,
because
provided
by
"Typesafe
Activator".
• Play
Framework
/
Slick対応のTypesafeプロダクト準拠
• DBスキーマ情報からソースコードをジェネレート
• アプリケーション構造をリポジトリ登録
• アプリケーション構造をリポジトリに格納し編集可能
• Typesafe
Activator
のテンプレートで提供するため環境構築不要
Copyright © 2014 TIS Inc. All rights reserved. 13
- 14. For Play Framework and Slick
Play Framework と Slick
-‐ We
can
trust
and
use
them,
because
they
are
developed
by
Typesafe
who
develop
Scala.
-‐ De
facto
standard(!?)
-‐ It
uses
Slick
code
generator
and
follow
its
policy.
• Scala開発企業であるTypesafeが開発/サポートしているため安心
• 定番フレームワークに!?
• Slickコードジェネレータを活用し、そのポリシーを踏襲
Copyright © 2014 TIS Inc. All rights reserved. 14
- 15. Generating flow when using the code generator
1. When
execute
Scaffold,
it
imports
information
for
generating
an
application
into
design
repository,
and
generate
source
codes.
(4) edit repository
Copyright © 2014 TIS Inc. All rights reserved.
(2) generate source code!
from database
Database
Schema
Design
Repository
Route
Controller
View
Model
Form
Dao
(1) create design repository
(3) generate source code!
from repository
(5) regenerate
Web Application
2. Edit
design
repository
and
re-‐generate
source
code.
15
ジェネレート生成のフロー
- 16. Design Repository
The
table
structure
and
relations
Screens
!
Screen
ID
Screen
Type
Screen
Entities
!
Screen
ID
Entity
Name
1
*
Screen
Items
!
Screen
ID
Item
No
Domain
Code
Search
Condition
Component
Type
Domains
!
Domain
Code
1
*
Validations
*
0..1
!
Domain
Code
Validation
Code
Validation
Attribute
Validation
Value
設計リポジトリ
-‐ Create
-‐ Search
-‐ Update
-‐ =
-‐ !=
-‐ >
-‐ <
-‐ contains
…etc
-‐ text
-‐ select
-‐ checkbox
-‐ radio
…etc
-‐ text
-‐ bigDecimal
-‐ number
…etc
1
1
Copyright © 2014 TIS Inc. All rights reserved. 16
- 17. Edit design repository
設計リポジトリの変更
The
codes
are
improved
into
a
practical
application
by
editing
design
repository.
Scalable Generator
設計リポジトリを編集することで、Scaffoldから実
用的なアプリケーションへ進化させる。
Copyright © 2014 TIS Inc. All rights reserved. 17
- 18. Generated codes
When
you
edit
design
repository,
generated
source
codes
change
.
生成されたコード
change into partial match by changing Search condition.
case
class
EventSearchData(
@(==
@field)
eventId:
Option[String],
@(contains
@field)
eventNm:
Option[String],
…)
change into required by checking required.
val
eventCreateForm
=
Form(
mapping(
“eventId”
-‐>
nonEmptyText(maxLength=10),
“eventNm”
-‐>
optional(text(maxLength=100),
…)…
change into select list by changing Component
@helper.inputText(eventSearchForm(“eventId”))
@helper.select(eventSearchForm(“place”),
…)
Copyright © 2014 TIS Inc. All rights reserved. 18
- 19. Don’t have to install
環境構築不要
-‐ You
don't
have
to
install,
because
it's
provided
as
one
of
the
template
of
Typesafe
Activator.
-‐ When
you
execute
a
command,
can
build
blank
project.
$ activator new <application name> skalholt
Skalholt Template
Library
Skalholt
code
generator
Typesafe
Activatorのテンプレートの1つとして提供するため環境構築不要
コマンド一つでブランクプロジェクトが出来上がる。
Copyright © 2014 TIS Inc. All rights reserved. 19
- 20. Demonstration
Required:Typesafe
Activator
is
installed
https://typesafe.com/platform/getstarted
!
デモ
!
!
!
▶︎ http://localhost:9000/
▶︎ http://localhost:9001/
▶︎ check the application
!
▶︎ check the application
1. activator new
2. h2-browser
3. activator run
4. skalholt-ui
5. generate
6. modify repository
7. regenerate
Copyright © 2014 TIS Inc. All rights reserved. 20
- 21. What problem is solved by the generator?
何が解決されたのか?
-‐ A
shortage
of
tools
and
libraries
for
develop
enterprise
applications
-‐ >The
number
of
codes
to
be
written
by
programers
is
decreased
by
the
code
generator.
-‐ Stability-‐oriented
customers
and
developers
-‐ >Improve
the
basic
quality
by
the
code
generator!
-‐ Difficult to learn and educate Scala!
-‐ >the barrier is minimized by programing based on generated codes.
• エンタープライズ向けのライブラリやツールの不足
▶ ジェネレータにより実装するコード量の削減
• 安定志向の開発現場や顧客
▶ ジェネレータによる品質の底上げ!
• 習得や教育の難しさ!
▶ ジェネレートされたコードをベースとした実装による障壁の軽減
Copyright © 2014 TIS Inc. All rights reserved. 21
- 22. The biggest barrie? Find/Train an engineer of Scala.
-‐ Learning
materials
are
already
prepared
now.
-‐ If
you
feel
a
barrier
for
using
Scala,
would
you
start
from
Play?
-‐ If
you
feel
a
barrier
for
using
Play,
would
you
start
from
Skalholt?
!
-‐ I'd
like
you
to
use
Skalholt
not
only
for
improving
the
efficiency
of
development
but
also
for
learning
Scala.
• 勉強する環境は整っている。
•Scalaに障壁を感じている人はPlayから始めて見ませんか?
•Playに障壁を感じている人はSkalholtから始めて見ませんか?
!
• 開発を効率化するだけでなく、Scalaを習得するためのツールとして
活用して欲しい。
Copyright © 2014 TIS Inc. All rights reserved. 22
- 23. Javaエンジニアの私がやったこと
What I have done as a Java engineer.
-‐ Converted
sample
application
on
a
Java
based
framework
into
Scala
application.
-‐ Converted
some
of
the
features
of
the
framework
to
be
use
by
Scala.
-‐ Evaluated
Scala
on
real
project.
-‐ Held
a
study
session
for
our
company.
-‐ Took
Typesafe
training.
-‐ Took
a
course
of
Odersky
on
Coursera.
“Functional
Programing
Principles
in
Scala”
• Java製FW上のサンプルアプリをPlay2+Scalaにコンバート
• Java製FWの持つ機能をScalaから使えるように
• 実プロジェクトで検証
• 社内向けの勉強会開催
• Typesafeのトレーニング受講
• Coursera受講
:
Functional
Programing
Principles
in
Scala
Copyright © 2014 TIS Inc. All rights reserved. 23
- 24. How to use Skalholt.
Please
look
at
GitHub
Pages
http://tech-‐sketch.github.io/skalholt/
If
you
want
to
generate
customized
code,
please
get
source
code
from
GitHub
• OSSとして公開しました!
GitHub
Pagesをご覧下さい。
Skalholtは使えるの?
!
• 自分向けのコードをジェネレートするにはGitHubから
-‐ Have
released
it
!-‐
Copyright © 2014 TIS Inc. All rights reserved. 24