4 ms·
Surprisingly many failures of reading comprehension in the implementations here: https://programming-idioms.org/idiom/184/tomorrow https://programming-idioms.o
by thom 5y ago
Surprisingly many failures of reading comprehension in the implementations here:
https://programming-idioms.org/idiom/184/tomorrow https://programming-idioms.org/idiom/184/tomorrow
I’ve always found it interesting to consider the simplest possible spec you could give 100 programmers and receive no bugs in return.
- ghoward 5y ago> I’ve always found it interesting to consider the simplest possible spec you could give 100 programmers and receive no bugs in return. There is only one or two https://pubs.opengroup.org/onlinepubs/9699919799/utilities/true.html#top https://pubs.opengroup.org/onlinepubs/9699919799/utilities/t... and maybe https://pubs.opengroup.org/onlinepubs/9699919799/utilities/false.html#top https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f... . Even "Hello, World!" is done wrong more often than not. An example: you should check for errors from `printf()`, as in [1]. [1]: https://stackoverflow.com/questions/12355758/proper-hello-world-in-c/12355781#12355781 https://stackoverflow.com/questions/12355758/proper-hello-wo...
- remexre 5y agoNot even both of those; I thought there famously existed some way to make GNU true return non-zero. EDIT: Yep, https://github.com/coreutils/coreutils/blob/master/src/true.c#L67-L69 https://github.com/coreutils/coreutils/blob/master/src/true....
- ghoward 5y agoHa! So it is impossible! Seriously, though, thank you for the link. That is good to know!
- Someone 5y agoBut that’s a complex program, with command-line parsing, locale usage, etc. No wonder it has bugs :-) https://en.wikipedia.org/wiki/IEFBR14 https://en.wikipedia.org/wiki/IEFBR14 was a one-byte program, but that had a bug, so it had to be doubled in size. And yes, it still exists (https://www.ibm.com/docs/en/zos-basic-skills?topic=utilities-iefbr14-utility-do-almost-nothing https://www.ibm.com/docs/en/zos-basic-skills?topic=utilities...). I wouldn’t know how large it is nowadays.
- duped 5y agoWhat do you call a spec that any programmer can understand and correctly describes the problem and its desired outcome exactly? A program
- still_grokking 5y agoThat description doesn't apply for most programs though. * Not all programmers can understand all programs * Most programs don't describe the problem exactly * Almost no program describes the desired outcome exactly
- jstanley 5y agoI think the point is that the implementation of the program exactly describes the behaviour of the program. If you take the program as a description of what the program is supposed to do, then what it is supposed to do is pretty unambiguous! (Also debatable, for example if correct operation of the program depends on some property of its environment that can't always be relied upon.)
- still_grokking 5y agoIt's trivial to say that a program describes its behavior exactly (so it's its own spec). But the whole point of a spec is to describe how a program should behave before writing it. Also you usually want some verification that the program matches the spec. When the program IS the spec what do you match?
- duped 5y agoIt's a joke - the point behind it is that most of programming around specs is refining the spec until it is sufficiently well defined as a program.
- still_grokking 5y agoIt's frankly only a kind of joke. People take it seriously, and you can hear it here and there as "argument" against proper specs.
- still_grokking 5y agoHmm. There are more wrong implementations than correct ones as by now. The core of the problem was noted already: Obviously most people can't read. That's especially "funny" when thinking about all the fuss that is made about teaching children programming in school. They should start with teaching them reading. I don't even mean this snarky. The state of affairs is actually depressing and I would welcome it very much if more people around would be able to read, understanding what's written. Would make a lot of things easier for everybody I guess.
- jpxw 5y agoAlso writing. I don’t believe that it’s possible for someone to be a clear and concise programmer unless they’re able to write their native language clearly and concisely. This would likely require teaching students at least basic logic. This was entirely absent from my school experience. It’s a hugely undertaught and undervalued skill, IMO. Before we start shoehorning CS into high school curriculums, we should consider laying these foundations first.