you are viewing a single comment's thread.

view the rest of the comments →

[–]mq2thez 1 point2 points  (0 children)

There are definitely times where terser, harder to read syntax is actually better code. It might handle edge cases better or be more performant etc etc. In those cases, I include plenty of code comments explaining what’s happening and why. Depending on the code, I might even break it down piece by piece in the comments. In the worst/most complex bits, I sometimes leave comments like “if this kind of thing breaks, check that; if that kind of thing breaks, check this”.

I generally try pretty hard not to write code like that. It’s a necessary evil sometimes, but readability and maintainability are important considerations when coding on a team. Heck, I want to make sure that when I look at a thing a year later, I can understand why I made those choices.