About
Rhino Research is a consulting and training company focusing on software architecture. Our primary consultant and instructor is Dr. George Fairbanks, who has a Ph.D. in Software Engineering from Carnegie Mellon University and has been teaching software architecture and object oriented design since 1998. More…
Just Enough Software Architecture book
Just Enough Software Architecture: A Risk-Driven Approach by George Fairbanks.
Buy the hardback from Amazon for $34.50 or the e-book for $19.50.
Public Talks
- 9 Feb 2010: Boulder Java User Group – Design Fragments.
- 4 Mar 2010: CU Boulder Colloquium – Design Fragments.
- 6 May 2010: IASA Denver ITARC — Architecture Haiku
- 21 May 2010: SEI SATURN conference – Risk Driven Architecture.
- 14-15 June 2010: AgileRoots 2010 — Architecturally Evident Coding Style in Salt Lake City
- 21 July 2010: Northern Colorado Architects Group — Architecture Haiku in Ft. Collins
- 3 Aug 2010: Denver Open Source User Group — Architecture Haiku
- 7 Sept 2010: Boulder Java User Group — Architecture Haiku
- 17-21 Oct 2010: SPLASH / OOPSLA — tutorial on Architecturally Evident Coding Style
Recent blog posts
- Architecture Hoisting - video of Atlanta talk
- Speaking at Atlanta IASA, Weds 14th, 2012
- Book on sale: Now just $19.50 with free shipping (limited time)
- More book citations: Muddy architecture
- New review of my book
- Talk on expressing architecture in code: AgileRoots 2010
- CompArch/WICSA 2011 - Panel discussion and Haiku tutorial
- Much good news: Second printing, Amazon top-10
- Another great Amazon review of my book
- Interview in InfoQ -- and in Japan




your code shouldn't resemble your model
Nels, I agree with you that the view, “model your domain and turn each concept into a class”, is too simplistic. An OO program is invariably much messier than its domain model (e.g., because of language shortcomings, such as bi-directional relationships in Java), but that’s not even the whole problem. I think it is fundamentally a mistake to think about the problem (domain model) and the solution (OO program) as mirror images. The OO program is designed to meet non-functional requirements, and those first of all dictate certain decisions to make the program, I don’t know, faster or maintainable. And then it turns out that what we do in the model world, mixing data and behavior, is not what we do in the program.
In my experience it is very very beneficial to separate out data and behavior. In other words, some classes in the program just encode the data, like the famous “Student” class with fields like firstName and lastName. But that class doesn’t have a “graduate” method; that method is in some “manager” class. So fundamentally, we’re ripping our domain model apart and allocate behavior essentially arbitrarily somewhere in the program. What remains is the data, which encapsulates the “state of the world” part of our domain model.
Now that data part, I think, can, modulo practical issues like bi-directionality, resemble the model very closely in code. One may want to re-group things here and there, or make distinctions that are not in the model, but that’s about it. Incidentally, this is the part we like to store in databases, and so this separation also makes sense because we can hand those data objects, which is what they’re actually sometimes called (or “value” objects), to Hibernate or some other persistency layer. This is really really common in enterprise systems. EJBs practically force you to make a separation like this, and they even have names for it, Entity Beans for the data and Session Beans for methods that operate on that data (i.e., for the behavior).
I have a suspicion that other separations like this may also be beneficial, but this is a very common, useful, and familiar one to me. And it makes the domain model be fundamentally different from the code.
OK, enough for now, let me know what you think, and I’ll try to come up with more wisdom about the differences between problem and solution. Btw, I learned to call these two parts “analysis” and “design”, and even if they use the same notation (UML) it doesn’t mean they’re the same at all.