Skip to content

Comment on Tell Don't Ask (1997)parent

Comments

and then you have a function like: `def printGreeting(lastName, firstName)`

and you call it like `printGreeting(firstName, lastName)`

and whoops, the compiler won't tell you you did something wrong. Maybe your editor will, if it shows handy little param name stuff next to the args in your call, but a github PR won't.

So someone ordering the arguments in a method in a non-intuitive way makes your variable name much less useful once you have to pass it around.

Sure, this is a trivial example ("why did you order the params in such a dumb order!?!?") but that's what is meant by variables not knowing much about what they are. It's a String. That doesn't tell us much, and doesn't tell the compiler or interpreter much about which functions expect it in what places.

AboutSource Built by g1lg1l

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