SlideShare a Scribd company logo
Scala Frustrations
in Real Development
Naoki Takezoe
@takezoen

NTT-DATA INTELLILINK
Abstract
• Scala is pretty good for real development.
• However Scala has also some bad points.
• Please note for these points when you introduce
  Scala into real development.
Scala 300 Recipes from Shoeisha
• Includes 300 Practical Scala
  Recipes.
• from Basic Scala topics to
  frameworks and tools.

Covers Play2, Akka, sbt, scaladoc, ScalaIDE,
ScalaTest, Specs2, Scalatra, ScalaQuery,
Anorm, Casbah, spray, scala-io, scala-time,
sjson, util-eval, scalaxb, Dispatch and more.
Why we are using Scala?
• Decrease costs of system development.
• We felt the limit of Java several years ago.
• Scala might be a breakthrough?
About Our Project
• Porting Java based web application to Scala.
• Over 170 HTMLs and 40,000 lines.
• 5 members on 6 months.

Before                        After
 Seasar2                      Play2 (Customized)
 Apache Click                 ScalaQuery (Cuztomized)
 S2JDBC                       PostgreSQL
 PostgreSQL + Tsearch         Apache Solr
 Raw JavaScript               jQuery + jQuery UI
Benefits of Scala
• Decrease amount of source code
 ▫ 40%-50% OFF
 ▫ Better abstraction techniques
• Decrease bugs
 ▫ More type safe
 ▫ Immutable data types
• Java Interoperability
 ▫ Many Java based Frameworks and Libraries are
   available
 ▫ Easy to port existing Java software
Benefits of Scala
• Decrease amount of source code
 ▫ 40%-50% OFF
 ▫ Better abstraction techniques
 Flexibility and Safety
• Decrease bugs
 ▫ More type safe
 ▫ Immutable data types
• Java Interoperability
 ▫ Many Java based Frameworks and Libraries are
   available
 ▫ Easy to port existing Java software
Scala Frustrations
Long compilation time
• Compilation is so much heavy.
• Painful for large application development.
Solution
 Buy high spec machines
 Asynchronous and automated build
ScalaIDE is heavy
• We meet a sandglass frequently.
Solution
 1. Turn off the incremental builder
 2. Turn off the code completion
 3. Try other IDE or text editor
sbt is NOT Simple Build Tool
• When we get a trouble, difficult to find a reason.
• Rapid version up causes compatibility problem
  of sbt plugins.
Solution
 We really need SBT in Action!
Scala Frustrations
Long compilation time
• Many code generation and template compilation.
• Development mode is slow also.
Solution
 Buy high spec machines
 Divide large project
 play2-fastassets decreases request
Inflexible Validation
• Client-side validation is not provided.
• Error Message can’t be contained field name.
Solution
 Original client-side validation framework
 based on Play2’s form definition

 Original helper to display error messages
Anorm is too simple
•   We have to write all SQL.
•   Magic does not already exist.
•   SQL is not type safe.
•   No support for dynamic SQL.
Solution
 Use other ORMs such as ScalaQuery.
 We used a combination of scalaquery-magic
 scalagen and mirage-scala.
Function22 Problem in form definition
• a.k.a. Tuple22 Problem
• Form can not have over 18 properties.
 val userForm = Form(
   mapping(
    "firstName“      -> text,
    "lastName“       -> text,
    "mailAddress“    -> email,
    "password“       -> text,
    ...                               Max   18 properties
    "tel“            -> text,
    "mobile“         -> text,
    "company“        -> text,
    "department“     -> text
   )(UserInfo.apply)(UserInfo.unapply)
 )
Solution
 Nested definition, BUT it’s not expectable.
   val userForm = Form(
     mapping(
      "firstName"      -> text,
      "lastName"       -> text,
      "mailAddress"    -> email,
      "password"       -> text,
      "companyInfo" -> mapping(
       "company"       -> text,
       "department"    -> text
      )(CompanyInfo.apply)(CompanyInfo.unapply)
     )(UserInfo.apply)(UserInfo.unapply)
   )
No Servlet and HttpSession
• Hard to port existing Java based web apps.
• We want to run Play2 on the servlet container by
  un-technical reasons.
Solution
 play2-war-plugin packs Play2 apps to war.

 play2-httpsession provides HttpSession
 by using with play2-war-plugin.
