Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Death By a Thousand Commits

Death By a Thousand Commits

On the 1st commit, things are getting started. On the 10th commit, the feature is live and users are giving feedback. On the 100th commit, users are delighted to be using the application. But on the 1000th commit, users are unhappy with the responsiveness of the application and the developers are struggling to move at the velocity they once were. Does this sound familiar?

We will go over some of the pieces of technical debt that can accumulate and can cause application performance and development velocity issues, and the strategies Clio uses to keep these kinds of technical debt under control.

Kyle d'Oliveira

May 02, 2019
Tweet

More Decks by Kyle d'Oliveira

Other Decks in Programming

Transcript

  1. Technical Debt Quadrants – Martin Fowler Reckless Prudent Deliberate “We

    don’t have time for design” Inadvertent “What’s layering”
  2. Technical Debt Quadrants – Martin Fowler Reckless Prudent Deliberate “We

    don’t have time for design” “We must ship now and deal with consequences” Inadvertent “What’s layering”
  3. Technical Debt Quadrants – Martin Fowler Reckless Prudent Deliberate “We

    don’t have time for design” “We must ship now and deal with consequences” Inadvertent “What’s layering” “Now we know how we should have done it”
  4. Lessons ▪ Lesson 1 – Automate the debt away ▪

    Lesson 2 – Clean up code you don't use ▪ Lesson 3 – Make keeping the lights on easier ▪ Lesson 4 – Keep the bad patterns out
  5. SELECT * FROM contacts SELECT * FROM emails WHERE contact_id

    = 1 SELECT * FROM emails WHERE contact_id = 2 SELECT * FROM emails WHERE contact_id = 3 SELECT * FROM emails WHERE contact_id = 4 SELECT * FROM emails WHERE contact_id = 5 SELECT * FROM emails WHERE contact_id = 6
  6. class ContactSerializer < ActiveModel::Serializer attribute :id, :name has_one :email has_one

    :phone_number has_one :address has_one :emergency_contact end
  7. Limitations ▪ Manual human effort ▪ Only fixes one instance

    at a time ▪ Doesn’t handle associations no longer being needed
  8. ActiveSupport::Notifications .subscribe(‘active_record.sql’) do |*args| event = ActiveSupport::Notifications::Event.new(*args) if event.duration >

    THRESHOLD exception = LongQueryException.new(“a clear message”) Bugsnag.notify(exception) end end
  9. begin file = Tempfile.new(“contact.csv”) csv = CSV.new(file) csv << [“id”,

    “name”] Contact.all.each do |contact| csv << [contact.id, contact.name] end ensure file.close file.unlink end
  10. begin file = Tempfile.new(“contact.csv”) csv = CSV.new(file) csv << [“id”,

    “name”] Contact.all.each do |contact| csv << [contact.id, contact.name] end ensure file.close file.unlink end
  11. Shitlist = [ClassA, ClassB, ClassC] def push_job_that_does_crazy_things(klass) if Shitlist.include?(klass) #

    existing deprecated behavior else raise Shitlist::Error.new(“a clear message”) end end
  12. RedisShitlist = [ Session, FragmentCache, AuthenticationTokens ] test “no new

    redis models introduced” do assert_equal RedisShitList, RedisModel.descendants end
  13. Lessons ▪ Lesson 1 – Automate the debt away –

    jit_preloader ▪ Lesson 2 – Clean up code you don't use – Tombstone – dead_code_detector – coverband ▪ Lesson 3 – Make keeping the lights on easier – marginalia/ActiveSupport::CurrentAttributes – ActiveSupport::Notifications ▪ Lesson 4 – Keep the bad patterns out – rubocop – Shitlist-driven development