‹ BackHN Continuity

Thread

This Code Is CRAP (2011)

77 points · 57 comments · luispa

  1. richardbarosky · · focus · HN ↗
    The pendulum has swung too far in the direction of class, function, cyclomatic complexity (and here, CRAP) and similar idiotic metrics.

    This reminds me of a talk Sandi Metz did called "All the Little Things" where she covers the Gilded Rose kata. In the talk, she reworks her solution until there's almost nothing left showing the essence of the problem being solved.

    The cyclomatic complexity metric is touted at each step as a proxy for goodness of design and removal of complexity. However, a weakness of the measure itself is that it doesn't account for the control flow indirection that happens through OO method dispatch itself.

    At the same time, Kevlin Henney's talk called "Gilding the Rose" takes the same kata and arrives at a far more sane solution he works up to and reveals at the end.

    Short functions used to be hot. Uncle Bob used to proselytize &quot;The first rule of functions is that they should be short. The second rule of functions is that they should be shorter than that.&quot; Now emphasizing the benefits of longer functions is pretty trendy. <a href="https:&#x2F;&#x2F;github.com&#x2F;johnousterhout&#x2F;aposd-vs-clean-code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;johnousterhout&#x2F;aposd-vs-clean-code

    This industry is pretty idiotic sometimes ¯\_(ツ)_&#x2F;¯

    1. bunderbunder · · focus · HN ↗
      A while back Hillel Wayne did a talk (whose name I forget) on what empirical evidence on software quality actually says.

      As I recall, he concluded that there’s really no support for then-popular ideas like short functions, reducing cyclomatic complexity, avoiding explicit branch statements and loops, or TDD. (Tests yes, just not TDD.)

      He made a pretty strong case that only two principles are particularly robust. One was that limiting code volume is good. The other is that working people too hard is bad.

      1. eadler · · focus · HN ↗
        This talk.

        What We Know We Don’t Know • Hillel Wayne. (2019, April 28). Hillel Wayne. <a href="https:&#x2F;&#x2F;www.hillelwayne.com&#x2F;talks&#x2F;what-we-know-we-dont-know&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.hillelwayne.com&#x2F;talks&#x2F;what-we-know-we-dont-know&#x2F;

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.