This post originated from an RSS feed registered with Ruby Buzz
by Jason Watkins.
Original Post: Are nouns better than verbs?
Feed Title: Jason Watkins
Feed URL: http://jasonwatkins.net/rss
Feed Description: blog.collect{ Thought.rand }
Of course you donât just want to delete a trouble ticket. You want to know more. And thatâs a sign that the operation shouldnât have been on the TroubleTicket in the first place. You want to have a âTicketClosureâ. Then youâll realize that you want to store a resolution as well as the person who closed it and the date. Now youâve got a very useful part of your domain model â the hint was that you were writing some thing that wasnât CRUD â you needed a new noun instead of a non-standard verb.
Something really clicked for me here. Domain models are about storing and manipulating information that represents the world. Typically we do this with objects. There’s a tired metaphor that objects are the nouns, and their methods are the verbs. But maybe that perspective is missing something interesting. What if we start thinking purely in terms of nouns?
What if our domain modeling is just about accumulating history over time? What if it’s all just about the existence of facts and relationships? What if all we do is add nouns using standardized verbs, rather than having a vocabulary of verbs?
There’s something about this I like a great deal. Instead of having methods that let us ask about and manipulate an object’s hidden state, we enrich the relationship modeling to encode the history of events as facts directly.
What do we gain?
We have knowledge not just of “what is”, right now, but also a detailed history of “what was”, back then. We can query across this history in a standardized way, and compose novel ad hoc views of the information with standard operators.
What do we lose?
Perhaps simplicity. Sometimes it’s just simpler to say ticket.close! than to create a new TicketClosure object with the appropriate relations.
How do we balance this tradeoff?
I find it an interesting perspective that I hope to leverage in future work: looking for opportunities to turn a verb into creating an instance of a noun.