This question already has an answer here:
- OOP principles and method names 7 answers
Is there some recommended practice regarding methods as verbs in OOP? Should the object work syntactically as subject or as object/complement?
object.doSomething() be normally understood as "the object iself does something" (subject) or "the caller does something with the object"?
I suspect that the first alternative is more right, and it sounds more natural with such a general verb... But consider for example "OutputStream.write(byte)", which...
writes b.length bytes from the specified byte array to this output stream.
Here it's not the object who is the subject of the action, it's the caller. The Writer (rather confusingly) does not really "write", its the caller is who "writes" bytes to the Writer. Should this be considered incorrect?