3 ms·
> “Code should be written for humans to read and only incidentally for machines to run” So this is a cute statement but isn't it actually false? None of us wou
by landryraccoon 7y ago
> “Code should be written for humans to read and only incidentally for machines to run”
So this is a cute statement but isn't it actually false? None of us would be sitting around code reviewing each other's code for fun if there wasn't a mountain of money / value / knowledge to be extracted from a computer running the code at the end of the day.
Actually this is easily falsifiable. As soon as quantum computing becomes possible the first languages will probably be quite horrible, with painful tooling and torturous debugging and difficult to read control flow compared to current modern languages. Nonetheless, a huge army of programmers will be trying to write code for these quantum computers, for the sake of the computer, and not for any human to read.
- pm90 7y agoAnother "Actually this is false in the corner case I'm going to call out". Of course its not a universal rule, its not a law of physics. Doesn't make it less useful as a guiding principle (similarly, design patterns in software architecture). The core argument is that we're besides the point in conventional (2019) computing where we need to worry too much about optimizing code to run as efficiently as possible. The complexity and bottlenecks to delivering features is now in writing software that is meant to be worked on and maintained by a large number of humans. And for that purpose, it is better to optimize for clarity.
- landryraccoon 7y agoBut it's not really a corner case though. For a lot of professional applications it's perfectly fine to make a tradeoff of complexity or readability in order to get performance. And that tradeoff is done for business reasons - because sometimes the computer is more important than the programmer.