| Author |
To author
|
Pradeep bhatt
Ranch Hand
Joined: Feb 27, 2002
Posts: 8836
|
|
What is Seam Model which is mentioned in your book ? http://www.objectmentor.com/resources/bookstore/books/welc/
|
Groovy
|
 |
Alexandru Popescu
Ranch Hand
Joined: Jul 12, 2004
Posts: 995
|
|
It was discussed on this thread ./pope
|
blog - InfoQ.com
|
 |
Michael Feathers
author
Greenhorn
Joined: Aug 24, 2004
Posts: 24
|
|
Essentially, it is a way of looking at software that lets you see where you can sense conditions when you test. Here's an example: If I have a Java method like this: and I want to
|
Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0131177052/ref=jranch-20" target="_blank" rel="nofollow">Working Effectively with Legacy Code</a>
|
 |
Michael Feathers
author
Greenhorn
Joined: Aug 24, 2004
Posts: 24
|
|
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.
|
 |
Alexandru Popescu
Ranch Hand
Joined: Jul 12, 2004
Posts: 995
|
|
I would translate this to: refactorings to enable and use mocks. ./pope
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
Originally posted by Ali Pope: I would translate this to: refactorings to enable and use mocks. ./pope
As I understand from Micheal's explanation, a "seam" is a place where two parts of your system are put together to collaborate - and those places enable you to exchange one of the two for a test implementation, i.e. a mock?
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
Alexandru Popescu
Ranch Hand
Joined: Jul 12, 2004
Posts: 995
|
|
Yes. As we discussed above and Michael confirmed, this is mocking. ./pope
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
Originally posted by Ali Pope: Yes. As we discussed above and Michael confirmed, this is mocking.
The point I wanted to make was that in my understanding from the above, the Seam Model not "is mocking", but is a way to analyze your system which helps you find places where you can introduce different kinds of mocks and other substitutes for testing purposes.
|
 |
Alexandru Popescu
Ranch Hand
Joined: Jul 12, 2004
Posts: 995
|
|
Hmmm it may be. Probably I will wait to read the book and than I will have a better idea what it is. ./pope
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 23177
|
|
Originally posted by Ilja Preuss: The point I wanted to make was that in my understanding from the above, the Seam Model not "is mocking", but is a way to analyze your system which helps you find places where you can introduce different kinds of mocks and other substitutes for testing purposes.
Yes! The seam model is a concept. The definition in the book is "A seam is a place where you can alter behavor in your program without editing in that place.) There are different types of seams including preprocessing seams, link seams and object seams. An object seam could have different implementations including interfaces/mocks and subclassing.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3
|
 |
 |
|
|
subject: To author
|
|
|