Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
by Jon Kruger
Independent consultant in Columbus, OH.NET, Ruby on Rails, AgileEmail: jon@jonkruger.comTwitter: @JonKrugerBlog: http://jo...
public void Page_Load(Object sender, EventArgs e){}
“Sometimes I want to do Rubybecause it means that I’m more likelyto be able to do TDD.”                     -- Greg Malcolm
“I feel like the shackles have beentaken off.”                      -- Leon Gersing
public interface IGetObjectService<T> where T : EntityBase{   public T Get(int id);   public IList<T> GetAll();}public cla...
ASP .NET MVC and Rails are very similar
Learning the Ruby/UNIX way
You can do more with less code
create table Users(    id int,    name varchar(100),    user_status_id int,    created_at datetime,    updated_at datetime...
create table Users(    id int,    name varchar(100),    user_status_id int,    created_at datetime,    updated_at datetime...
create table Users(    id int,    name varchar(100),    user_status_id int,    created_at datetime,    updated_at datetime...
create table Users(    id int,    name varchar(100),    user_status_id int,    created_at datetime,    updated_at datetime...
create table Users(    id int,    name varchar(100),    user_status_id int,    created_at datetime,    updated_at datetime...
create table Users(    id int,    name varchar(100),    user_status_id int,    created_at datetime,    updated_at datetime...
If it’s hard, you’re probably doing it wrong
Innovation is everywhere
Patterns and “best practices” aredifferent between static and dynamic             languages
public class Employee{       public static Employee Load(int id) { ... }       public bool Save() { ... }       public boo...
In Ruby, I can stub out class methods (i.e. staticmethods)
class Employee < ActiveRecord::Base  include Cacheableendmodule Cacheable  def save    Cache.save(self)    super  endend ...
Twitter   GithubHulu      Groupon
   Rails for .NET Developers     by Jeff Cohen and Brian Eng   Agile Web Development With Rails     by Sam Ruby, Dave ...
   Ruby Koans     http://rubykoans.com   Railscasts     http://railscasts.com   Why’s Poignant Guide To Ruby     htt...
   Email: jon@jonkruger.com   Twitter: @JonKruger   Blog: http://jonkruger.com/blog
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Upcoming SlideShare
Loading in …5
×

Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer

2,366 views

Published on

From CodeMash 2011

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer

  1. 1. by Jon Kruger
  2. 2. Independent consultant in Columbus, OH.NET, Ruby on Rails, AgileEmail: jon@jonkruger.comTwitter: @JonKrugerBlog: http://jonkruger.com/blog
  3. 3. public void Page_Load(Object sender, EventArgs e){}
  4. 4. “Sometimes I want to do Rubybecause it means that I’m more likelyto be able to do TDD.” -- Greg Malcolm
  5. 5. “I feel like the shackles have beentaken off.” -- Leon Gersing
  6. 6. public interface IGetObjectService<T> where T : EntityBase{ public T Get(int id); public IList<T> GetAll();}public class GetObjectService<T> : IGetObjectService<T>{ public GetObjectService(IRepository<T> repository) { } public T Get(int id) { ... } public IList<T> GetAll() { ... }}
  7. 7. ASP .NET MVC and Rails are very similar
  8. 8. Learning the Ruby/UNIX way
  9. 9. You can do more with less code
  10. 10. create table Users( id int, name varchar(100), user_status_id int, created_at datetime, updated_at datetime)class User < ActiveRecord::Base belongs_to :user_status has_many :roles, :through => :user_roles validates_length_of :name, :maximum => 100 named_scope :active, :conditions => ["user_status.id = ?", UserStatus::ACTIVE]end
  11. 11. create table Users( id int, name varchar(100), user_status_id int, created_at datetime, updated_at datetime)class User < ActiveRecord::Base belongs_to :user_status has_many :roles, :through => :user_roles validates_length_of :name, :maximum => 100 named_scope :active, :conditions => ["user_status.id = ?", UserStatus::ACTIVE]end
  12. 12. create table Users( id int, name varchar(100), user_status_id int, created_at datetime, updated_at datetime)class User < ActiveRecord::Base belongs_to :user_status has_many :roles, :through => :user_roles validates_length_of :name, :maximum => 100 named_scope :active, :conditions => ["user_status.id = ?", UserStatus::ACTIVE]end
  13. 13. create table Users( id int, name varchar(100), user_status_id int, created_at datetime, updated_at datetime)class User < ActiveRecord::Base belongs_to :user_status has_many :roles, :through => :user_roles validates_length_of :name, :maximum => 100 named_scope :active, :conditions => ["user_status.id = ?", UserStatus::ACTIVE]end
  14. 14. create table Users( id int, name varchar(100), user_status_id int, created_at datetime, updated_at datetime)class User < ActiveRecord::Base belongs_to :user_status has_many :roles, :through => :user_roles validates_length_of :name, :maximum => 100 named_scope :active, :conditions => ["user_status.id = ?", UserStatus::ACTIVE]end
  15. 15. create table Users( id int, name varchar(100), user_status_id int, created_at datetime, updated_at datetime)class User < ActiveRecord::Base belongs_to :user_status has_many :roles, :through => :user_roles validates_length_of :name, :maximum => 100 named_scope :active, :conditions => ["user_status.id = ?", UserStatus::ACTIVE]end
  16. 16. If it’s hard, you’re probably doing it wrong
  17. 17. Innovation is everywhere
  18. 18. Patterns and “best practices” aredifferent between static and dynamic languages
  19. 19. public class Employee{ public static Employee Load(int id) { ... } public bool Save() { ... } public bool Delete() { ... }} How do I stub out the Load method in a test? How can I implement cross-cutting concerns (e.g.caching when saving) without duplicating code?
  20. 20. In Ruby, I can stub out class methods (i.e. staticmethods)
  21. 21. class Employee < ActiveRecord::Base include Cacheableendmodule Cacheable def save Cache.save(self) super endend In Ruby, I can mix in modules that will modify theclass
  22. 22. Twitter GithubHulu Groupon
  23. 23.  Rails for .NET Developers  by Jeff Cohen and Brian Eng Agile Web Development With Rails  by Sam Ruby, Dave Thomas, David Heinemeier Hansson Programming Ruby 1.9 (aka the “Pickaxe” book)  by Dave Thomas, with Chad Fowler and Andy Hunt All found at http://pragprog.com
  24. 24.  Ruby Koans  http://rubykoans.com Railscasts  http://railscasts.com Why’s Poignant Guide To Ruby  http://mislav.uniqpath.com/poignant-guide/
  25. 25.  Email: jon@jonkruger.com Twitter: @JonKruger Blog: http://jonkruger.com/blog

×