Call Things What They Are saturnci.com · 11 points · 5 comments · HN thread TL;D...

@best

Call Things What They Are saturnci.com · 11 points · 5 comments · HN thread

TL;DR The author argues that the bicycle gear-inches example from Sandi Metz's POODR violates the principle of naming things for what they are. He renames variables and methods (rim_diameter, tire_thickness, size_inches, gear_ratio, diameter_inches) and says the code becomes far easier to understand. The discussion is short, with commenters agreeing on clearer names but questioning the formula and the broader value of long names.

  • The POODR snippet uses names like rim and tire for numeric values, so the author could not tell what they meant without asking an LLM (Claude).
  • Wheel#diameter computes rim + (tire * 2), which is only meaningful if rim is a diameter and tire is a thickness.
  • Renaming variables to rim_diameter_inches and tire_thickness_inches makes the diameter formula read clearly.
  • gear_inches is a poor method name because a gear has a size, not a gear; the author proposes size_inches.
  • Units should be applied consistently: either all inch values get an _inches suffix or none do.
  • The author says changing only names in legacy code can transform its readability, and that the habit costs little to learn.

Discussion The thread is small, with five comments, and mostly agrees with the article's core point that names should match what values are. The discussion quickly turns critical in two directions: one commenter notes that the formula itself is questionable, since tire thickness should not appear in a wheel's diameter calculation, and suggests units belong in the names of non-dimensionless values. Others dismiss the piece as a restatement of the well-known 'long variable names are good' advice, which they say draws unexpected pushback, and one extends the complaint to jargon and vague terms in software in general. The tone is brief, mildly critical of POODR, and mostly agreeable to the naming principle.

  • Naming for what values are is good practice (some): Commenters broadly accept that descriptive names help readers, and the article's renaming makes the intent clearer. The point is treated as basic rather than novel.
  • The formula itself is wrong, not just the names (some): One commenter argues that tire thickness should not appear in the wheel diameter formula at all, so the example is flawed beyond naming. This challenges the article's use of POODR as a model.
  • Units should be in names of non-dimensionless values (a few): A commenter argues that unit suffixes matter for quantities with units, which the article also suggests through its _inches changes.
  • POODR has many problems (a few): One commenter dismisses the book as flawed in general, using the example as one of many issues rather than engaging with the naming argument.
  • Long names are good but get pushback (a few): A commenter says the article simply restates the case for long descriptive variable names, which surprisingly draws objections in practice.
  • Vague jargon and terms are the real problem (a few): One commenter calls the issue high variance ambiguous language and points to jargon like calling React components or web pages 'surfaces' as similar misnaming.

#naming #rubyDesign #codeReadability #POODR #softwareDesign