Hacker News new | ask | show | jobs
by raganwald 6532 days ago
"The criterion for what makes good code is different than what is good English."

In total, yes, but that does not mean that there are no things that work in English that also happen to work in code.

Furthermore, it is difficult to generalize about this: some programming languages are entirely unlike English and work very well, others attempt to be like English and are terrible, while others attempt to be like English in some ways and work.

And further to that, some parts of some programs attempt to be like English and work well, while other parts of programs work well when nothing like English.

Now while I understand bang, andand, and oror, they are a terrible legacy of our C++ days. Bang is especially unforgiveable. If we must have a prefix operator, what is wrong with ~, the actual standard symbol for negation?

;-)

p.s. This thread may seem to be a digression, but it seems quite pertinent to an article that talks about writing code for readability.

2 comments

What's the matter raganwald, jonesing for a blog post now that you've hung up your blogging shoes? :-)
Sadly, cutting out my blogorrhoea has no statistically significant effect on my logorrhoea.
I agree with you that !, &&, || aren't the best idea ever. I wonder if the reason behind them over words is so you don't have to put spaces around them. Omitting spaces seems to be popular with the infix crowd (e.g., they happily give up *,+,- from identifiers just to leave out some spaces).
"I wonder if the reason behind them over words is so you don't have to put spaces around them."

Hunh, that hadn't occurred to me! That's a really interesting conjecture, touching on design trade-offs in neat ways. Thanks!