Audio Player

http://media.blubrry.com/codingblocks/www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/codingblocks/coding-blocks-episode-001.mp3

Podcast: Play in new window | Download

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.

Download the episode on iTunes or Stitcher.

Show Notes

Duration: ~44m

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:

https://www.codingblocks.net/podcast/programming-with-interfaces/

Naming Conventions

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:

https://www.codingblocks.net/podcast/interface-naming-conventions/

Interfaces Limitations

09:16 – 19:36

  • Constructors
  • 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:

https://www.codingblocks.net/programming/what-if-interfaces/

Begging for Feedback

19:36 – 19:55

We’d love to hear your comments and honest feedback, contact us at comments@codingblocks.net!

Explicit Interfaces

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 pitfalls and confusion around explicit interfaces.

https://www.codingblocks.net/programming/the-dark-side-of-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

Debugging

35:23 – 39:40

  • Debugger’s not so great with interfaces

Tip/Tricks

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 comments@codingblocks.net.

About Joe Zack

Joe is a Software Developer based in Central Florida. If it weren't for ticketing systems he would gladly refactor himself in circles all day long.

These days Joe is excited about JAMstack and Search.

When he is not basking in the glow of a monitor you can find him walking around Cocoa Beach or annoying his wife by playing "music".

Joe can be found blogging here or tweeting there.