Scala Frustrations
solr-scala-client
https://github.com/takezoe/solr-scala-client

• Simple wrapper of SolrJ for Scala.
• Query converter using parser combinator.
import jp.sf.amateras.solr.scala._

val client = new SolrClient("http://localhost:8983/solr")

val result = client.query("name: ?name?")
 .getResultAsMap(Map("name" -> "ThinkPad & X201s"))
  // => name:("ThinkPad" AND "X201s")

result.documents.foreach { doc: Map[String, Any] =>
  ...
}
scalagen
https://github.com/takezoe/scalagen

•   Code Generator from RDBMS.
•   Supports Anorm and ScalaQuery in the current version.
•   Easy to add support for other ORMs.
•   Work as CLI and sbt plugin.
seq(jp.sf.amateras.scalagen.ScalagenPlugin.scalagenSettings: _*)

scalagenConfiguration := jp.sf.amateras.scalagen.Settings(
  // for ScalaQuery
  generator = new jp.sf.amateras.scalagen.ScalaQueryGenerator(),
  // for Anorm
  //generator = new jp.sf.amateras.scalagen.ScalaQueryGenerator(),
  driver = "org.hsqldb.jdbcDriver",
  url = "jdbc:hsqldb:hsql://localhost/",
  username = "sa",
  password = ""
)
scalaquery-magic
https://github.com/shimamoto/scalaquery-magic

• Extends ScalaQuery.
• Make a Magic (like old Anorm’s Magic) by code
  generation using scalagen.
    val userInfoDao = new UserInfoDao()
    // SELECT by ID
    val userInfo = userInfoDao.selectById(1)
    // INSERT
    userInfoDao.insert(UserInfo(DEFAULT[Int], 'userName', 'password'))
    // UPDATE
    userInfoDao.update(userInfo.copy(userName = 'newName'))
    // DELETE by ID
    userInfoDao.deleteById(1)
mirage-scala
https://github.com/takezoe/mirage-scala

• SQL Centric ORM similar to Anorm.
• Executable SQL template called 2waySQL.
SLEECT USER_ID, USER_NAME, PASSWORD
FROM USER_INFO
/*BEGIN*/
WHERE
  /*IF userId != null*/
   USER_ID = /*userId*/1
  /*END*/
 /*IF userId != null*/
   USER_NAME = /*userName*/ 'takezoe'
  /*END*/
/*END*/
play2-httpsession
https://github.com/takezoe/play2-httpsession

• Provide HttpSession for Play2 applications.
• Work with play2-war-plugin.
import jp.sf.amateras.play2.httpsession.HttpSessionSupport._

def index = Action { implicit request =>
 // retrieve the object from HttpSession
 val value: Option[String] = HttpSession[String]("key")

    Ok(value).withHttpSession {
      // store objects into HttpSession
      "key" -> "value"
    }
}
play2-fastassets
https://github.com/takezoe/play2-fastassets

• Decrease amount of request to external CSS,
  JavaScript and images by browser cache.
@(title: String)(content: Html)
@import jp.sf.amateras.play2.fastassets.FastAssets
<!DOCTYPE html>
<html>
 <head>
  <title>@title</title>
  <link rel="stylesheet" media="screen" href="@FastAssets.at("stylesheets/main.css")">
  <link rel="shortcut icon" type="image/png" href="@FastAssets.at("images/favicon.png")">
  <script src="@FastAssets.at("javascripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
 </head>
 <body>
  @content
 </body>
</html>
Scala Frustrations
Scala is practical
• You are evangelists of Scala.
• Please introduce Scala in your work.
• But so carefully, especially in the large project.
Scala is now glowing up!
• This way along which Java passed.
• Time will solve these problems.
• We can contribute Scala glowing.
Scala Frustrations
Ad

More Related Content

What's hot (20)

스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용
스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용
스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용
Sungchul Park
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
DjangoCon2008
 
The DOM is a Mess @ Yahoo
The DOM is a Mess @ YahooThe DOM is a Mess @ Yahoo
The DOM is a Mess @ Yahoo
jeresig
 
Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!
Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!
Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!
async_io
 
ニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみよう
genta kaneyama
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6
장현 한
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NET
Tomas Jansson
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder Ruby
Nick Sieger
 
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram VaswaniHigh Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
vvaswani
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHP
Mariano Iglesias
 
