|
|
|
|
|
by dragonwriter
1794 days ago
|
|
> Suppose you have some method of A which does something special if it gets an instance of B. While that’s in rare circumstances the right thing to do, it's mostly an anti-pattern—you should be taking an object supporting a protocol, with the behavior difference depending on a field or method of (or actually implemented in a method of) that protocol. If you do that, you don't create a dependency on a concrete class that happens to require the special behavior. |
|