Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    Thanks! Why not have the interface with a TextBox property? Commented Sep 19, 2018 at 19:24
  • 1
    In your hypothetical test you would have to create real TextBox instances although you might want to verify only specific behavior of the presenter. Also your interface would be something that is called a leaky abstraction. Commented Sep 19, 2018 at 19:48
  • Thanks! Why not wrap the TextBox with a class that implements an ITextBox interface? And why would it leak the abstraction? Commented Sep 20, 2018 at 15:16
  • Exposing the TextBox in an interface ITextBox is fine as long as that interface really contains what you want your presenter to control/present. Using TextBox directly will couple your presenter to that particular class - it won't be trivial to replace it with other functionally equivalent implementations (for example from a UI library). Such an interface would reveal implementation choices which are (or should be) irrelevant to the presenter, that's why it would be called a leaky abstraction; it's an abstraction which leaks unnecessarily concrete details. Commented Sep 20, 2018 at 19:54