Java FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's GuideJava FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's Guide
Stephen Chin
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7
Dongho Cho
 
Oracle adapters for Ruby ORMs
Oracle adapters for Ruby ORMsOracle adapters for Ruby ORMs
Oracle adapters for Ruby ORMs
Raimonds Simanovskis
 
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
Jeongkyu Shin
 
Dropwizard
DropwizardDropwizard
Dropwizard
Scott Leberknight
 
HTML,CSS Next
HTML,CSS NextHTML,CSS Next
HTML,CSS Next
지수 윤
 
ゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクトゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクト
Ryuichi ITO
 
MongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksMongoDB: tips, trick and hacks
MongoDB: tips, trick and hacks
Scott Hernandez
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & Express
Christian Joudrey
 
No REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystNo REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and Catalyst
Jay Shirley
 
스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용
스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용
스프링 코어 강의 2부 - Java 구성을 활용한 스프링 코어 사용
Sungchul Park
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
DjangoCon2008
 
The DOM is a Mess @ Yahoo
The DOM is a Mess @ YahooThe DOM is a Mess @ Yahoo
The DOM is a Mess @ Yahoo
jeresig
 
Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!
Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!
Using npm to Manage Your Projects for Fun and Profit - USEFUL INFO IN NOTES!
async_io
 
ニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみようニコニコ動画を検索可能にしてみよう
ニコニコ動画を検索可能にしてみよう
genta kaneyama
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6
장현 한
 
Getting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NET
Tomas Jansson
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder Ruby
Nick Sieger
 
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram VaswaniHigh Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani
vvaswani
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHP
Mariano Iglesias
 
Java FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's GuideJava FX 2.0 - A Developer's Guide
Java FX 2.0 - A Developer's Guide
Stephen Chin
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7
Dongho Cho
 
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
연구자 및 교육자를 위한 계산 및 분석 플랫폼 설계 - PyCon KR 2015
Jeongkyu Shin
 
ゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクトゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクト
Ryuichi ITO
 
MongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksMongoDB: tips, trick and hacks
MongoDB: tips, trick and hacks
Scott Hernandez
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & Express
Christian Joudrey
 
No REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystNo REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and Catalyst
Jay Shirley
 

Similar to Scala Frustrations (20)

Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
Kazuhiro Sera
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
scalaconfjp
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterprise
Rafael Bagmanov
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
e-Legion
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
Scala Italy
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
Alberto Paro
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Codemotion
 
Gradle
GradleGradle
Gradle
Return on Intelligence
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
Jim Manico
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
WO Community
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
Luka Zakrajšek
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Full Stack Scala
Full Stack ScalaFull Stack Scala
Full Stack Scala
Ramnivas Laddad
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
Sunghyouk Bae
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
Ivan Ma
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
Richard Rodger
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
Richard Rodger
 
Wider than rails
Wider than railsWider than rails
Wider than rails
Alexey Nayden
 
Scala and Spring
Scala and SpringScala and Spring
Scala and Spring
Eberhard Wolff
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
JAX London
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
Kazuhiro Sera
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
scalaconfjp
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterprise
Rafael Bagmanov
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
e-Legion
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
Scala Italy
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
Alberto Paro
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Codemotion
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
Jim Manico
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
WO Community
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
Luka Zakrajšek
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
Ivan Ma
 
Introducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.jsIntroducing the Seneca MVP framework for Node.js
Introducing the Seneca MVP framework for Node.js
Richard Rodger
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
JAX London
 
Ad

More from takezoe (20)

Journey of Migrating Millions of Queries on The Cloud
Journey of Migrating Millions of Queries on The CloudJourney of Migrating Millions of Queries on The Cloud
Journey of Migrating Millions of Queries on The Cloud
takezoe
 
GitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by ScalaGitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by Scala
takezoe
 
Testing Distributed Query Engine as a Service
Testing Distributed Query Engine as a ServiceTesting Distributed Query Engine as a Service
Testing Distributed Query Engine as a Service
takezoe
 
Revisit Dependency Injection in scala
Revisit Dependency Injection in scalaRevisit Dependency Injection in scala
Revisit Dependency Injection in scala
takezoe
 
How to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applicationsHow to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applications
takezoe
 
