Application of GIS in Landslide Disaster Response.pptx
Scala vs ruby
1. – Martin Mazur: http://youtu.be/FPBVxpl8NMo @ DevDay
“Why you should talk to
strangers?”
2. Ruby vs Scala
• Designed for humans, not machines
• Extreme flexibility: if you mess up, it’s on you
• Everything has to be easy, elegant and fun
• DSL on top of DSLs on top of DSLs
• Testing is critical
• Things move quickly, learn to keep up
• Passionate and vibrant community
• Have the best of both object oriented and functional
programming worlds
• Let the compiler do some of the work for you
• Concurrency matters
• Less ceremony than Java, but aiming for same or better
performance
• Live in harmony with the Java ecosystem
3. Installation
brew install ruby
brew curl -sSL https://get.rvm.io | bash -s stable ruby
or
brew install scala
or
curl -O http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
| tar -xvf -
15. Routing
get '/clients/all', to: 'clients#index'
get '/clients/:id', to: 'clients#show'
root 'application#home'
GET /clients/all controllers.Clients.index()
GET /clients/:id controllers.Clients.show(id: Long)
GET / controllers.Application.home()
17. Unit Tests
test 'my test' do
array = [1, 2, 3]
assert_equal 1, array.first
end
@Test def myTest {
val array = List(1, 2, 3)
assert(array(0) === 1)
}
18. Specs
describe 'HelloWorld spec' do
context "The 'Hello world' string should" do
it 'contain 11 characters' do
'Hello world'.size.should be 11
end
it "end with 'world'" do
'Hello world'.should end_with('world')
end
end
end
class HelloWorldSpec extends Specification {
"The 'Hello world' string" should {
"contain 11 characters" in {
'Hello world' must have size(11)
}
"end with 'world'" in {
'Hello world'.should end_with('world')
}
}
}