background preloader

Test

Facebook Twitter

Mockobjects.pdf (application/pdf Object) Mocks Aren't Stubs. The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing.

Mocks Aren't Stubs

Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing. I first came across the term "mock object" a few years ago in the XP community. Since then I've run into mock objects more and more. Law of Demeter. Each unit should have only limited knowledge about other units: only units "closely" related to the current unit.Each unit should only talk to its friends; don't talk to strangers.Only talk to your immediate friends.

Law of Demeter

The fundamental notion is that a given object should assume as little as possible about the structure or properties of anything else (including its subcomponents), in accordance with the principle of "information hiding". It is so named for its origin in the Demeter Project, an adaptive programming and aspect-oriented programming effort. The project was named in honor of Demeter, “distribution-mother” and the Greek goddess of agriculture, to signify a bottom-up philosophy of programming which is also embodied in the law itself.

In object-oriented programming[edit]