• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

To author

 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is Seam Model which is mentioned in your book ?
http://www.objectmentor.com/resources/bookstore/books/welc/
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was discussed on this thread

./pope
 
author
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 sense conditions when you test.


Here's an example:

If I have a Java method like this:



and I want to
 
Michael Feathers
author
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would translate this to: refactorings to enable and use mocks.

./pope
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. As we discussed above and Michael confirmed, this is mocking.

./pope
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm it may be. Probably I will wait to read the book and than I will have a better idea what it is.

./pope
 
author & internet detective
Posts: 42160
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic