[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Aliasing vs Delegation

Trans

10/24/2008 6:04:00 PM

Which would you recommend for the implementation of a stub/mock lib?

Thanks,
trans.

2 Answers

Dan

9/15/2008 12:35:00 PM

0

Bob wrote:

> Any loser who uses the word "dasm" should be shot.
>
>



u imbiguous fuck


--
Dan




"The means of defense against foreign danger historically have become
the instruments of tyranny at home."

-James Madison

Trans

10/24/2008 9:58:00 PM

0



On Oct 24, 2:04=A0pm, Trans <transf...@gmail.com> wrote:
> Which would you recommend for the implementation of a stub/mock lib?

An update to this question: In considering it most of the day, I've
decided aliasing is a poor approach. The reason is singleton methods.
Though singleton methods may be rare, their use by the SUT could end
up clobbering stub methods.

As an alternate to aliasing, singleton methods could be used to define
stub methods. While they suffer the same potential problem, it is not
an issue if good practices are used by the SUT, ie. extend objects
with modules rather than defining singleton methods directly.

So I guess the question has changed. It is now:

Singleton Methods or Delegation?

Related to this, one question I have about best practices of using
stubs/mocks... Is it considered bad practice to stub/mock an internal
SUT object? In other words, should stub/mocks always be temporary
objects that are dropped into the SUT interfaces? (I hope that's
clear enough.)

Thanks,
T.