Originally posted by Pradeep Bhat:
What is Seam Model which is mentioned in your book ?
http://www.objectmentor.com/resources/bookstore/books/welc/
Essentially, it is a way of looking at software that lets you see where you can replace behavior when you test.
Here's an example:
If I have a Java method like this:
and I want to test it without running the methods on account (because it talks directly to a database) then I'm in a bit of trouble. In this code, I'm not, because each call to account is now a seam, a place where I can replace behavior:
How can I replace behavior? I can pass in a FakeAccount rather than a real Account.
In the first piece of code, those calls were effectively hard coded, I couldn't have other methods executed when the method called a.deposit, etc. In the second example, I can.
This seam, the object seam, is pretty common and easy to use. There are a bunch of others: text seams, link seams, etc. When you start to see your code in terms of seams, you can get a good seams of where I can instrument your code for test.