3 ms·
OOP design practices often consider NounVerber classes as a design smell that should be avoided at all costs; this article introduces them as the solution for e
by PeterisP 12y ago
OOP design practices often consider NounVerber classes as a design smell that should be avoided at all costs; this article introduces them as the solution for everything.
How does it go together?
- donw 12y agoThat's fair criticism -- I've updated the article to make it a bit more clear. The point isn't to create "NounVerber" classes as a solution for everything, but to break your objects apart according to the roles that they play in solving the problem. Thinking of objects as actors has helped me with this over the years. In the example "ProductSearcher" should probably have been named "ProductSearch" -- you can instantiate it, pass it around, and so on, so it doesn't quite behave like many the "NounVerber" objects in Javaland (e.g., AbstractFactoryBeanBuilderImpl). When you couple this with a functional approach -- where you separate transformation and state -- magic happens. But that's a future article. :)
- Double_Cast 12y agoMaybe the objects-as-agents could pass around a struct? E.g. I imagine the Store_Manager (driver class) could call (like on the telephone) the Accountant and ask to submit a report (struct) of all the inventory that fits the parameters. Or would that be another anti-pattern?