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

Lightning Talk: Escaping the Tar Pit

Lightning Talk: Escaping the Tar Pit

Nobody wants to inherit a project that reeks but here we are: Stuck in the tar pit.

How can we get out? Could we have avoided it in the first place? In this talk you will learn how to use a few, great Ruby gems that will guide you out of that sticky tar you are in.

This was a lightning talk presented at Scripted Philadelphia '23, a crossover meetup between Philly PUG, PhillyJS, and Phillyrb: https://www.eventbrite.com/e/scripted-philadelphia-a-python-javascript-and-ruby-joint-meetup-tickets-626403759507

Ernesto Tagwerker

June 30, 2023
Tweet

More Decks by Ernesto Tagwerker

Other Decks in Programming

Transcript

  1. “The fi ercer the struggle, the more entangling the tar,

    and no beast is so strong or so skillful but that they ultimately sink.” Fred Brooks
  2. Tar Pit Symptoms > Projects running over budget > Taking

    forever to ship small changes > Sacri fi cing quality, increasing tech debt
  3. Code Coverage # spec/spec_helper.rb if ENV["COVERAGE"] == "true" require 'simplecov'

    SimpleCov.start do add_group "Models", "models" add_filter "/spec/" track_files "**/*.rb" end end
  4. (Un)maintainable Code n options ( fl og; fl ay; reek;

    churn; RubyCritic; MetricFu; attractor; rubocop; …)
  5. Churn “Code that is constantly changing is hard to maintain

    so that’s part of my app’s tech debt”
  6. Complexity “Code that is super complex is hard to maintain

    so that’s part of my app’s tech debt”
  7. Complexity class Default def yay # 10.8 = a =

    eval "1+1" # 1.2 + 6.0 + if a == 2 # 1.2 + 1.2 + puts "yay" # 1.2 end end end
  8. RubyCritic module RubyCritic class AnalysedModule def cost smells.map(&:cost).inject(0.0, :+) +

    # From Reek (complexity / COMPLEXITY_FACTOR) # From Flog end end end
  9. 100 0 1 100_000 No one understands these fi les

    but they work. So don’t change them. Complexity Churn
  10. 100 0 1 100_000 Everybody understands these fi les but

    you need to change them often Complexity Churn
  11. 100 0 1 100_000 Complexity Churn These modules are complex

    and are constantly changing 🤦 🤦 🤦
  12. Are you getting into a tar pit, is it a

    dumpster fi re, or have you found a project which is easy to maintain?
  13. Resources 1.https://codeclimate.com/blog/deciphering-ruby-code-metrics/ 2.https://www.stickyminds.com/article/getting-empirical-about-refactoring 3.https://www.sandimetz.com/blog/2017/9/13/breaking-up-the-behemoth 4.https://github.com/troessner/reek 5.https://github.com/seattlerb/ fl ay 6.https://github.com/seattlerb/ fl

    og 7.http://www.sqa.net/iso9126.html 8.https://www.slideshare.net/mscottford/important-metrics-for-measuring-code-health 9.https://dilbert.com/strip/2006-12-08 10.https://www.fastruby.io/blog/ruby/quality/code-quality-ruby-gems.html 11.https://www.fastruby.io/blog/code-quality/code-coverage/rubycritic-4-2-0- simplecov-support.html