logoalt Hacker News

nukanse • yesterday at 11:27 PM • 6 replies • view on HN

Code golf is useless. It could be useful if it were about length of the generated assembly, but it's only about the code, which means is unreadable and unmaintainable.

Instead small assembler has utility because it uses less cache.

On other side, speed golf is the best thing.


Replies

swatcoder • yesterday at 11:37 PM

For things that learn (humans, AI's-while-training), it's a useful exercise.

And things that play (humans), it's a useful diversion.

The sport gives you an incentive to learn a language, library, or algorithm more deeply and to discover new ways to think about how they work. It's very useful.

lg5689 • today at 12:53 AM

It's a purely recreational activity. But there's a surprising amount of depth to it--the skill ceiling is extremely high and it's not uncommon for thought-to-be optimal solutions to be beaten years later. There's lots of crazy math and algorithm tricks you will never see in conventional programming. Getting good at code golf requires mastering not only the language, but lots of math and algorithmic skills as well.

Part of the fun is also doing things you're not supposed to do. Not only does it become unreadable, but you often are abusing dark corners of the language and implementation.

lifthrasiir • yesterday at 11:40 PM

Speed golfing also often makes code unreadable and unmaintainable to some degrees. Everything is a trade-off.

➕ show 1 reply
fishtoaster • yesterday at 11:42 PM

It's about as useless as regular golf. The point is not to be useful, but as a fun competition and a demonstration of a niche skill.

➕ show 1 reply
daymanstep • yesterday at 11:32 PM

What is speed golf?

➕ show 1 reply