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

  • 1,020 views
Uploaded on

From CodeMash 2011

From CodeMash 2011

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,020
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Losing bids – software development takes too long. Why is it so hard?Wanting to go fasterWanted to write code that does what it says and says what it does
  • I want my framework to help me fall into the pit of successWould someone new to the framework be more likely to succeed or fail?
  • Started a new projectLower estimatesConventions (FNH, grid button clicks)Company framework
  • How many of you do TDD?
  • Ever been annoyed by:Not being able to override a method unless it’s marked as virtualNot being able to inherit from a sealed classGetting generic constraint errorsNot being able to add methods to an existing classNot having mixinsHaving to use dependency injection in order to testHaving to compile your code every time you change anything
  • Stories of people going fasterRuby-based consulting companies are doing it that way for a reason
  • Code and coffeeRails for .NET Developers (next slide)Practice problems
  • UNIX is very command line driven (install apps through the command line, shell scripting)Closer to the metalUsing Vim as my IDE
  • Less code means less work, fewer chances to write bugs, easier to maintain
  • I haven’t written any methods! I’m writing code that writes code for me!
  • There are gems for everythingIt’s really easily to write little DSLs, so you do the hard things once
  • Gems for everything, people always trying to improve
  • -Rails can be the "company framework" that everyone is trying to build  -things are done the same way in most Rails projects, so you can join a Rails team and you don't have to learn someone else's homegrown framework  -homegrown frameworks often are a big detriment to getting things done (maintenance is hard, keeps you from upgrading your codebase, etc.)Rails works in the enterprise - cleanest 4 yr old codebase I've ever worked on, wouldn't gain much if I could rewrite itLots of big companies using Rails……. (next slide)
  • Lots of big companies using Rails (Twitter, Github, Hulu, Groupon)-not "switching to Ruby", not "leaving .NET"- don't be afraid of leaving your comfort zone (framework, language, syntax, etc.)- you will learn things that will help you on other platforms/languages-Ruby on Rails is just another tool in my toolbox (that happens to be really good at building web applications)-If Ruby on Rails can help your team develop things better and faster, isn’t it even worth considering?-Do a cost-benefit analysis – will the long term benefit of using Ruby outweigh the time needed to adopt a new technology?

Transcript

  • 1. by Jon Kruger
  • 2. Independent consultant in Columbus, OH.NET, Ruby on Rails, AgileEmail: jon@jonkruger.comTwitter: @JonKrugerBlog: http://jonkruger.com/blog
  • 3. public void Page_Load(Object sender, EventArgs e){}
  • 4. “Sometimes I want to do Rubybecause it means that I’m more likelyto be able to do TDD.” -- Greg Malcolm
  • 5. “I feel like the shackles have beentaken off.” -- Leon Gersing
  • 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. ASP .NET MVC and Rails are very similar
  • 8. Learning the Ruby/UNIX way
  • 9. You can do more with less code
  • 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. 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. 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. 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. 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. 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. If it’s hard, you’re probably doing it wrong
  • 17. Innovation is everywhere
  • 18. Patterns and “best practices” aredifferent between static and dynamic languages
  • 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. In Ruby, I can stub out class methods (i.e. staticmethods)
  • 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. Twitter GithubHulu Groupon
  • 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.  Ruby Koans  http://rubykoans.com Railscasts  http://railscasts.com Why’s Poignant Guide To Ruby  http://mislav.uniqpath.com/poignant-guide/
  • 25.  Email: jon@jonkruger.com Twitter: @JonKruger Blog: http://jonkruger.com/blog