In this letter, Dijkstra talks about readability and maintainability in a time where those topics were rarely talked about (1968). This letter was one of the main causes why modern programmers don’t have to trouble themselves with goto statements. Older languages like Java and C# still have a (discouraged) goto statement, because they (mindlessly) copied it from C, which (mindlessly) copied it from Assembly, but more modern languages like Swift and Kotlin don’t even have a goto statement anymore.

  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    8
    ·
    7 months ago

    I think it’s convoluted way to describe it. Very technically-practical. I agree it’s probably because of historical context.

    The argument I read out of it is that using goto breaks you being able to read and follow the code logic/run-logic. Which I agree with.

    Functions are similar jumps, but with the inclusion of a call stack, you can traverse and follow them.

    I think we could add a goto stack / include goto jumps in the call stack though? It’s not named though, so the stack is an index you only understand when you look at the code lines and match goto targets.

    I disagree with unit tests replacing readability. Being able to read and follow code is central to maintainability, to readability and debug-ability. Those are still central to development and maintenance even if you make use of unit tests.

    • Deebster@programming.dev
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      7 months ago

      I wasn’t saying that unit tests replaces readability, I was saying that back in the 60s they’d reason and debug using their brains (and maybe pen and paper), with more use of things like formal proofs for correctness. Now that we write more complicated programs in more powerful environments, it’s rare to do this (we’d use breakpoints, unit tests, fuzzing, etc).