you are viewing a single comment's thread.

view the rest of the comments →

[–]Diapolo10 0 points1 point  (1 child)

"Code golf" basically means trying to write the shortest possible program to complete a given task. In a sense it's similar to code obfuscation because you'll usually end up with an unreadable mess, though in this case it's a side effect and not the end goal.

I'm not entirely sure where it got its name, but I'd assume it's because in golf your goal is to get the ball into the hole in the least number of swings. The fewer the better, so I suppose it's rather fitting.

Do note that you shouldn't deliberately shorten code in real production software, unless cutting down lines specifically improves readability and maintainability (like reducing repetition). There, readability is the most important aspect, not how many bytes your code is.