Managing Success: We made it, now we're screwed

Managing Success: We made it, now we're screwed

Life as a startup, whether a bootstrapped company or an experimental project within an enterprise, is hard. You have to struggle to earn success. Lean, pivots, minimal viable products, and other buzzwords all steps along this journey. The struggle makes the eventual success that much sweeter. But it can also lead to suboptimal code, confusing logic, and general friction to getting things done.

In this talk I'll discuss ways to identify areas of your Rails app improve and strategies for improving the quality over time. I'll share insights on managing several large Rails applications, the dangers of the single, monolithic, ball of mud Rails app, and what changes make the biggest impact.

Cd8da976054ea4915eafc5d9dd096d38?s=128

blowmage

July 01, 2012
Tweet

Transcript

  1. Managing Success We made it, now we're screwed

  2. None
  3. None
  4. None
  5. None
  6. You == Pain

  7. (NIH) Not Invented Here

  8. Why?

  9. Conway's Law

  10. Organizations which design systems are constrained to produce designs which

    are copies of the communication structures of these organizations. - Melvin Conway
  11. "Ruby is designed to make programmers happy." - Matz

  12. #1 Problem?

  13. Monolithic

  14. Models

  15. Testing

  16. TDD != QA

  17. Pain

  18. Pain

  19. Pain

  20. Cost Time Cost per change (bugs, new features, etc) Non-TDD

    TDD
  21. Models Controllers/Routes Views/Helpers Application In Browser Cost per test

  22. Models Controllers/Routes Views/Helpers Application In Browser ROI per test

  23. Monolithic Models

  24. 2 Rules

  25. 1) Delarative

  26. 2) Level of Abstraction

  27. <ul> <% @article.tags.each do |tag| -%> <li><%= link_to "#{tag.name} (#{tag.articles.length})",

    tag_path(tag) %></li> <% end %> </ul>
  28. <ul> <% @article.tags.each do |tag| -%> <li><%= link_to "#{tag.name} (#{tag.article_count})",

    tag_path(tag) %></li> <% end %> </ul>
  29. <ul> <% @article.tags.each do |tag| -%> <li><%= link_to "#{tag.name} (#{tag.article_count})",

    tag_path(tag) %></li> <% end %> </ul>
  30. class Tag < ActiveRecord::Base belongs_to :article def article_count self.articles.count end

    end
  31. class Tag < ActiveRecord::Base belongs_to :article def article_count # Performance

    hack # faster than SELECT COUNT(*) self.articles.select(:id).count end end
  32. Monolithic Views

  33. <% if @course.available? && @course.self_enrollment && @course.open_enrollment && (!@course_enrollment ||

    !@course_enrollment.active?) && !session["role_course_#{@course.id}"] %> <%= render :partial => "join_course", :object => @course %> <% elsif @course_enrollment && @course_enrollment.self_enrolled && @course_enrollment.active? && (!session["role_course_#{@course.id}"]) %> <%= render :partial => "drop_course", :locals => { :course => @course, :enrollment => @course_enrollment } %> <% elsif temp_type = session["role_course_#{@course.id}"] %> <div> ... </div> <% end %>
  34. Helpers

  35. <% if can_join_course?(@course, @enrollment) %> <%= render :partial => "join_course",

    :object => @course %> <% elsif can_drop_course?(@course, @enrollment) %> <%= render :partial => "drop_course", :locals => { :course => @course, :enrollment => @course_enrollment } %> <% elsif temp_type = temp_permissions_to(@course) %> <div> ... </div> <% end %>
  36. Presenters

  37. module CourseHelper def can_join_course? course, enrollment course.available? && course.self_enrollment &&

    course.open_enrollment && (!enrollment || !enrollment.active?) && !temp_permissions_to(course) end def can_drop_course? course, enrollment enrollment && enrollment.self_enrolled && enrollment.active? && !temp_permissions_to(course) end def temp_permissions_to course session["role_course_#{course.id}"] end end
  38. <% if @presenter.can_join_course? %> <%= render :partial => "join_course", :object

    => @presenter.course %> <% elsif @presenter.can_drop_course? %> <%= render :partial => "drop_course", :locals => { :course => @presenter.course, :enrollment => @presenter.enrollment } %> <% elsif @presenter.temp_permissions %> <div> ... </div> <% end %>
  39. class CourseShowPresenter # this is a ViewModel, really attr_accessor :course,

    :enrollment, :current_user, :session def can_join_course? @course.available? && @course.self_enrollment && @course.open_enrollment && (!@enrollment || !@enrollment.active?) && !temp_permissions end def can_drop_course? @enrollment && @enrollment.self_enrolled && @enrollment.active? && !temp_permissions end def temp_permissions @session["role_course_#{@course.id}"] end end
  40. 1) Delarative

  41. 2) Level of Abstraction

  42. Monolithic Apps

  43. Monolithic Apps

  44. None
  45. What is code?

  46. None
  47. “Underlying our approach to this subject is our conviction that

    “computer science” is not a science and that its significance has little to do with computers. ... The computer revolution is a revolution in the way we think and in the way we express what we think.
  48. ... we want to establish the idea that a computer

    language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute.
  49. ... we believe that the essential material to be addressed

    by a subject at this level is not the syntax of particular programming-language constructs, nor clever algorithms for computing particular functions efficiently, nor even the mathematical analysis of algorithms and the foundations of computing, ...
  50. but rather the techniques used to control the intellectual complexity

    of large software systems.”
  51. but rather the techniques used to control the intellectual complexity

    of large software systems.”
  52. Intellectual Complexity

  53. Human Activity

  54. None
  55. None
  56. “Often people, especially computer engineers, focus on the machines. They

    think, “By doing this, the machine will run faster. By doing this, the machine will run more effectively. By doing this, the machine will something something something.” They are focusing on machines...
  57. But in fact we need to focus on humans, on

    how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.” -Matz
  58. The 80%?

  59. None
  60. None
  61. None
  62. Thank you!

  63. None
  64. HIRE ME!!!

  65. HIRE ME!!! humanecode.com

  66. HIRE ME!!! humanecode.com Questions?