-5

So I am reading Clean Code. In the Meaningful Names chapter, they lay down a rule of no verbs in class names. However in the Adding Meaningful Context section of that chapter, on page 29, he uses a class name GuessStatisticsMessage.

How can we validate the use of Guess in a class name, even though it is a verb?

3
  • 3
    Guess is a noun (see definition 3). That class could simply be a message about the statistics of guesses, but we'd need more context to know if that is the case.
    – 8bittree
    Commented May 4, 2017 at 20:45
  • 6
    Does it really say "no verbs in class names", or "no verbs as class names"? Nouns can very well be composed of other word classes, such as "know-it-all". Besides, Guess might very well be a noun: a Message about your best guess of some statistics. Commented May 4, 2017 at 20:46
  • 2
    @8bittree I re-checked the book (listings 2-1 and 2-2) and it indeed looks like guess is used as a noun over there. printGuessStatistics(char candidate, int count) --> "how good was our guess at candidate char"
    – gnat
    Commented May 4, 2017 at 21:19

1 Answer 1

0

Here,Guess is a noun being used here.As pointed out by @Killan Foth in the comment section,it should be no verbs as class names. There are cases in english where a verb behaves as noun. In the context,without looking the function definition, Guess might be indicating the how probable the guess was right or wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.