News for hackers. Stuff that matters.
Re:It's probably time to stop recommending Clean Code (2020) by throwawaythekey on Tuesday May 25, 2021 @09:29PM (#27285061)
I coded this way for a while and found it makes the code easier to read and easier to reason about. Instead of your function being

  func foo() {
    // do A.1
    // do A.2
    // do B.1
    // do B.2
    // etc...
  }
It becomes

  func foo() {
    // do A
    // do B
    // etc...
    // func A()...
    // func B()...
  }
When the func is doing something fairly complicated the savings can really add up. It also makes expressing some concurrency patterns easier (parallel, series etc...), I used to do this a lot back in the async.js days. The main downside seems to be less elegant automated testing from all the internal state.

There are no comments on this comment yet.