Three Basic Fakes
The Relationship Between Fake And Awkward
The fake replaces the awkward collaborator which we actually ship.
In a statically typed language, this means they must have the same type.
Therefore only two relationships are possible between
Of these, the relationship on the left is the most prevalent in strongly-typed languages.
It involves a slight risk:
Awkward
and Fake
:Awkward
's methods could be renamed while Fake
's wouldn't, and then Fake
would be useless. Proper tools and care should help mitigate this risk.Rarely, there is a third possible relationship, where Awkward
has a usable, bare-bones base class that we can use (rather than creating a fake).
But strictly speaking, that base class isn't a fake.
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |