Linked by Thom Holwerda on Sun 28th Jul 2013 14:06 UTC
General Development "There is a reason I use 'old' languages like J or Lush. It's not a retro affectation; I save that for my suits. These languages are designed better than modern ones. There is some survivor bias here; nobody slings PL/1 or Cobol willingly, but modern language and package designers don't seem to learn much from the masters. Modern code monkeys don't even recognize mastery; mastery is measured in dollars or number of users, which is a poor substitute for distinguishing between what is good and what is dumb. Lady Gaga made more money than Beethoven, but, like, so what?" This isn't just a thing among programmers. The entire industry is obsessed with user numbers, number of applications, and other crap that is meaningless when you consider programming to be art. When I post a new item about some small hobby operating system, the comments will be filled with negativity because it's no Windows or iOS, whereas only ten years ago, we'd have lively discussions about the implementation details. And then people wonder why that scene has died out.
Thread beginning with comment 568235
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: Art or engineering?
by galvanash on Mon 29th Jul 2013 01:15 UTC in reply to "RE[2]: Art or engineering?"
galvanash
Member since:
2006-01-25

That's the most useless use of Duff's devices I've ever seen.


I don't see how, since this is the intended use of Duff's device - those are the exact examples straight from Tom Duff's usenet post in 1983...

My question would be where you have seen a useful use of Duff's Device? It wasn't really intended to be useful, more of an oddity really. It has been used in actual product code, but very rarely and on modern processors it is pretty much pointless.

It's performing a word-by-word copy but has additional addition, a whole bunch of extra comparisons and is vastly less readable. What precisely is that supposed to gain over the "naïve" implementation, precisely?


Its over 50% faster on the hardware it was written for (VAX), but that isn't what makes it art. It is the creative intermingling of a switch and a while loop, taking advantage of case fall through in the C language to allow the code to jump into the middle of the unrolled loop to handle the remainder in the last pass.

My point isn't that this is good code, its not. But it is arguably "art" in the truest sense - it leverages the rules of the language it is written in a very unique way, leaving the reader to puzzle out what is going on. It in a sense has a hidden meaning, one that is not obvious at first pass. It seemingly does something that appears to violate the rules of the language, but in fact does not - it is perfectly legal C code.

Those are not traits of good code, in fact they are traits of bad code... But they are traits of art.

Reply Parent Score: 4

RE[4]: Art or engineering?
by Vanders on Mon 29th Jul 2013 17:21 in reply to "RE[3]: Art or engineering?"
Vanders Member since:
2005-07-06

I've seen Duff's device used quite sensibly for chunked copies/reads/writes, but never sensibly for a word-by-word copy like that. Eh, not that it's relevant to your point.

Reply Parent Score: 2