Hacker News new | ask | show | jobs
by hypertele-Xii 1404 days ago
> The fact that it happens to execute without bugs and produces the correct output is far less important than the code being readable, comprehensible, and consistent as part of the larger system.

It's more important that a function looks good, than that it actually works?

I'm sorry, but that sounds stupid. A computer is a functioning machine first.

If it worked from the start, it wouldn't need to be fixed later.

You can always study someone's work to figure out how it works. There's no point studying a system that doesn't.

4 comments

> If it worked from the start, it wouldn't need to be fixed later.

True. But you ignore the fact that NO SOFTWARE IS EVER DONE. Software always has bugs, and even if it didn't, it will bitrot as the business needs change.

In theory, it's better to have 100% working software. In practice, that never happens (or only happens for a few weeks at best). Eventually the software needs to be changed. In that case, software that is "written for humans" will always be easier to change than "software that used to work, but now we need to change it, but nobody understands it".

SOFTWARE CAN AND SHOULD BE DONE. Complicated and bloated systems are never done, but not every system (program/tool/etc) needs to be big, bloated, ugly and complex. It does not matter if the software is 'written for humans', if it's too complicated it won't be changed and/or fixed ever (basically)

On that note, Zawinski's Law:

“Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.”

This is mostly true, but it does not have to be. :(

  "Software is never rewritten. Projects last longer than expected; programmers get bored or burned out; management moves on the newer challenges. The attitude of ‘good enough’ reflects reality.

  Instead of being rewritten, software has features added. And becomes more complex. So complex that no one dares change it, or improve it, for fear of unintended consequences. But adding to it seems relatively safe. We need dedicated programmers who commit their careers to single applications. Rewriting them over and over until they’re perfect. Such people will never exist. The world is too full of more interesting things to do.

  The only hope is to abandon complex software. Embrace simple. Forget backward compatibility." - Chuck Moore
> We need dedicated programmers who commit their careers to single applications. Rewriting them over and over until they’re perfect.

I love this.

Pseudocode is the easiest to change, but also literally does nothing.

Software in practice needs to run to classify. Without that it's just a .txt file that won't compile.

Otherwise you're talking about a standard, a protocol, a document with no program. Instructions for humans how to program computers.

> True. But you ignore the fact that NO SOFTWARE IS EVER DONE.

that is just false. I've seen plenty of one-use software - made specifically for trade shows, exhibitions, etc. which were never reused again because the entire software was the logic specific to that particuliar exhibition.

there is also a few thousand gigabytes of old game ROMs and abandonware on the internet which are all perfectly done software.

All things being equal in code correctness: the preference is cleaner parseable (by humans) code, as opposed to for example: having a while(true) loop with no exit condition, no way to get out of said loop - and have the code work perfectly exiting the loop due to esoteric features that take weeks to figure out, and are brittle to system changes (no code is static).

So yeah: code readability becomes the deciding factor for both what to accept: and what will be (most importantly) the most efficient use of development hours on fixing…

Or a better way of putting it… We are monkeys that bribed rocks and copper to think for us with electricity: design code and systems that even a monkey could maintain.

> I'm sorry, but that sounds stupid. A computer is a functioning machine first.

It is not stupid - just counter-intuitive, which should give us a pause to think. You say, "A computer is a functioning machine first" - yes - but consider why SICP says, "Programs are meant to be read by humans and only incidentally for computers to execute." (see a discussion on the quote https://news.ycombinator.com/item?id=16431701).

> Programs are meant to be read by humans and only incidentally for computers to execute.

A silly thing to say while sitting at the top of the tower of abstraction, ignoring the fact that programs that actually work provide the foundation for the entire system.

Computer programs were originally intended for humans. Entire office buildings of humans with the job title "computer" would examine paper documents and carry out instructions therewithin.

Your linked quote talks about efficiency and style of code, which is a far cry from "execute without bugs and produce correct output" - an unavoidable necessity for a functioning computer.

Software spends a significant amount of its lifecycle in a state of "not done" and/or "not working". The possibility of getting software to "done" or "working" hinges critically on the ability of a human to read, understand, predict, and change that software.

Once the software is done, sure, throw away the source code entirely (if you dare).