The good, the bad, and the ugly side of interfaces. We list some minor gripes, their limitations, and some strange gotchas as well as some tips for how we like to (mis|ab)use them.
What Are Interfaces?
0:00 – 5:21
- Interfaces are a contract
- Interfaces imply a can-do relationship
- Differences between interfaces and abstract classes
- Interfaces as Guardrails
Related Post: Interfaces as Guardrails
More information and examples on the “interfaces are guardrails” and “baking it in” concept:
05:21 – 09:16
- Interface conventions use hungarian notation, begin “I”
- Show up “mid-directory” in IDE’s
Related Post: Interface Naming Conventions
We programmers tend to have a few OCD qualities, discussion here on interface naming conventions:
09:16 – 19:36
- Anonymous classes
- Static classes
- Adapter Pattern as workaround
Related Post: What if interfaces…?
Fun take on what it might look like if interfaces supported constructors, statics, and anonymous classes:
Begging for Feedback
19:36 – 19:55
We’d love to hear your comments and honest feedback, contact us at firstname.lastname@example.org!
19:55 – 29:37
- What are explicit interfaces?
- Avoid when possible
- Explicit method implementation is marked private
- Cannot be called by a derived type
- Favor interface inheritance over modifying public interfaces
Related Post: The Dark Side of Interfaces
Closer look at a few of the pit falls and confusion around explicit interfaces.
Baking it in
29:37 – 35:23
- Enforcing logic through grammar
- Interface Segregation Principle
- Refactor without changing underlying code
- Reduce testing dependencies
- Enable easy mocking
35:23 – 39:40
- Debugger’s not so great with interfaces
39:40 – 43:36
- Right click the using section to alphabetically sort and remove unused “using” directives
- Ctrl-Period shortcut adds required “using” directives or auto-generate interface stubs on classes
- Route Debugger and WebApi Route Debugger provides tons of information about routes
Thanks for checking out the podcast. We’d love to hear your honest feedback in your iTunes review or at email@example.com.