A somewhat #longread on what “elegance” means when it comes to code:
I get a gut feeling when something is elegant, and a different gut feeling altogether when something is hacky; I suspect most programmers experience the same. The strongest pattern I’ve found is this:
Elegance is about expressing exactly what you mean — no more, no less.
Conversely, I could define a hack as something that doesn’t remotely express what you mean, but happens to have a close-enough effect.
Eevee goes on to disect some code examples. Thankfully, most of them are from video games. 😅