by po · 16y ago · 0 comments
Just today I renamed a method someone named "showButton" because I thought
result = showButton()
was a call that showed the button and returned a boolean result. In reality it just returned a boolean based on if it was configured to show a button. The new name: "shouldShowButton"But then I got to thinking… well… maybe I'm suggesting that the button should be shown…
There's something to be said for context.
result = buttonShown()
result = buttonVisible()
result = buttonIsVisible()
result = visibleButton()
result = !buttonHidden()
To a lot of programmers this would seem like a waste of time, but I'm with the article's author (and, I'd hope, other HN readers) in that it's time well spent.