Hacker News new | ask | show | jobs
by fizlebit 729 days ago
:) yes. I saw that error and wondered whether someone would point it out. I think the author fails to acknowledge that the use of variables like "verb" just make the code much harder to understand than a string that reads mostly like English.

  question = "Is";
  object = "this";
  adjective = "easy";
  String.format("%s %s %s");
vs

  String.format("Is this easy");
The second is much easier to understand than the first, so one should be careful when pulling out too many variables.

Seems like someone should write a book called "Clean Code Done Right" that has actual good examples of code. Maybe Rich Hickey? The high level advice is good, code should be written as simply as it can be. Functions should have a small clear mission and it should be easy to argue that the function is correct locally. That is to say: a functions correctness shouldn't depend in a complicated way on other functions, just a reasonable expectation on the behavior of the functions it calls, and a reasonable simple description of its mission. Easy to state this objective often difficult to achieve in practice.

Maybe a book showing elegantly coded solutions to actually difficult programming problems would be good, e.g. a system with maybe the complexity of high performance sharded fault tolerant Redis. There would be a lot of interesting topics there.