頑張りすぎないScala
頑張りすぎないScala頑張りすぎないScala
頑張りすぎないScala
takezoe
 
GitBucket: Git Centric Software Development Platform by Scala
GitBucket:  Git Centric Software Development Platform by ScalaGitBucket:  Git Centric Software Development Platform by Scala
GitBucket: Git Centric Software Development Platform by Scala
takezoe
 
Non-Functional Programming in Scala
Non-Functional Programming in ScalaNon-Functional Programming in Scala
Non-Functional Programming in Scala
takezoe
 
Scala警察のすすめ
Scala警察のすすめScala警察のすすめ
Scala警察のすすめ
takezoe
 
Scala製機械学習サーバ「Apache PredictionIO」
Scala製機械学習サーバ「Apache PredictionIO」Scala製機械学習サーバ「Apache PredictionIO」
Scala製機械学習サーバ「Apache PredictionIO」
takezoe
 
The best of AltJava is Xtend
The best of AltJava is XtendThe best of AltJava is Xtend
The best of AltJava is Xtend
takezoe
 
Scala Warrior and type-safe front-end development with Scala.js
Scala Warrior and type-safe front-end development with Scala.jsScala Warrior and type-safe front-end development with Scala.js
Scala Warrior and type-safe front-end development with Scala.js
takezoe
 
Tracing Microservices with Zipkin
Tracing Microservices with ZipkinTracing Microservices with Zipkin
Tracing Microservices with Zipkin
takezoe
 
Type-safe front-end development with Scala
Type-safe front-end development with ScalaType-safe front-end development with Scala
Type-safe front-end development with Scala
takezoe
 
Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016
takezoe
 
Macro in Scala
Macro in ScalaMacro in Scala
Macro in Scala
takezoe
 
Java9 and Project Jigsaw
Java9 and Project JigsawJava9 and Project Jigsaw
Java9 and Project Jigsaw
takezoe
 
Reactive database access with Slick3
Reactive database access with Slick3Reactive database access with Slick3
Reactive database access with Slick3
takezoe
 
markedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVMmarkedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVM
takezoe
 
ネタじゃないScala.js
ネタじゃないScala.jsネタじゃないScala.js
ネタじゃないScala.js
takezoe
 
Journey of Migrating Millions of Queries on The Cloud
Journey of Migrating Millions of Queries on The CloudJourney of Migrating Millions of Queries on The Cloud
Journey of Migrating Millions of Queries on The Cloud
takezoe
 
GitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by ScalaGitBucket: Open source self-hosting Git server built by Scala
GitBucket: Open source self-hosting Git server built by Scala
takezoe
 
Testing Distributed Query Engine as a Service
Testing Distributed Query Engine as a ServiceTesting Distributed Query Engine as a Service
Testing Distributed Query Engine as a Service
takezoe
 
Revisit Dependency Injection in scala
Revisit Dependency Injection in scalaRevisit Dependency Injection in scala
Revisit Dependency Injection in scala
takezoe
 
How to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applicationsHow to keep maintainability of long life Scala applications
How to keep maintainability of long life Scala applications
takezoe
 
頑張りすぎないScala
頑張りすぎないScala頑張りすぎないScala
頑張りすぎないScala
takezoe
 
GitBucket: Git Centric Software Development Platform by Scala
GitBucket:  Git Centric Software Development Platform by ScalaGitBucket:  Git Centric Software Development Platform by Scala
GitBucket: Git Centric Software Development Platform by Scala
takezoe
 
Non-Functional Programming in Scala
Non-Functional Programming in ScalaNon-Functional Programming in Scala
Non-Functional Programming in Scala
takezoe
 
Scala警察のすすめ
Scala警察のすすめScala警察のすすめ
Scala警察のすすめ
takezoe
 
Scala製機械学習サーバ「Apache PredictionIO」
Scala製機械学習サーバ「Apache PredictionIO」Scala製機械学習サーバ「Apache PredictionIO」
Scala製機械学習サーバ「Apache PredictionIO」
takezoe
 
The best of AltJava is Xtend
The best of AltJava is XtendThe best of AltJava is Xtend
The best of AltJava is Xtend
takezoe
 
Scala Warrior and type-safe front-end development with Scala.js
Scala Warrior and type-safe front-end development with Scala.jsScala Warrior and type-safe front-end development with Scala.js
Scala Warrior and type-safe front-end development with Scala.js
takezoe
 
