Last active
October 27, 2016 07:02
-
-
Save Finglas/086ca41a77d1623a999a9dcf8ddc97ac to your computer and use it in GitHub Desktop.
Direct/Indirect Dependency C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bad example, uses dependency directly | |
public void Publish() | |
{ | |
this.twitterFeed.SendTweet(...); | |
} | |
// Better example | |
public void Publish() | |
{ | |
this.PostPublished(); | |
} | |
private void PostPublished() | |
{ | |
this.twitterFeed.SendTweet(...); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment