SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Vaadin+Scala
Why?
- Simple programming model
- Secure
- No javascript
- Beautiful
Simple programming model
- Abstracted from HTTP
- No request/response/session mess
- All AJAX
- Just a web page
Secure
- All server-side
- Validations
- No code on client
- CSRF, XSS protection built-in
No javascript
- No bad parts
- Good parts still accessible
- Built on GWT
- Large test suite for each browser
Beautiful
- Mature codebase
- Thinking of U and I
- Widgets and addons
- Themes
Performance
- Almost every event is handled on server
- Optimized wire format
- No page reload
- Static content
Performance vs PrimeFaces
Scalability Study - QuickTickets
+Scala
mandatory ugly java slide
+Scala
6    class TransactionPage(controller:TransactionController=new TransactionController) extends BasePage
{
7     model.params = params
8     compositionRoot = new VerticalLayout {
9       val form = new Form {
10        caption = 'hello
11        val beanItem = new BeanItem(model) {
12          item = this
13          visibleItemProperties = propertyIds().filter(_ != "progress")
14        }
15        field("price").foreach { p =>
16          p.required = true
17          p.validators += >=(10.0)
18        }
19      }
20      components ++=
21          Button('check, Notification.show(model.toString)) ::
22              Button('start, validated(form)(controller.start(done))) ::
23              form ::
24              new ProgressIndicator {property = form.beanItem.property("progress")} ::
25              Nil
26    }
27    def done = Notification.show('done, Type.Tray)
28    def model = controller.model
29   }
+Scaladin
- wraps Vaadin api into idiomatic Scala
- closures, Options, etc.
+Scala => declarative
- comparable to JSON
1   {"transactionPage": {
2    "controller": "TransactionController",
3    "compositionRoot": {
4      "type": "VerticalLayout",
5      "components": [
6        {
7          "type": "Button",
8          "caption": "hello"
....
9         }
10      ]
11    }
12   }}


- no need to reference view from controller
- statically checked
- support for HTML templates
+Scala => inline constructors
class TransactionPage(controller: TransactionController = new TransactionController) extends BasePage {
//body goes here
}
+Scala => DelayedInit
8      trait BasePage extends CustomComponent with Validations   with DelayedInit   {
9       var params: String = ""
...
16         def init(params: String) = {
17           this.params = params
18          initCode.foreach(_())
19      }
20     }
14      case class TabView(name: String)(content: => Seq[Component] = stubContent(name))
15          extends VerticalLayout with View {
16        def enter(event: ViewChangeEvent) {
17          //showing that state persists and lazy loading is possible
18          val params = event.getParameters
19          content.collect {
20            case page: BasePage => add(page).init(params)
21            case view => add(view)
22          }
23          Notification.show("Entered " + name + " with params " + params)
24        }
25      }
class TransactionPage(controller: TransactionController = new TransactionController) extends BasePage {
     model.params = this.params
+Scala => callbacks and HOFs
Button('start, validated(form)(controller.start(done)))

def apply(caption: String, clickListener: => Unit): Button

def validated(form: Form)(action: => Unit)

def start(done: => Unit)


- increase code reuse
- decrease coupling
+Scala => symbols
- localization
- natural names
caption = 'hello
implicit def translateSymbol(s: Symbol) = s"${s.name} locale:${self.locale}"
implicit def translateTuple[T](s: (Symbol, T))
                                (implicit toParams: T => TranslationParams) =
translateSymbol(s._1).format(toParams(s._2).p: _*)

validators += >=(10.0)
 def >=[T](bound: T)(implicit ord: Ordering[T]): Option[Any] => Validation = {
    import ord._; v => v match {
        case Some(v: T) if v >= bound => Valid
        case _ => Invalid(Symbol("should be greater %s") -> bound :: Nil)
      }
  }
+Scala => structural types

- navigate in nested objects
val form = new Form {
      val beanItem = new BeanItem(model) {
...
form.beanItem.property("progress")




- eliminate dependencies
trait Translation {self: {def locale: Option[Locale]} =>
+JRebel
- Reloading classes as if they were templates
- Free for Scala
- Free for Vaadin Pro users
Thank you!
    Q&A

Mais conteúdo relacionado

Mais procurados

Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Roel Hartman
 
JSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret WeaponJSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret Weapon
Pete Gamache
 
exportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxexportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailbox
Daniel Gilhousen
 

Mais procurados (20)

Tweaking the interactive grid
Tweaking the interactive gridTweaking the interactive grid
Tweaking the interactive grid
 
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
 
JSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret WeaponJSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret Weapon
 
Ngrx
NgrxNgrx
Ngrx
 
첫 리액트 경험기
첫 리액트 경험기첫 리액트 경험기
첫 리액트 경험기
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 
Creating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with googleCreating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with google
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScript
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Angular 2.0 forms
Angular 2.0 formsAngular 2.0 forms
Angular 2.0 forms
 
Chekout demistified
Chekout demistifiedChekout demistified
Chekout demistified
 
Relay Modern: architecture and workflow
Relay Modern: architecture and workflowRelay Modern: architecture and workflow
Relay Modern: architecture and workflow
 
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
 
React&redux
React&reduxReact&redux
React&redux
 
Angular 2.0 Pipes
Angular 2.0 PipesAngular 2.0 Pipes
Angular 2.0 Pipes
 
React redux
React reduxReact redux
React redux
 
exportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailboxexportDisabledUsersRemoveMailbox
exportDisabledUsersRemoveMailbox
 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
 
Angular 2.0 - What to expect
Angular 2.0 - What to expectAngular 2.0 - What to expect
Angular 2.0 - What to expect
 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
 

Semelhante a Vaadin+Scala

Lift 2 0
Lift 2 0Lift 2 0
Lift 2 0
SO
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
IndicThreads
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
vhazrati
 

Semelhante a Vaadin+Scala (20)

Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Lift 2 0
Lift 2 0Lift 2 0
Lift 2 0
 
The Ring programming language version 1.8 book - Part 50 of 202
The Ring programming language version 1.8 book - Part 50 of 202The Ring programming language version 1.8 book - Part 50 of 202
The Ring programming language version 1.8 book - Part 50 of 202
 
RichFaces: more concepts and features
RichFaces: more concepts and featuresRichFaces: more concepts and features
RichFaces: more concepts and features
 
RESTful API using scalaz (3)
RESTful API using scalaz (3)RESTful API using scalaz (3)
RESTful API using scalaz (3)
 
Rails 6 frontend frameworks
Rails 6 frontend frameworksRails 6 frontend frameworks
Rails 6 frontend frameworks
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 
Scala based Lift Framework
Scala based Lift FrameworkScala based Lift Framework
Scala based Lift Framework
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184
 
The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapperSF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
SF Scala meet up, lighting talk: SPA -- Scala JDBC wrapper
 
MVC Performance, Ember.js
MVC Performance, Ember.jsMVC Performance, Ember.js
MVC Performance, Ember.js
 
AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFaces
 
Web-First Design Patterns
Web-First Design PatternsWeb-First Design Patterns
Web-First Design Patterns
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Chaincode Development 區塊鏈鏈碼開發
Chaincode Development 區塊鏈鏈碼開發Chaincode Development 區塊鏈鏈碼開發
Chaincode Development 區塊鏈鏈碼開發
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
 

Mais de Vasil Remeniuk

Spark Intro by Adform Research
Spark Intro by Adform ResearchSpark Intro by Adform Research
Spark Intro by Adform Research
Vasil Remeniuk
 
Types by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaTypes by Adform Research, Saulius Valatka
Types by Adform Research, Saulius Valatka
Vasil Remeniuk
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform Research
Vasil Remeniuk
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
Vasil Remeniuk
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
Vasil Remeniuk
 
Spark by Adform Research, Paulius
Spark by Adform Research, PauliusSpark by Adform Research, Paulius
Spark by Adform Research, Paulius
Vasil Remeniuk
 
Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)
Vasil Remeniuk
 
Spark intro by Adform Research
Spark intro by Adform ResearchSpark intro by Adform Research
Spark intro by Adform Research
Vasil Remeniuk
 
SBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius ValatkaSBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius Valatka
Vasil Remeniuk
 

Mais de Vasil Remeniuk (20)

Product Minsk - РТБ и Программатик
Product Minsk - РТБ и ПрограмматикProduct Minsk - РТБ и Программатик
Product Minsk - РТБ и Программатик
 
Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14Работа с Akka Сluster, @afiskon, scalaby#14
Работа с Akka Сluster, @afiskon, scalaby#14
 
Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14Cake pattern. Presentation by Alex Famin at scalaby#14
Cake pattern. Presentation by Alex Famin at scalaby#14
 
Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3Scala laboratory: Globus. iteration #3
Scala laboratory: Globus. iteration #3
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 
Spark Intro by Adform Research
Spark Intro by Adform ResearchSpark Intro by Adform Research
Spark Intro by Adform Research
 
Types by Adform Research, Saulius Valatka
Types by Adform Research, Saulius ValatkaTypes by Adform Research, Saulius Valatka
Types by Adform Research, Saulius Valatka
 
Types by Adform Research
Types by Adform ResearchTypes by Adform Research
Types by Adform Research
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Scalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex GryzlovScalding by Adform Research, Alex Gryzlov
Scalding by Adform Research, Alex Gryzlov
 
Spark by Adform Research, Paulius
Spark by Adform Research, PauliusSpark by Adform Research, Paulius
Spark by Adform Research, Paulius
 
Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)Scala Style by Adform Research (Saulius Valatka)
Scala Style by Adform Research (Saulius Valatka)
 
Spark intro by Adform Research
Spark intro by Adform ResearchSpark intro by Adform Research
Spark intro by Adform Research
 
SBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius ValatkaSBT by Aform Research, Saulius Valatka
SBT by Aform Research, Saulius Valatka
 
Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1Scala laboratory. Globus. iteration #1
Scala laboratory. Globus. iteration #1
 
Cassandra + Spark + Elk
Cassandra + Spark + ElkCassandra + Spark + Elk
Cassandra + Spark + Elk
 
Опыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событияхОпыт использования Spark, Основано на реальных событиях
Опыт использования Spark, Основано на реальных событиях
 
ETL со Spark
ETL со SparkETL со Spark
ETL со Spark
 

Vaadin+Scala

  • 2. Why? - Simple programming model - Secure - No javascript - Beautiful
  • 3. Simple programming model - Abstracted from HTTP - No request/response/session mess - All AJAX - Just a web page
  • 4. Secure - All server-side - Validations - No code on client - CSRF, XSS protection built-in
  • 5. No javascript - No bad parts - Good parts still accessible - Built on GWT - Large test suite for each browser
  • 6. Beautiful - Mature codebase - Thinking of U and I - Widgets and addons - Themes
  • 7. Performance - Almost every event is handled on server - Optimized wire format - No page reload - Static content
  • 9. Scalability Study - QuickTickets
  • 11. +Scala 6 class TransactionPage(controller:TransactionController=new TransactionController) extends BasePage { 7 model.params = params 8 compositionRoot = new VerticalLayout { 9 val form = new Form { 10 caption = 'hello 11 val beanItem = new BeanItem(model) { 12 item = this 13 visibleItemProperties = propertyIds().filter(_ != "progress") 14 } 15 field("price").foreach { p => 16 p.required = true 17 p.validators += >=(10.0) 18 } 19 } 20 components ++= 21 Button('check, Notification.show(model.toString)) :: 22 Button('start, validated(form)(controller.start(done))) :: 23 form :: 24 new ProgressIndicator {property = form.beanItem.property("progress")} :: 25 Nil 26 } 27 def done = Notification.show('done, Type.Tray) 28 def model = controller.model 29 }
  • 12. +Scaladin - wraps Vaadin api into idiomatic Scala - closures, Options, etc.
  • 13. +Scala => declarative - comparable to JSON 1 {"transactionPage": { 2 "controller": "TransactionController", 3 "compositionRoot": { 4 "type": "VerticalLayout", 5 "components": [ 6 { 7 "type": "Button", 8 "caption": "hello" .... 9 } 10 ] 11 } 12 }} - no need to reference view from controller - statically checked - support for HTML templates
  • 14. +Scala => inline constructors class TransactionPage(controller: TransactionController = new TransactionController) extends BasePage { //body goes here }
  • 15. +Scala => DelayedInit 8 trait BasePage extends CustomComponent with Validations with DelayedInit { 9 var params: String = "" ... 16 def init(params: String) = { 17 this.params = params 18 initCode.foreach(_()) 19 } 20 } 14 case class TabView(name: String)(content: => Seq[Component] = stubContent(name)) 15 extends VerticalLayout with View { 16 def enter(event: ViewChangeEvent) { 17 //showing that state persists and lazy loading is possible 18 val params = event.getParameters 19 content.collect { 20 case page: BasePage => add(page).init(params) 21 case view => add(view) 22 } 23 Notification.show("Entered " + name + " with params " + params) 24 } 25 } class TransactionPage(controller: TransactionController = new TransactionController) extends BasePage { model.params = this.params
  • 16. +Scala => callbacks and HOFs Button('start, validated(form)(controller.start(done))) def apply(caption: String, clickListener: => Unit): Button def validated(form: Form)(action: => Unit) def start(done: => Unit) - increase code reuse - decrease coupling
  • 17. +Scala => symbols - localization - natural names caption = 'hello implicit def translateSymbol(s: Symbol) = s"${s.name} locale:${self.locale}" implicit def translateTuple[T](s: (Symbol, T)) (implicit toParams: T => TranslationParams) = translateSymbol(s._1).format(toParams(s._2).p: _*) validators += >=(10.0) def >=[T](bound: T)(implicit ord: Ordering[T]): Option[Any] => Validation = { import ord._; v => v match { case Some(v: T) if v >= bound => Valid case _ => Invalid(Symbol("should be greater %s") -> bound :: Nil) } }
  • 18. +Scala => structural types - navigate in nested objects val form = new Form { val beanItem = new BeanItem(model) { ... form.beanItem.property("progress") - eliminate dependencies trait Translation {self: {def locale: Option[Locale]} =>
  • 19. +JRebel - Reloading classes as if they were templates - Free for Scala - Free for Vaadin Pro users
  • 20. Thank you! Q&A