Refactoring Ruby on Rails Applications

1,750 views

Published on

Writing good, maintainable code is hard. You need a lot of experience with the framework to know the little tricks and pit-falls. In this session we take messy code and make it beautiful. We do this by going through examples and refactor them to be more resilient, easier to read, easier to test, and easier to maintain.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,750
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
38
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Refactoring Ruby on Rails Applications

  1. 1. Refactoring Rails Applications Jonathan Weiss, 26.05.2009 Peritor GmbH
  2. 2. Who am I ? Jonathan Weiss •  Consultant for Peritor GmbH in Berlin •  Specialized in Rails, Scaling, Deployment, and Code Review •  Webistrano - Rails deployment tool •  FreeBSD Rubygems and Ruby on Rails maintainer http://www.peritor.com http://blog.innerewut.de 2
  3. 3. Refactoring A Definition: Refactoring is the process of changing internal structure without modifying its external functional behavior or existing functionality with the goals of readability, maintainability, performance, extensibility, and simplicity. Wikipedia 3
  4. 4. From 4
  5. 5. To 5
  6. 6. (To) 6
  7. 7. How? 7
  8. 8. Live Coding Experiment 8
  9. 9. Principles 9
  10. 10. MVC 10
  11. 11. Model Core business model Domain logic Reusable 11
  12. 12. View Dumb representation to the outside Targeted at specific use case Displays desired information Different views of one model 12
  13. 13. Controller Conductor & connector Brokers client requests to backend Decide & delegate rather then labor 13
  14. 14. DRY Principles 14
  15. 15. You Ain’t Gonna Need It Ron Jeffries: Always implement things when you actually need them, never when you just foresee that you need them. 15
  16. 16. Live Coding Experiment 16
  17. 17. Redmine •  A load-balancer distributes the incoming requests •  Some load-balancers will deliver static requests themselves •  Several Rails instances handle all requests •  Number of concurrent requests equals number of Rails instances 17
  18. 18. Redmine •  Multiple projects support •  Flexible role based access control •  Flexible issue tracking system •  Gantt chart and calendar •  News, documents & files management •  Feeds & email notifications •  Per project wiki •  Per project forums •  Time tracking •  SCM integration (SVN, CVS, Git, Mercurial, Bazaar and Darcs) 18
  19. 19. Q&A 19
  20. 20. Peritor GmbH Teutonenstraße 16 14129 Berlin Telefon: +49 (0)30 69 20 09 84 0 Telefax: +49 (0)30 69 20 09 84 9 Internet: www.peritor.com E-Mail: kontakt@peritor.com 20 Peritor GmbH - Alle Rechte vorbehalten 20

×