Re: When not to use interfaces?
- From: frebe73@xxxxxxxxx
- Date: 4 Nov 2006 03:18:11 -0800
If you agree with the idea of unit tests as specifications of behavior
(and I do!), then I would say having an interface (or abstract class)
for even a DTO is important.
A DTO object is an object with member variables and getters and setters
for reading and writing the member variables.
This is a very language-implementation view that is not true in general
(and is quite often untrue in, say, Python or C#). A DTO wraps
multiple discrete values as a single discrete object. Whether it uses
member variables, getters/setters, properties, or any other method of
accomplishing that task is an implementation detail and not a
consequence of the DTO concept.
My point is that a DTO contains very little behavior. The DTO is mainly
a datastructure and the implementation is very simple. Regardsless what
language that is used, there are no point in creating a mock
implementation of a DTO. The purpose with a mock is to have a simpler
implementation fullfilling the same contract/interface. If the
implementation is already as simple as possible, the mock would not be
very different from the real implementation.
Fredrik Bertilsson
http://frebe.php0h.com
.
- References:
- When not to use interfaces?
- From: moop?
- Re: When not to use interfaces?
- From: Matt McGill
- Re: When not to use interfaces?
- From: frebe73
- Re: When not to use interfaces?
- From: sjdevnull@xxxxxxxxx
- When not to use interfaces?
- Prev by Date: Re: Relational database & OO
- Next by Date: Re: object databases
- Previous by thread: Re: When not to use interfaces?
- Next by thread: Re: When not to use interfaces?
- Index(es):
Relevant Pages
|