top | item 31407314

(no title)

es7 | 3 years ago

Based on the way the article is written, I wouldn’t trust the author to write readable code either. It seems unfocused and lacks a coherent point… or did I just fail to understand it?

Readability is a very real concern and something every programmer should think about. It’s a form of communication.

It all starts with naming. Naming the entities, classes, methods and variables is probably 70% of making really readable code. In my experience, the difference between ‘spaghetti mess’ and ‘nice, clean code’ can often be achieved with an identical AST structure but with well-thought-out and consistently applied names.

The other 30% probably deserves it’s own book. It involves breaking complex portions of code up into well-named segments (ex: functions or variables), keeping related segments near each other (not spreading functionality out over dozens of files), using consistent patterns and much more.

There is a such thing as unreadable code. The author here has some nuggets of wisdom buried inside a lot of chaos. Maybe his style serves a good purpose for prose, but it isn’t an example of efficient and clear communication. Readable code should be efficient and clear communication.

discuss

order

No comments yet.