Download Ruby and Rails from a .NET perspective

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Ruby and Rails
From a
perspective
James Crisp
.NET Practice Lead
ThoughtWorks Australia
James Crisp
Runtimes
MRI
IronRuby
Console Demo
public class CSharpDemo : Demo
{
public void SayHello()
{
for (int i=0; i<5; i++)
{
Console.WriteLine(“Hi from C#!”);
}
}
public IEnumerable<string> Greet(
IEnumerable<guest> guests)
{
return guests.Select(g => “Welcome”
+ g.Name);
}
}
class RubyDemo < Demo
def say_hello
5.times { puts “Hi from Ruby!” }
end
def greet(guests)
guests.collect { |g| “Welcome #{g.name}” }
end
end
>> RubyDemo.new.greet(fred, tina)
=> [“Welcome Fred”, “Welcome Tina”]
Tools and
Frameworks
c:\> gem install rails
Rake
desc “Generate application code”
task :code_gen do
# do the code generation
end
desc “Compile code”
task :compile => [:code_gen] do
#do the compilation
end
desc “Test application”
task :test => [:compile] do
# run the tests
end
Capistrano
desc "Start ferret server"
task :start, :role => :app do
run "cd #{current_path}; script/ferret_server -e #{stage} start"
end
desc "Stop ferret server"
task :stop, :role => :app do
run "cd #{current_path}; script/ferret_server -e #{stage} stop"
end
RSpec
describe User do
it "should be in any roles assigned to it" do
user = User.new
user.assign_role("assigned role")
user.should be_in_role("assigned role")
end
...
end
Routing
Table
Controller
Method
Model
View
Rails Project
Demo
See also...
Rails & screencasts
http://rubyonrails.org
Ruby / Rails API
http://gotapi.com
John Lam's blog for Iron Ruby
http://www.iunknown.com/
Slides for this talk
http://www.jamescrisp.org
Image References
http://upload.wikimedia.org/wikipedia/en/2/27/Microsoft_.NET_Logo.png - .net logo
http://en.wikipedia.org/wiki/Image:Ruby-(programming-language)-logo-2008.png
http://www.pragprog.com/images/covers/original/rails3.jpg – agile development with rails
http://flickr.com/photos/rrrodrigo/2394122680/ - Matz
http://flickr.com/photos/maguisso/1028956186/ - Ruby book
http://media.xircles.codehaus.org/_projects/jruby/_logos/medium.png – JRuby logo
http://www.atdot.net/yarv/ - YARV logo
http://www.ironruby.net/@api/deki/site/logo.png – IronRuby logo
Questions?
Related documents