I recently asked a question asking whether my code could be minified any further, but it was put on hold for being off-topic.

Tim commented that he "voted to close as this is a code-golf question" and cited What topics can I ask about here?

Now, I know that code golfing isn't allowed here, but I thought code golfing was posing a fun challenge, not asking if code I've already written could be compressed. So, he suggested I post this, and I did.

Is asking how already-written code can be compressed considered code golfing? If not, is there another reason questions about code compression/minification would be off-topic?

  • 1
    \$\begingroup\$ There's a whole SE website about code golfing... is it off topic there? \$\endgroup\$
    – Pimgd
    Commented Aug 24, 2014 at 17:08
  • \$\begingroup\$ Code Golf is generally a puzzle site, but there's this snippet on their help page, "'Tips for golfing in some language'-type posts are an exception to this rule. Such posts are community wiki and do not collect reputation." I would suggest visiting their meta and asking if this would be on topic before posting the question though. \$\endgroup\$
    – RubberDuck
    Commented Aug 25, 2014 at 11:56

1 Answer 1


Good question.

It is a basic purpose of code reviewers in general, and Code Review in particular, to encourage code that is reliable, maintainable, readable, and generally 'good'.

It is implied in this that compressing code down to a minimalist representation is by definition not the purpose of Code Review. If you want to do things in as few bytes of source code as possible, then what you are looking for is not 'good, readable, maintainable code'.

Now, it may be that for some languages, like Javascript, there is a benefit to having code that is heavily 'compressed' because that improves performance.

For situations like that, though, you should still write good code, and use a tool to do the compression for you. The 'source' code is the pre-compressed version.

There is no reason on Code Review, for a question to ask for code to be written in as few characters as possible.

This is why you were likely pointed to the on-topic page, as one of our requirements in a question, is that the purpose of the question needs to be:

Do I want the code to be good code? (i.e. not code-golfing, obfuscation, or similar)

  • \$\begingroup\$ I'd like to have a tool that compresses it as well as or better than I can, then. Also, where should I ask questions about how to compress code? Because I know compression tools can't re-evaluate my code and use better libraries or anything like that. \$\endgroup\$
    – Ky -
    Commented Aug 23, 2014 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .