1. Scala 開発事例
2013/3/2
株式会社システムアート
益子健一
System Art, Inc.
Kenichi Masuko
kenichi-scala-conference-2013@sysart.jp
2. クラウド就業システム
Time Recording Cloud System
• 2010 年に開発開始。初期投資が一巡し、数ヶ月前から営業が行われている。
The project started in 2010. The initial investment has completed, and the system is being introduced to the customers now.
• クラウドと名前が付いているが個社別のカスタマイズが多い。
Even though the word “cloud” suggests that the system provides a uniform service to all the customer organizations, in
reality there are heavily customized business logics and web pages for each organization.
• カスタマイズは個社別にパラメーターを制御するパッケージ方式では対応しきれないため、個社別にロジックを
記述するコストを最小限にする方式。ここで Scala DSL が生きる。
Because there are so many ways to handle timesheets, the customizations are implemented by custom code for each
organization rather than parameter settings. However, the cost of implementing them must be minimal, hence Scala DSL.
• 難しいと言われる病院・大学を含む 10 社へ導入済み。社食で何を食べるかを勤務予定で登録して集計し給与シス
テムへ連携するなど、予期外のカスタマイズも結構ある。また 100 年以上歴史がある法人だと、あちこち
が・・・変わってる。
The system has been deployed to 10 organizations, including university and hospital, which are said to have complex
requirements. An example of customization: employees submit what they eat for lunch (provided by organization), as a
part of attendance plan.
• 現在のコードは10万行。 Java で同じ機能を再現したら 3 倍以上にはなるはず。
The system has 100,000 lines of code. If we write the same system in Java, we feel it would require more than 300,000
lines.
• 現在までのプロジェクト規模は開発だけで約 90 人月。
The development has consumed roughly 90 man-month so far.
• Scala 2.8 から 2.9 へのバージョンアップは簡単だったが 2.9 から 2.10 は尐し手間がかかった。 Java に比べると後
方互換性が低く、長期プロジェクトでは不安が残る。
The migration from Scala 2.8 to 2.9 was trivial, but 2.9 to 2.10 needed some work. Backward compatibilities are weaker
than Java and it might be difficult to explain the migration cost when Java doesn’t have the cost.
4. PDF署名タイムスタンプサービス
PDF Timestamp Service (PAdES LTV)
• 元々は Java で実装されていたシステム。機能追加・改訂毎に対象部分を Scala へ移行。
The system was originally implemented entirely in Java. As new features are added, the involving classes have been
migrated to Scala gradually.
• Spring などのフレームワークや JPA などのライブラリが組み込まれているが Scala へ移行しても全く問題が出てい
ない。(ある意味当たり前・・・)
The system is partly based on Spring framework, and employs a number of libraries such as JPA. However, replacing Java
classes with Scala classes have never caused a problem. (No wonder)
• 銀行/ 証券 / 保険 / 総合電機などが顧客にあり、品質保証が厳格に行われているシステム。
Customers include bank / fund / insurance / manufacturer, and the system undergo a sequence of strict quality assurances.
• コードレビューは Java しか読めない電子署名専門家のために Scala の説明をはさみながら進めている。
Code review has been done with small Scala lectures for digital signature specialists who can only read Java.
5. その他
Misc.
• 社外の Java 熟練者に Scala プロジェクトに参加してもらった際、だいたい 1, 2 週間で Scala コードを読めるように
なり、 2, 3 週間で業務コードを書けるようになった。
When external Java veterans join our Scala projects, they can read the Scala code in 1-2 weeks, and write business code in 2-
3 weeks.
• C から C++ へ移行した時の経験が生きる。例えばオペレーターオーバーローディングは勝手に作っては駄目と
か。
The experience when we migrated from C to C++ is valuable. For example, operator overloading is forbidden unless I am
convinced.
• Java の言語としての進化が足踏みして C# に抜かれている感じだったが Scala で Java 実行環境が息を吹き返したよ
うに見える。
It appears to me that the innovations of Java language has been somewhat stagnated, and those of C# might have gotten
ahead, but Scala renewed the significance of Java Runtime environment.