Slide 1

Slide 1 text

on Sebastian Nozzi viernes 6 de septiembre

Slide 2

Slide 2 text

Background • Working with Java since 2001 • Flirting with Smalltalk all these years • Developing with Rails since September 2012 • Hooked with Scala since January 2013 • Developing with Play since June 2013 viernes 6 de septiembre

Slide 3

Slide 3 text

Scala Quick introduction to ... for developers viernes 6 de septiembre

Slide 4

Slide 4 text

Lightweight Syntax Object-Oriented Strong Static Typing Functional Scala Ruby Haskell viernes 6 de septiembre

Slide 5

Slide 5 text

Some Code viernes 6 de septiembre

Slide 6

Slide 6 text

class Greeter(var name: String = "World") { def sayHi { println(s"Hello $name!") } def sayBye { println(s"Bye $name, come back soon.") } } val g = new Greeter greeter.sayHi >> "Hello World!" greeter.name = "vienna.rb" greeter.sayHi >> "Hello vienna.rb!" greeter.name >> "vienna.rb" viernes 6 de septiembre

Slide 7

Slide 7 text

ScalaTour.com powered by scalaKata.com viernes 6 de septiembre

Slide 8

Slide 8 text

viernes 6 de septiembre

Slide 9

Slide 9 text

Similarities: Ruby / Scala • Object Oriented • Mixins / Traits • Blocks / First-class Functions • Powerful Collection APIs • method_missing / Dynamic trait • Console / REPL • More Elegant than predecessor (Perl / Java) viernes 6 de septiembre

Slide 10

Slide 10 text

Cultural Impact of Ruby / Rails • Developer happiness matters • Productivity matters • Elegance matters • Lambdas are a must • DSLs are cool viernes 6 de septiembre

Slide 11

Slide 11 text

viernes 6 de septiembre

Slide 12

Slide 12 text

• Borrows heavily from Rails • Convention over Configuration • Routes • REST / MVC • Models, Controllers, Fragments, Helpers, etc. • Save + Reload viernes 6 de septiembre

Slide 13

Slide 13 text

3 Aspects I missed from Rails (from many many more ;-) viernes 6 de septiembre

Slide 14

Slide 14 text

ActiveRecord db:migrate Cucumber ActiveRecord (for Scala) Flyway Cucumber-JVM today viernes 6 de septiembre

Slide 15

Slide 15 text

viernes 6 de septiembre

Slide 16

Slide 16 text

Feature: Posting status updates The goal of the system is keep co-workers informed by posting status updates. Background: Given that user "manager" exists And that user "manager" posted | first day at work | | meeting people | | working like crazy | Scenario: Posts are ordered chronologically (newest on top) When I go to the posts page of user "manager" Then the post nr. 1 should contain "working" And the post nr. 2 should contain "meeting" And the post nr. 3 should contain "first" Feature name Description These steps get executed before each Scenario Steps in a Scenario Scenario name viernes 6 de septiembre

Slide 17

Slide 17 text

And("""^press "([^"]*)"$""") { (buttonLabel: String) => ... ... } triple-quotes triple-quotes allows using unescaped quotes viernes 6 de septiembre

Slide 18

Slide 18 text

And("""^press "([^"]*)"$""") { (buttonLabel: String) => ... ... } block viernes 6 de septiembre

Slide 19

Slide 19 text

And("""^press "([^"]*)"$""") { (buttonLabel: String) => ... ... } capturing group corresponding parameter viernes 6 de septiembre

Slide 20

Slide 20 text

Then("""^the user should have (\d+) posts$""") { (amountPosts: Int) => ... ... ... } capturing group corresponding parameter notice the type viernes 6 de septiembre

Slide 21

Slide 21 text

Cucumber Demo viernes 6 de septiembre

Slide 22

Slide 22 text

viernes 6 de septiembre

Slide 23

Slide 23 text

Conclusion • Ruby / Rails influcence is everywhere • Possible for me to have some the Ruby coolness • Other languages (ahem, Scala) have cool ideas/concepts too ;-) • Ruby / Rails source of innovation and inspiration Keep innovating and making the world cool! viernes 6 de septiembre