Skip to content

Instantly share code, notes, and snippets.

Created November 4, 2009 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/226216 to your computer and use it in GitHub Desktop.
Save anonymous/226216 to your computer and use it in GitHub Desktop.
(Regarding: http://www.markhneedham.com/blog/2009/11/04/reading-code-unity/}
Mark - Excellent post! However, a comment you made compelled me to respond:
"I've read about the 'yield' construct before but I've never seen a need to use it yet in any code I've written..."
I strongly urge you to become more familiar with the "yield construct", iterators, and IEnumerable<T>. A strong and deep understanding of this will help you with many of the innovations coming in future .NET releases, namely IObservable<T> and eventually the Reactive Framework.
Digging in a bit deeper, you might want to learn about Monads, on which IEnumerable<T> and IObservable<T> are somewhat based upon. That may scare some, and quite frankly from a strictly mathematical perspective I can understand why, but there are some excellent Channel 9 videos that you can look into. Even if you don't "get it" right away (which I didn't either), keep revisiting them. Eventually when it sinks in, you'll see some really concise ways to solve problems in your code. Here are some videos to look at (note - there are some small sections of people talking just about the mathematical aspects - if you're not interested, skip ahead in the videos; they demonstrate how it all applies in C#, F#, and .NET in general):
http://channel9.msdn.com/posts/Charles/Brian-Beckman-Monads-Monoids-and-Mort/
http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/
http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-The-Zen-of-Expressing-State-The-State-Monad/
http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-The-Zen-of-Stateless-State-The-State-Monad-Part-2/
http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Brian-Beckman-and-Erik-Meijer-Inside-the-NET-Reactive-Framework-Rx/
http://channel9.msdn.com/shows/Going+Deep/Kim-Hamilton-and-Wes-Dyer-Inside-NET-Rx-and-IObservableIObserver-in-the-BCL-VS-2010/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment