Skip to content

Depending on Functions Instead of Interfaces - Why and How with Scott Hannen

Photo of John Callaway
Hosted By
John C.
Depending on Functions Instead of Interfaces - Why and How with Scott Hannen

Details

We will meet virtually Tuesday, February 9th.

Depending on Functions Instead of Interfaces - Why and How

  • We sometimes harm our code by creating large interfaces rather than
    specific abstractions. Some detail on how that happens and the problems it causes, brief mention of Interface Segregation Principle.
  • Delegates are concise, specific abstractions and are less vulnerable to
    gradual bloat. Show examples of delegates as abstractions.
  • How do delegates work with dependency injection? Examples using static methods and instance methods with an IoC container (Microsoft.Extensions.DependencyInjection.)
  • Mocking delegates in unit tests is even easier than mocking interfaces.
  • The result: Code that depends on smaller, more specific abstractions
    moves us toward smaller, more specific, easier-to-test classes and steers
    us away from giant, vague God classes that make us sad.

Scott Hannen

I've been a software developer for 18 years. After 2010 I learned about
unit testing, clean code, and all the other stuff I wish I'd learned from
the start. I like to write blog posts and answer Stack Overflow questions,
and I hope I can help newer developers to wade through the confusion and get to a better place in far fewer years than it took me.

I lived in Pinellas County from when I was two years old until my wife and
son and I moved to Tampa in 2020 (except for part of a year in the south
California desert.) I'm really bad at having hobbies, but I like to travel
around the world, do stuff that lets me play with animals, practice the
handful of guitar chords I know, and collect software development books I never read. I need a real good reason to write software in my spare time
and rarely do.

Watch the live stream on Twitch! (https://www.twitch.tv/stpetedotnet)

Join our Facebook group (https://www.facebook.com/groups/StPeteDotNET/)

Follow @StPeteDotNET ( https://twitter.com/stpetedotnet ) on Twitter!

Subscribe to our YouTube channel ( https://www.youtube.com/channel/UC_kdG2Reanc7Bo3K0XOYZ-g ).

Photo of St Pete .NET Meetup group
St Pete .NET Meetup
See more events