Tracing Microservices with Zipkin
Tracing Microservices with ZipkinTracing Microservices with Zipkin
Tracing Microservices with Zipkin
takezoe
 
Type-safe front-end development with Scala
Type-safe front-end development with ScalaType-safe front-end development with Scala
Type-safe front-end development with Scala
takezoe
 
Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016
takezoe
 
Macro in Scala
Macro in ScalaMacro in Scala
Macro in Scala
takezoe
 
Java9 and Project Jigsaw
Java9 and Project JigsawJava9 and Project Jigsaw
Java9 and Project Jigsaw
takezoe
 
Reactive database access with Slick3
Reactive database access with Slick3Reactive database access with Slick3
Reactive database access with Slick3
takezoe
 
markedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVMmarkedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVM
takezoe
 
ネタじゃないScala.js
ネタじゃないScala.jsネタじゃないScala.js
ネタじゃないScala.js
takezoe
 
Ad

Recently uploaded (20)

Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 

Scala Frustrations

  • 1. Scala Frustrations in Real Development Naoki Takezoe @takezoen NTT-DATA INTELLILINK
  • 2. Abstract • Scala is pretty good for real development. • However Scala has also some bad points. • Please note for these points when you introduce Scala into real development.
  • 3. Scala 300 Recipes from Shoeisha • Includes 300 Practical Scala Recipes. • from Basic Scala topics to frameworks and tools. Covers Play2, Akka, sbt, scaladoc, ScalaIDE, ScalaTest, Specs2, Scalatra, ScalaQuery, Anorm, Casbah, spray, scala-io, scala-time, sjson, util-eval, scalaxb, Dispatch and more.
  • 4. Why we are using Scala? • Decrease costs of system development. • We felt the limit of Java several years ago. • Scala might be a breakthrough?
  • 5. About Our Project • Porting Java based web application to Scala. • Over 170 HTMLs and 40,000 lines. • 5 members on 6 months. Before After  Seasar2  Play2 (Customized)  Apache Click  ScalaQuery (Cuztomized)  S2JDBC  PostgreSQL  PostgreSQL + Tsearch  Apache Solr  Raw JavaScript  jQuery + jQuery UI
  • 6. Benefits of Scala • Decrease amount of source code ▫ 40%-50% OFF ▫ Better abstraction techniques • Decrease bugs ▫ More type safe ▫ Immutable data types • Java Interoperability ▫ Many Java based Frameworks and Libraries are available ▫ Easy to port existing Java software
  • 7. Benefits of Scala • Decrease amount of source code ▫ 40%-50% OFF ▫ Better abstraction techniques Flexibility and Safety • Decrease bugs ▫ More type safe ▫ Immutable data types • Java Interoperability ▫ Many Java based Frameworks and Libraries are available ▫ Easy to port existing Java software
  • 9. Long compilation time • Compilation is so much heavy. • Painful for large application development.
  • 10. Solution Buy high spec machines Asynchronous and automated build
  • 11. ScalaIDE is heavy • We meet a sandglass frequently.
  • 12. Solution 1. Turn off the incremental builder 2. Turn off the code completion 3. Try other IDE or text editor
  • 13. sbt is NOT Simple Build Tool • When we get a trouble, difficult to find a reason. • Rapid version up causes compatibility problem of sbt plugins.
  • 14. Solution We really need SBT in Action!
  • 16. Long compilation time • Many code generation and template compilation. • Development mode is slow also.
  • 17. Solution Buy high spec machines Divide large project play2-fastassets decreases request
  • 18. Inflexible Validation • Client-side validation is not provided. • Error Message can’t be contained field name.
  • 19. Solution Original client-side validation framework based on Play2’s form definition Original helper to display error messages
  • 20. Anorm is too simple • We have to write all SQL. • Magic does not already exist. • SQL is not type safe. • No support for dynamic SQL.
  • 21. Solution Use other ORMs such as ScalaQuery. We used a combination of scalaquery-magic scalagen and mirage-scala.
  • 22. Function22 Problem in form definition • a.k.a. Tuple22 Problem • Form can not have over 18 properties. val userForm = Form( mapping( "firstName“ -> text, "lastName“ -> text, "mailAddress“ -> email, "password“ -> text, ... Max 18 properties "tel“ -> text, "mobile“ -> text, "company“ -> text, "department“ -> text )(UserInfo.apply)(UserInfo.unapply) )
  • 23. Solution Nested definition, BUT it’s not expectable. val userForm = Form( mapping( "firstName" -> text, "lastName" -> text, "mailAddress" -> email, "password" -> text, "companyInfo" -> mapping( "company" -> text, "department" -> text )(CompanyInfo.apply)(CompanyInfo.unapply) )(UserInfo.apply)(UserInfo.unapply) )
  • 24. No Servlet and HttpSession • Hard to port existing Java based web apps. • We want to run Play2 on the servlet container by un-technical reasons.
  • 25. Solution play2-war-plugin packs Play2 apps to war. play2-httpsession provides HttpSession by using with play2-war-plugin.
  • 27. solr-scala-client https://github.com/takezoe/solr-scala-client • Simple wrapper of SolrJ for Scala. • Query converter using parser combinator. import jp.sf.amateras.solr.scala._ val client = new SolrClient("http://localhost:8983/solr") val result = client.query("name: ?name?") .getResultAsMap(Map("name" -> "ThinkPad & X201s")) // => name:("ThinkPad" AND "X201s") result.documents.foreach { doc: Map[String, Any] => ... }
  • 28. scalagen https://github.com/takezoe/scalagen • Code Generator from RDBMS. • Supports Anorm and ScalaQuery in the current version. • Easy to add support for other ORMs. • Work as CLI and sbt plugin. seq(jp.sf.amateras.scalagen.ScalagenPlugin.scalagenSettings: _*) scalagenConfiguration := jp.sf.amateras.scalagen.Settings( // for ScalaQuery generator = new jp.sf.amateras.scalagen.ScalaQueryGenerator(), // for Anorm //generator = new jp.sf.amateras.scalagen.ScalaQueryGenerator(), driver = "org.hsqldb.jdbcDriver", url = "jdbc:hsqldb:hsql://localhost/", username = "sa", password = "" )
  • 29. scalaquery-magic https://github.com/shimamoto/scalaquery-magic • Extends ScalaQuery. • Make a Magic (like old Anorm’s Magic) by code generation using scalagen. val userInfoDao = new UserInfoDao() // SELECT by ID val userInfo = userInfoDao.selectById(1) // INSERT userInfoDao.insert(UserInfo(DEFAULT[Int], 'userName', 'password')) // UPDATE userInfoDao.update(userInfo.copy(userName = 'newName')) // DELETE by ID userInfoDao.deleteById(1)
  • 30. mirage-scala https://github.com/takezoe/mirage-scala • SQL Centric ORM similar to Anorm. • Executable SQL template called 2waySQL. SLEECT USER_ID, USER_NAME, PASSWORD FROM USER_INFO /*BEGIN*/ WHERE /*IF userId != null*/ USER_ID = /*userId*/1 /*END*/ /*IF userId != null*/ USER_NAME = /*userName*/ 'takezoe' /*END*/ /*END*/
  • 31. play2-httpsession https://github.com/takezoe/play2-httpsession • Provide HttpSession for Play2 applications. • Work with play2-war-plugin. import jp.sf.amateras.play2.httpsession.HttpSessionSupport._ def index = Action { implicit request => // retrieve the object from HttpSession val value: Option[String] = HttpSession[String]("key") Ok(value).withHttpSession { // store objects into HttpSession "key" -> "value" } }
  • 32. play2-fastassets https://github.com/takezoe/play2-fastassets • Decrease amount of request to external CSS, JavaScript and images by browser cache. @(title: String)(content: Html) @import jp.sf.amateras.play2.fastassets.FastAssets <!DOCTYPE html> <html> <head> <title>@title</title> <link rel="stylesheet" media="screen" href="@FastAssets.at("stylesheets/main.css")"> <link rel="shortcut icon" type="image/png" href="@FastAssets.at("images/favicon.png")"> <script src="@FastAssets.at("javascripts/jquery-1.7.1.min.js")" type="text/javascript"></script> </head> <body> @content </body> </html>
  • 34. Scala is practical • You are evangelists of Scala. • Please introduce Scala in your work. • But so carefully, especially in the large project.
  • 35. Scala is now glowing up! • This way along which Java passed. • Time will solve these problems. • We can contribute Scala glowing.