Skip to content

Code isn't poetry

jshak.es
11 pointstholex5 comments
On HN

Comments

Pedantic is putting the braces in even where they're optional, simply because it avoids problems later on. Pedantic is using Yoda conditionals [1] in C because it enables lvalue checking in the compiler. Pedantic is checking return codes, using assertions, and validating inputs. Pedantic is not unnecessary code; it recognizing what is necessary, and doing it.

[1] E.g., "if (1 == n)" instead of "if (n == 1)" (or prefer a language that uses := for assignment).

Any syntax is less readable if you're unfamiliar with it. If you see enough of them, it reads naturally.

I don't agree that the second example is more readable than the first

But it is!

Why do you think that?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.