4 ms·
What did he mean by "never use passive when you can use the active (respect grammatical rules for identifiers)", on the slide 15?
by stockkid 11y ago
What did he mean by "never use passive when you can use the active (respect grammatical rules for identifiers)", on the slide 15?
- asmithmd1 11y agopassive: He was told by a doctor to take a pill active: The doctor told him to take a pill
- stockkid 11y agoHe provides examples `class PlanEvents`, `class EventPlanner`, `class Scheduler`. To me, they all seem to be active. Any thoughts?
- throwaway41597 11y agoI also found the examples confusing. What I got is they are all nouns (respect the grammar rule of having nouns for class names) but `PlanEvents` reads like data that is going to be processed (passive) whereas `EventPlanner` and `Scheduler` are concepts that process data (active). They have a verb: "plan" and "schedule".
- stockkid 11y agoThanks for clarification. I think I disagree with the author here. In my experiences, it's sometimes awkward to use '-er,' '-or' suffixes to turn name into concepts that process data (active) e.g. JobUpserter, ...
- JadeNB 11y agoI may be misreading, but I see these in the opposite way to throwaway41597 (https://news.ycombinator.com/item?id=9603427 https://news.ycombinator.com/item?id=9603427). To me, `PlanEvents` is active (it describes doing something, or, rather, commands to do it), whereas `EventPlanner` and `Scheduler` are passive (they describe the mechanism by which something is done, not the doing of it).
- peter_hilton 11y agoWhat’s not on the slide, but which I say during the talk, is that I’m making an analogy here between ‘Don’t use passive voice’ (English) and ‘use noun phrases for class names’ (object-oriented programming). Both are kinds of grammatical guidelines. What I also say in the talk is that this analogy is a stretch, but at least advice from writers about writing can inspire us to think about how we write code.