News for hackers. Stuff that matters.
Re:Anyone who looks at this code instantly becomes insane by _bxg1 on Thursday August 01, 2019 @03:04PM (#20587173)
Yeah. This is the code of a very smart person who didn't take the time to make abstractions, either through laziness or naivete. I've seen much more deeply-wrong code that would be much harder to refactor into something maintainable than this would be.
Re:Anyone who looks at this code instantly becomes insane by mntmoss on Thursday August 01, 2019 @06:00PM (#20588786)
Yes, this kind of "naive coding technique" occasionally pops up, and I think it's a good discussion topic, because its mere existence demonstrates that you can get extremely far in terms of delivering features with a minimal amount of abstraction: "sometimes all you need is a function."

Further, that the code probably would not really be hideously miserable for a more experienced coder to refactor(it's just very duplicated) shows that copy-paste is reasonable for deferring some kinds of architectural decisions. It's not what you would bias towards if you have a whole team pounding away at the same file and rapidly evolving it, but as a solo practitioner who wants to get the feature out and put it away for the day, this style is convenient for letting the code as a whole develop some maturity and functionality before it gets refactored with abstraction.

Re:Anyone who looks at this code instantly becomes insane by realSlavojTrump on Thursday August 01, 2019 @06:58PM (#20589151)
Give refactoring this code a go! Its sublimely fun!!!
Re:Anyone who looks at this code instantly becomes insane by kehphin on Thursday August 01, 2019 @03:27PM (#20587373)
https://intuitiveexplanations.com/assets/Resume.pdf - author's resume is pretty impressive. Glad to see he's doing well.
Re:Anyone who looks at this code instantly becomes insane by stirfrykitty on Thursday August 01, 2019 @03:25PM (#20587347)
But isn't this the beauty of programming to begin with. Barring certain things like medical devices, cars, etc., where it has to be very orthodox, for stuff like Web back/frontends, and even gaming, this is how people learn, I guess. Sure, that code could be re-factored for speed, cleaner in appearance, etc.

Reminds me of the video driver (forget card) some Linux developers wrote that was ~30k lines of code. OpenBSD wanted to use it because the HW manufacturer wouldn't release the specs, but because the Linux code was GPL, the OpenBSD guys re-wrote it from scratch in less than 1/4 of the code.