← Back to context

Comment by WalterBright

2 years ago

I tend to prefer working with people whose stuff "just works". I take that back. I strongly prefer working with them.

And people who comment their code. Even if it is just a little. I swear, 90% of my time in coding is just fiddling around with functions to see what they do so that I can actually pull them together in the right way. If there was just a little documentation this would greatly reduce my time. It should also be in every team's and company's best interest because people hours are expensive. It should also be in the best interest of an open source project because more people will be able to build on your stuff. It should also be in your own interest because taking the 30 seconds to a minute to write those lines interrupts you and allows you to rethink and verify your method. So not doing it is only in the interest of moving fast and writing spaghetti code. But you're not actually moving fast. You move fast at that moment, but not in the race.

  • Documentation exists in one of these states:

    1. incomplete

    2. wrong

    3. missing

    My goal is to write code that is so clear it doesn't need documentation.

    • Some functions are doing jobs well-defined enough that this is sufficient, but there's plenty that aren't and do deserve additional explanation.

      I don't want to read the code of your function to figure out what its doing. I want to read the function signature, and if that's not clear enough a comment explaining its purpose and parameters. Code explains how it does something, but often does not clearly explain what that something is.

      6 replies →

    • > My goal is to write code that is so clear it doesn't need documentation.

      I hear this so often but I think it is an excuse. Those 3 points are also true about your code.

      > There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors

      4 replies →

    • Please at least document the 'why' of the code. Anyone can spend an eternity on a codebase and figure out 'what' it does, but its very difficult to figure out the 'why' without someone explicitly telling you.

As a software engineer who pays more attention on security than average, I often feel my work didn't get recognized. For example, if I successfully prevented a supply chain attack, nobody would say thanks to me for a thing that didn't happen, even when they see a competitor product gets attacked. Similarly, most C/C++ programmers do not really care about integer overflow. But I know we are no longer in the world that computer viruses are everywhere(though ransomware are still common). The, who made it better? The people who are not satisfied with stuff that "just works".

  • I think you misunderstand what I mean by "just works". It means it doesn't have bugs in it. That includes security holes.