1. Railsify your web
development
Thomas Lundström, Softhouse
@thomaslundstrom
Scandinavian Developer Conference, Gothenburg
April 4, 2011
http://www.flickr.com/photos/mtl_shag/320960018/
måndag den 4 april 2011
2. Agenda
• About this session
• 12 Practices
http://www.flickr.com/photos/puntodevista/84796578/
måndag den 4 april 2011
3. About this session
http://www.flickr.com/photos/78986993@N00/3335393740/
måndag den 4 april 2011
4. About this session
• Day job:
consultant, .NET/Java
• Rails dev at night
http://www.flickr.com/photos/78986993@N00/3335393740/
måndag den 4 april 2011
5. About this session
• Ruby on Rails is
• Simple
• Productive
• Easy
http://www.flickr.com/photos/78986993@N00/3335393740/
måndag den 4 april 2011
6. About this session
• This started me asking why
http://www.flickr.com/photos/78986993@N00/3335393740/
måndag den 4 april 2011
7. About this session
• Answer: part practices, part Ruby
• Can we steal the practices?
http://www.flickr.com/photos/78986993@N00/3335393740/
måndag den 4 april 2011
8. About this session
• Disclaimer: the practices aren’t invented in
Rails, but they are in the culture
http://www.flickr.com/photos/78986993@N00/3335393740/
måndag den 4 april 2011
9. 12 Practices
http://www.flickr.com/photos/kapungo/1408329358/
måndag den 4 april 2011
10. BDD
http://www.flickr.com/photos/fredcoree/301890340/
måndag den 4 april 2011
11. BDD
• Writing automated acceptance test suites
• Focus on users’ needs
• Drive the outer layer (UI, Web Services,
API)
http://www.flickr.com/photos/fredcoree/301890340/
måndag den 4 april 2011
12. BDD
• Executable specifications
http://www.flickr.com/photos/fredcoree/301890340/
måndag den 4 april 2011
13. BDD
• .NET: Specflow/Cucumber
• Java: JBehave/Cucumber
• Application- and tech-specific driver
http://www.flickr.com/photos/fredcoree/301890340/
måndag den 4 april 2011
14. TDD
http://www.flickr.com/photos/mroach/2448878900/
måndag den 4 april 2011
15. TDD
• We all know this, right?
• However ... how to do it well?
http://www.flickr.com/photos/mroach/2448878900/
måndag den 4 april 2011
16. TDD
• “Build Quality In” (Deming)
• Hands-on process that helps designing the
software
http://www.flickr.com/photos/mroach/2448878900/
måndag den 4 april 2011
17. TDD
• TDD is an acquired skill
• One or two in the team spearheads the
TDD drive
http://www.flickr.com/photos/mroach/2448878900/
måndag den 4 april 2011
18. MVC
http://www.flickr.com/photos/spaceamoeba/3044883638/
måndag den 4 april 2011
19. MVC
• Splitting logic into (Domain) Model,View,
Controller
http://www.flickr.com/photos/spaceamoeba/3044883638/
måndag den 4 april 2011
20. MVC
• Splitting of different types of logic
• Known structure in your web app
http://www.flickr.com/photos/spaceamoeba/3044883638/
måndag den 4 april 2011
21. MVC
• Disentangle
• Refactor
• Un-spaghettize
http://www.flickr.com/photos/spaceamoeba/3044883638/
måndag den 4 april 2011
22. Collaborative database
development
http://www.flickr.com/photos/tomsaint/3051540613/
måndag den 4 april 2011
23. Collaborative database
development
• Easy setup of a private database
• Your structural change is yours only until
committed
http://www.flickr.com/photos/tomsaint/3051540613/
måndag den 4 april 2011
24. Collaborative database
development
• Simple database refactorings
• “I can’t work since the change made by
John put the DB in a strange state”
http://www.flickr.com/photos/tomsaint/3051540613/
måndag den 4 april 2011
25. Collaborative database
development
• Migrations
• .NET: Migrator.NET
• Java: Flyway, DBDeploy, mybatis
(comparison at https://code.google.com/
p/flyway/)
http://www.flickr.com/photos/tomsaint/3051540613/
måndag den 4 april 2011
26. App-private database
http://www.flickr.com/photos/evert-jan/72568626/
måndag den 4 april 2011
27. App-private database
• Previously: devs in one team share one DB
• Here: different products share one DB
• Integration #fail
http://www.flickr.com/photos/evert-jan/72568626/
måndag den 4 april 2011
28. App-private database
• One more degree of freedom
http://www.flickr.com/photos/evert-jan/72568626/
måndag den 4 april 2011
29. App-private database
• Long-term architectural work...
http://www.flickr.com/photos/evert-jan/72568626/
måndag den 4 april 2011
30. RESTful URL:s
http://www.flickr.com/photos/jimg944/3202247839
måndag den 4 april 2011
31. RESTful URL:s
• Readable and understandable HTTP-based
interface
• GET http://app.com/users/thomas/view
• PUT http://app.com/users/thomas/
edit.json
http://www.flickr.com/photos/jimg944/3202247839
måndag den 4 april 2011
32. RESTful URL:s
• No cognitive mismatch of App vs. URL
• Uniform, standard interface
• Stateless
• Cacheable
http://www.flickr.com/photos/jimg944/3202247839
måndag den 4 april 2011
33. RESTful URL:s
• Thoughtful URL design
http://www.flickr.com/photos/jimg944/3202247839
måndag den 4 april 2011
34. Devops
http://www.flickr.com/photos/jimg944/3123212129/
måndag den 4 april 2011
35. Devops
• Dev team = Ops team
• T-shaped people
http://www.flickr.com/photos/jimg944/3123212129/
måndag den 4 april 2011
36. Devops
• Removal of Ops-Devs wall
http://www.flickr.com/photos/jimg944/3123212129/
måndag den 4 april 2011
37. Devops
• Organizational change
http://www.flickr.com/photos/jimg944/3123212129/
måndag den 4 april 2011
38. Convention over
configuration
http://www.flickr.com/photos/aforero/339031109/
måndag den 4 april 2011
39. Convention over
configuration
• Minimizing the configuration
• Feature level/code level
http://www.flickr.com/photos/aforero/339031109/
måndag den 4 april 2011
40. Convention over
configuration
• Easier to set up and use the app
http://www.flickr.com/photos/aforero/339031109/
måndag den 4 april 2011
41. Convention over
configuration
• Remove default configuration
• Take decisions!
http://www.flickr.com/photos/aforero/339031109/
måndag den 4 april 2011
42. DRY
http://www.flickr.com/photos/paulmannix/286817119/
måndag den 4 april 2011
43. DRY
• Don’t Repeat Yourself
• Remember: not only for source code!
http://www.flickr.com/photos/paulmannix/286817119/
måndag den 4 april 2011
46. DRY
• Cleaner code
http://www.flickr.com/photos/paulmannix/286817119/
måndag den 4 april 2011
47. DRY
• Smart selection of tools
http://www.flickr.com/photos/paulmannix/286817119/
måndag den 4 april 2011
48. Scaling out
http://www.flickr.com/photos/geraldford/3078861139/
måndag den 4 april 2011
49. Scaling out
• Don’t buy bigger servers, buy more!
http://www.flickr.com/photos/geraldford/3078861139/
måndag den 4 april 2011
50. Scaling out
• Cheaper scaling
http://www.flickr.com/photos/geraldford/3078861139/
måndag den 4 april 2011
51. Scaling out
• Shared-nothing
• No Session
http://www.flickr.com/photos/geraldford/3078861139/
måndag den 4 april 2011
52. OSS
http://www.flickr.com/photos/wordridden/3107810417/
måndag den 4 april 2011
53. OSS
• Get along with the OSS culture
• Use & publish!
http://www.flickr.com/photos/wordridden/3107810417/
måndag den 4 april 2011
54. OSS
• Publishing: developer good-will
• Using: ready-made functionality
http://www.flickr.com/photos/wordridden/3107810417/
måndag den 4 april 2011
55. OSS
• Use 3rd party plugins in infrastructure
• Harvest infrastructure
• .NET devs: don’t focus on MS tools only
http://www.flickr.com/photos/wordridden/3107810417/
måndag den 4 april 2011
56. Reference management
http://www.flickr.com/photos/saragoldsmith/2896007790/
måndag den 4 april 2011
57. Reference management
• Structured dependency management
http://www.flickr.com/photos/saragoldsmith/2896007790/
måndag den 4 april 2011
58. Reference management
• Simple and easy dependency mgmt
• Finding
• Updating
• Control of transitive deps
http://www.flickr.com/photos/saragoldsmith/2896007790/
måndag den 4 april 2011
59. Reference management
• Java: Maven/Ivy
• .NET: NuGet/OpenWrap
http://www.flickr.com/photos/saragoldsmith/2896007790/
måndag den 4 april 2011
60. What not to use?
• ActiveRecord pattern
• Scaffolds
http://www.flickr.com/photos/deapeajay/2143573706/
måndag den 4 april 2011
61. Thanks!
• Thomas Lundström, Softhouse
• thomas.lundstrom@softhouse.se
• @thomaslundstrom
• http://blog.thomaslundstrom.com
http://www.flickr.com/photos/mtl_shag/320960018/
måndag den 4 april 2011