News for hackers. Stuff that matters.
Re:How to name things in programming by stockkid on Monday May 25, 2015 @07:18PM (#9602146)
He provides examples `class PlanEvents`, `class EventPlanner`, `class Scheduler`. To me, they all seem to be active. Any thoughts?
Re:How to name things in programming by throwaway41597 on Tuesday May 26, 2015 @03:56AM (#9603427)
I 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".
Re:How to name things in programming by stockkid on Tuesday May 26, 2015 @07:56AM (#9604140)
Thanks 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, ...
Re:How to name things in programming by JadeNB on Wednesday May 27, 2015 @03:17PM (#9613656)
I may be misreading, but I see these in the opposite way to throwaway41597 (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).
Re:How to name things in programming by peter_hilton on Thursday May 28, 2015 @04:45AM (#9616808)
What’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.