Subscribe: Managed World
http://geekswithblogs.net/jolson/Rss.aspx
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
code  exercise  jolson archive  net jolson  net  new  open space  originally posted  posted geekswithblogs  visual studio 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Managed World

An Archived Managed World



This blog has moved to http://www.managed-world.com/blog



Copyright: Jason Olson
 



This blog has moved

Sat, 19 Dec 2009 17:46:27 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/12/19/this-blog-has-moved.aspx

If you are subscribed to my RSS feed, you shouldn't see this as FeedBurner should have redirected you automatically. This blog has moved to http://www.managed-world.com/blog. This site is now for archive purposes. Thanks!

(image)



Visual Studio 2010 Training Course on Channel 9

Wed, 21 Oct 2009 17:08:58 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/10/21/visual-studio-2010-training-course-on-channel-9.aspx

This morning, Channel 9 launched the new Channel 9 Learning Center. From Channel 9, here’s a description of what the Learning Center is: “The Channel 9 Learning Center is the destination for free technical training on emerging Microsoft products and technologies. The Learning Center consists of a set of courses with each course including a set of videos, hands-on labs, and source code samples to get you up-to-speed quickly.”(image)

I’m pleased to say that Visual Studio 2010 is one of the first Training Courses that we have launched on Channel 9. Please welcome the Visual Studio 2010 Training Course

What is the Visual Studio 2010 Training Course? The Visual Studio 2010 and .NET Framework 4 Training Course includes videos and hands-on-labs designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including: C# 4.0, Visual Basic 10, F#, Parallel Computing Platform, WCF, WF, WPF, ASP.NET AJAX 4.0, ASP.NET MVC Dynamic Data.

Essentially, the Training Course is an online version of our Visual Studio 2010 Training Kit. In this first release of the training course, it contains a subset of the content that is actually present in the training kit. Of course, since it is an online delivery mechanism, we will continue to add more items from the training kit into this training course over the coming weeks and months.

This first version of the Training Course includes intro videos and labs on the following technology areas: managed languages, ASP.NET 4, data platform (ADO.NET and “Velocity”), WCF, WF, and Parallel Computing.

I hope you all enjoy the Visual Studio 2010 Training Course on Channel 9!

(image)



Visual Studio 2010 Beta 2 Training Kit Published

Tue, 20 Oct 2009 17:54:02 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/10/20/visual-studio-2010-beta-2-training-kit-published.aspxThe Beta 2 version of DPE’s Visual Studio 2010 Training Kit is now live (you can find it at http://tinyurl.com/Beta2Training). A training kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize a variety of Visual Studio 2010 and .NET Framework 4 technologies. The Beta 2 release of the Training Kit contains 15 presentations, 19 hands-on labs, and 13 demos. Many technologies are covered in this release, including: C# 4, VB 10, F#, Parallel Extensions, Windows Communication Foundation, Windows Workflow, Windows Presentation Foundation, ASP.NET 4, Entity Framework, ADO.NET Data Services, Managed Extensibility Framework, and Visual Studio Ultimate. There’s a lot of content covered here. See for yourself: Presentations What’s New in .NET Framework 4 What’s New in Visual Studio 2010 Introduction to ASP.NET MVC Introduction to Managed Extensibility Framework Introduction to .NET RIA Services Introduction to “Velocity” Parallel Computing for Managed Developers Web Deployment with Visual Studio 2010 What’s New in ASP.NET AJAX 4 What’s New in ASP.NET Web Forms 4 What’s New in C# and VB What’s New in ADO.NET Data Services What’s New in Entity Framework 4 What’s New in Windows Presentation Foundation 4 What’s New in Windows Workflow 4 Hands-On Labs Introduction to ADO.NET Data Services Exercise 1: Creating and Consuming ADO.NET Data Services Exercise 2: Consuming ADO.NET Data Services using ASP.NET AJAX Exercise 3: Extending Data Services with Service Operations and Interceptors Exercise 4: Adding Client-Side Paging with Row Count ASP.NET AJAX 4 Exercise 1: Leveraging a Client-Side Template Exercise 2: Using the DataView Control Exercise 3: Creating Custom Markup Extensions Exercise 4: Declaratively Instantiating Behaviors Creating Plan My Night – ASP.NET MVC Application Exercise 1: Creating an ASP.NET MVC Application, Plan My Night Exercise 2: Creating Entity Framework Data Model Exercise 3: Adding AJAX For Searching Activities Enhancing Plan My Night – ASP.NET MVC Application Exercise 1: Adding Caching using “Velocity” Exercise 2: Structuring an Application using MVC Areas Introduction to ASP.NET Web Forms 4 Exercise 1: Controlling Server Control ClientIds Exercise 2: Enabling Bi-Directional Routing Support Exercise 3: Granular ViewState Microsoft Office Programmability in C# and Visual Basic Introduction to F# Exercise 1: Types in F# Exercise 2: Using the Let keyword Exercise 3: Functions Exercise 4: Lists Exercise 5: Pattern Matching and Recursion Exercise 6: Types and Discriminated Unions Introduction to the Managed Extensibility Framework Exercise 1: Using MEF To Dynamically Add Modules to an Application Exercise 2: Dynamically extending a form Introduction to “Velocity” Exercise 1: Setting up and running “Velocity” Exercise 2: Programming directly against “Velocity” as a generic object cache Exercise 3: Using Velocity’s SessionState provider with ASP.NET Exercise 4 (Optional): Configure “Velocity” Cache in a cluster Introduction to Workflow 4 Exercise 1: Hello Workflow Exercise 2: Refactoring Workflows Exercise 3: The CodeActivity Exercise 4: Dynamic Workflows with XAML Exercise 5: Testing Workflows Exercise 6: WorkflowApplication Exercise 7: Adding If/Else Logic Exercise 8: Error Handling Exercise 9: Activity Designers Exercise 10: Hosted Designer Introduction to Parallel Extensions Exercise 1: Parallelize existing algorithm using static Parallel helper class Exercise 2: Create and run parallelized [...]



10-4 Episode 26: Creating Extensible Apps with MEF

Tue, 14 Jul 2009 04:17:58 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/07/13/10-4-episode-26-creating-extensible-apps-with-mef.aspx

In this episode of 10-4, we take a look at a new library in .NET Framework 4 and how it helps developers write applications that are more extensible and easier to maintain than before.

For more information on the Managed Extensibility Framework, make sure to check out its home on Codeplex: http://www.codeplex.com/mef.

For more 10-4 episodes, be sure to visit:
http://channel9.msdn.com/shows/10-4

10-4! Over and out!

(image)



Parallel Computing with Visual Studio 2010 Beta 1

Wed, 10 Jun 2009 06:44:34 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/06/09/parallel-computing-with-visual-studio-2010-beta-1.aspxOne of the big areas of improvements coming to Visual Studio 2010 and .NET Framework 4 is in the area parallel computing. There are a LOT of new features and improvements to existing features here with this latest release of our developer tools. Many people smarter and more capable than I have already written about most of this stuff, so there’s not much for me to add. What I did want to do though is to let you know all the places where you can find this wealth of information (and there is a lot of it). So, without further ado, here is a list of content for you if you are interested in Parallel Computing with Visual Studio 2010 and .NET Framework 4 Beta 1.   MSDN Managed - Parallel Programming in the .NET Framework Native – Concurrency Runtime Walkthrough – Debugging a Parallel Application What’s New… What’s New in Beta 1 for Parallel LINQ (PLINQ) What’s New in Beta 1 for the Task Parallel Library (part 1/3) What’s New in Beta 1 for the Task Parallel Library (part 2/3) What’s New in Beta 1 for the Task Parallel Library (part 3/3) What’s New in Beta 1 for the Coordination Data Structures CLR 4 ThreadPool Improvements (part 1) .NET Framework 4 Cancellation Framework Parallel Tasks – New Visual Studio 2010 Debugger Window Parallel Stacks – Another New Visual Studio 2010 Debugger Window Parallel Stacks – Tasks View Parallel Stacks – Method View Diving Deeper Mechanisms for Creating Tasks The Nature of TaskCompletionSource Tasks and Unhandled Exceptions Tasks and the APM Pattern Exiting from Parallel Loops Early Achieving Speedups with Small Parallel Loop Bodies Partitioning in PLINQ Channel 9 Videos Erika Parsons and Eric Eilebrecht : CLR 4 - Inside the Thread Pool More Oldie-But-Goodie Channel 9 Videos Concurrency and Parallelism: Native and Managed Perspectives Joe Duffy: Perspectives on Concurrent Programming and Parallelism 10-4 Episode 6: Parallel Extensions Misc… Known Issues in Parallel Extensions to .NET Framework 4 Beta 1 Samples for Parallel Programming with the .NET Framework 4 Enjoy! There’s a lot here to digest. We definitely live in exciting times :). Do you know of some links that you like that I missed here? Feel free to let me know by adding a comment here. [...]



F# Basics – Infix Operators

Sat, 18 Apr 2009 10:03:33 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/04/17/f-basics-ndash-infix-operators.aspx

As I’ve been writing more F# code and learning more about the F# language, I have found myself intrigued by how some surprisingly simple language features can combine with each other to enable us to write very expressive code. While I am still learning F# (and realize just how much more I have to learn), I’m hoping that sharing some of these thoughts will encourage others to dig into what I think is a very powerful language that a lot of us developers can learn from.

In this post, we’re going to talk about Infix Operators. Before we dive into F#’s implementation of infix operators though, let’s discuss what an “Infix” Operator actually is.

So what is an “Infix” operator? An infix operator is an operator that is expressed using a mathematical notation called infix notation. When it comes to these types of mathematical notations, there are three primary kinds: Prefix Notation, Infix Notation, and Postfix Notation.

Take for example the addition operator. The addition operator takes two operands that are then added together. Using infix notation, the operator is written between the two operands it operates upon. Prefix notation would have the operator before the operands, and postfix notation has the operator after the operands. So given the addition operator, the different notations would like the following:

  • Prefix notation: + 3 4 (definitely familiar to LISP-heads –> “(+ 3 4)”)
  • Infix notation: 3 + 4 (familiar to most of us developers)
  • Postfix notation: 3 4 + (an interest way used by Forth for one, a stack-as-first-class-citizen language –> “3 4 ADD”)

One of the things I love about F# is that infix operators are normal functions that you can easily define yourself. Let’s explore this concept a bit. Open up F# Interactive and execute the following command:

> (+);;
val it : (int -> int -> int) =

Note: Surrounding the infix operator with “()” allows us to get at the underlying function that implements the infix operator, rather than the operator itself.

Heck, we can even call it like a normal function:

> (+) 3 4;;
val it : int = 7

You can see here that the addition operator is simply a function that accepts two integers and returns an integer (well, this isn’t technically true, but you can think about it this way for now; we’ll get into the difference in a different post). I said before we can easily define our own infix operator. How do we do that? Well, just for giggles, let’s go ahead and define our own add operator:

> let (|+) x y = x + y;;
val (|+) : int -> int -> int

After we define this function, we can use our new infix operator just like any of the other built-in infix operator:

> 3 |+ 4;;
val it : int = 7

Yes, it’s that simple.

Well, that’s a very quick look at a seemingly simple language feature that a lot of us developers tend to take for granted. In future posts, we’ll see how combining infix operators with other features in F# allows us to write more expressive F# code.

(image)



An Intro to Barrier, cont.d

Tue, 24 Feb 2009 22:42:04 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/02/24/an-intro-to-barrier-cont.d.aspxWell, I said I was going to be moving on to CountdownEvent, but I was wrong. there is one more aspect of using Barrier that I just had to share (thanks go to Stephen Toub on the Parallel Computing Platform team for bringing this up). In my first Barrier post, I had mentioned: Barrier is a great new synchronization primitive to use when there is a known amount of work to do that is being done by different workers that all have common synchronization points. To make a long story short, this isn’t strictly true. Barrier can be used just fine when there is an unknown amount of work. The distinction between Barrier and other synchronization primitives isn’t about “known amount versus unknown amount of work”, it’s more about “usable once versus usable many times.” To explain this in more detail, let’s look back at the example from the last post (a Road Trip to Seattle). Multiple Usages First, it is perfectly allowed to use a Barrier more than once. Using the Road Trip metaphor, instead of going straight to Seattle after leaving the Gas Station, let’s have everybody stop for lunch on there way. So now there are two “sync points” that we have. First, we’ll wait for everybody to meet up at the gas station, then we’ll also wait for everybody to meet up for lunch after they’ve left the gas station. Revising our DriveToSeattle method from the last post, we will simply call SignalAndWait() a second time to provide a second sync point where everybody meets for lunch: static void DriveToSeattle(string name, TimeSpan timeDelay) { // Perform some work Console.WriteLine("[{0}] Leaving House", name); Thread.Sleep(timeDelay); Console.WriteLine("[{0}] Arrived at Gas Station", name); // Need to wait for others sync.SignalAndWait(); // Perform some work Console.WriteLine("[{0}] Leaving for Seattle", name); Thread.Sleep(timeDelay); Console.WriteLine("[{0}] Meet for lunch", name); // Need to wait for others sync.SignalAndWait(); Console.WriteLine("[{0}] Leaving for Seattle", name); } In real-word usage of the Barrier primitive, this doesn’t have to be limited to two uses of the Barrier. We can use the Barrier any number of times we need to in order to provide these common synchronization points for our parallel code. Unknown Number of Workers I mentioned that it wasn’t strictly true that Barrier is great for a just a known amount of work. That’s because Barrier provides the functionality you need to even use it when the number of workers performing our work is unknown. Back to our Road Trip. Dennis’s sister Dee is planning to come along on the Road Trip as well. However, she forgets to set her alarm and wakes up late. And unfortunately, Charlie, Mac, and Dennis have already left for Seattle. She still wants to go though so she plans to meet up with them for lunch. What we need is for a way for Dee to flag “Hey guys! I’m coming!” And it just so happens that the Barrier class provides an AddParticipant method that we can use to make sure the extra “worker” (Dee in this case) is included the next time everybody waits for each other to “complete their work.” In this case, Dee would simply “add herself” to the Barrier when her thread is spun up. To do this, let’s create a new DriveStraightToLunch method that will be used instead of the existing DriveToSeattle method we created before. static void DriveStraightToLunch(string name, TimeSpan timeDelay) { // "I'm coming along guys" sync.AddParticipant(); // Meet for lunch Console.WriteLine("[{0}] Leaving for Seattle", name); Thread.Sleep(timeDelay); Console.WriteLine("[{0}] Meeting for lunch", name); // Need to wait for others sync.SignalAndWait(); Console.WriteLine[...]



Tour de BCL 4.0

Tue, 10 Feb 2009 11:40:34 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/02/09/tour-de-bcl.aspx

Over the coming months, I would like to take you on a whirlwind tour of a bunch of the new data structures and APIs being added to the Base Class Libraries (BCL) for .NET Framework 4.0. This will take us everywhere from new multithreading-oriented data structures like Barrier and CountdownEvent, to more basic structures like Tuple.

I’ll update this post with correct links as new posts are created…

Enjoy!

(image)



An Intro to Barrier

Tue, 10 Feb 2009 11:17:39 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/02/09/an-intro-to-barrier.aspxIn this first stage of our Tour de BCL, we will be passing through the new Barrier class. So what is a Barrier? Let’s take a look at the boring technical description for a Barrier: A Barrier is a synchronization primitive that enforces the stopping of execution between a number of threads or processes at a given point and prevents further execution until all threads or processors have reached the given point. I don’t know about you, but sometimes technical descriptions like the above just sound like “blah, blah, blah” to me. What does a Barrier really mean to me, as a developer. Let’s break it down a different way by looking at a specific real-life scenario. Think of a Road Trip Instead of looking at the technical description above, think of the concept of a road trip. There are three friends, Mac, Charlie, and Dennis. They live in a small town south of Seattle but want to take a road trip up to Seattle. So Mac calls up Charlie and Dennis and says “Hey guys, let’s take a road trip to Seattle. Meet up at the local gas station and then we’ll all leave from there.” So now they all now they need to go to the local gas station, wait for all of them to show up, and then they’ll leave for Seattle together and follow each other there. Relating this scenario to some code, let’s say that Charlie, Mac, and Dennis are all individual threads that have one method of execution, the DriveToSeattle() method. Within that method, they are all going “to drive” to the same gas station and then continue to drive to Seattle. If we don’t use the Barrier to synchronize the work (aka wait for each other to arrive at the gas station), each one of them will leave for Seattle the second they arrive at the gas station: static void Main(string[] args) { var charlie = new Thread(() => { DriveToSeattle("Charlie", TimeSpan.FromSeconds(1)) }); charlie.Start(); var mac = new Thread(() => { DriveToSeattle("Mac", TimeSpan.FromSeconds(2)) }); mac.Start(); var dennis = new Thread(() => { DriveToSeattle("Dennis", TimeSpan.FromSeconds(3)) }); dennis.Start(); charlie.Join(); mac.Join(); dennis.Join(); Console.ReadKey(); } static void DriveToSeattle(string name, TimeSpan timeToGasStation) { // Drive to gas station Console.WriteLine("[{0}] Leaving House", name); Thread.Sleep(timeToGasStation); Console.WriteLine("[{0}] Arrived at Gas Station", name); // Need to sync here // Perform some more work Console.WriteLine("[{0}] Leaving for Seattle", name); } Well, that’s hardly a road trip. If I were in Mac’s or Charlie’s shoes when Dennis left for Seattle without me, I know I would be a little upset. We obviously don’t want that to happen. So we can use the new Barrier to make sure they all “wait up” for each other at the gas station. Using the new Barrier class So how do you use the new Barrier class? It’s actually quite simple.The cool thing is that there are really only three things you need to learn to use the Barrier for this simple type of scenario: a single constructor and two method calls (both of which take zero parameters). Yes, it’s that simple to use. Let’s look at what our new code using Barrier looks like (the three bold lines are the new ones): static Barrier sync; static void Main(string[] args) { sync = new Barrier(participantCount:3); var charlie = new Thread(() => { DriveToSeattle("Charlie", TimeSpan.FromSeconds(1)) }); charlie.Start(); var mac = new Thread(() => { DriveToSeattle("Mac", TimeSpan.FromSeconds(2)) }); mac.Start(); var dennis = new Thread(() => { DriveToSeattle("Den[...]



A work in progress

Mon, 05 Jan 2009 04:06:51 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2009/01/04/a-work-in-progress.aspx

Here's a sneak peek at a project/library I'm currently working on:

include Microsoft::Xna::Framework
include Microsoft::Xna::Framework::Graphics
include RubyXna

class FluxxGame < RubyXnaGame
    def initialize
        self.background_color = Color.black
    end

    def load(loader)
        @font = loader.load_font("Title")
    end

    def render(renderer)
        renderer.draw_text(@font, "Fluxx, v0.1", Vector2.zero, Color.white)
    end
end

The combination of IronRuby and XNA Game Studio is proving to be pretty darn fun!

(image)



10-4 Episode 2: Welcome to Visual Studio 2010

Thu, 25 Dec 2008 02:34:20 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/12/24/10-4-episode-2-welcome-to-visual-studio-2010.aspx

Happy Holidays, everybody! First of all, thanks to everybody who helped get the word out on the launch of this new show on Channel 9 by blogging, tweeting, or spreading the word using other ways. There is no doubt in our minds that the launch of this new show wouldn’t have been nearly as successful without all of you!

In this second episode of 10-4, we’ll take a very high-level look at Visual Studio 2010. We’ll discuss what types of features you can expect to see in Visual Studio 2010 and .NET Framework 4.0 depending on what type of developer you are. And lastly we’ll go ahead and dive into a revised area of Visual Studio: the Start Page. The Start Page in Visual Studio 2010 has been revised to be XAML-based and allows full customization.

In future episodes we’ll dive more deeply into the technical underpinnings of Visual Studio 2010 and the .NET Framework 4.0, but for this second episode we want to make sure everybody gains an understanding of what different areas are being focused in Visual Studio 2010. While an overview is given, there is only so much time and so many features we can talk about. So if you don't see something mentioned, don't worry as we have a lot more information to dive into in the coming weeks and months.

For more 10-4 episodes, be sure to visit:
http://channel9.msdn.com/Shows/10-4/

Over and out!

(image)



On the potential abuse of the var keyword

Mon, 15 Dec 2008 00:56:05 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/12/14/on-the-potential-abuse-of-the-var-keyword.aspx

This question/conversation has come up quite often when chatting with friends and other developers. With the introduction of the "var" keyword in C# now, when should it be used (and, perhaps more importantly, when should it not be used). Here is a quick summary on my thoughts...

My personal feeling is that it's a problem if I have to rely on Intellisense in order to be able to tell what type a variable is when it is declared. It's important to keep the future audience in mind while you are writing code (this could be future developers needing to maintain your code, or even yourself years down the road). After all, writing code is the easy part. Reading it (and hence, reverse engineering it to a degree) is the hard part.

So, when you write code that requires another developer to use Intellisense (or go poking around other pieces of code that may be contextual irrelevant) to understand a piece of code, I would contend that you are not writing good code.

This brings us to the var keyword. Good usage? Using it to automatically infer variable types on declaration/instantiation lines of code:

var people = new List();
var lookup = new Dictionary<string, SomeType>();

However, I really don't like when developers use the var keyword on a variable declaration based on the return of a method call. Without Intellisense, how am I supposed to be able to tell what type the variable is?

// This is *bad*, don't do this
var local = SomeMethod(...);

How about loop variables? My personal take (though I could go either way) is to not use the var keyword on loops:

// I prefer this
for (int i = 0; i < 10; i++)
{
...
}

// over this
for (var i = 0; i < 10; i++)
{
...
}

In general, I think it is important not to be a lazy coder and do something just because it makes it easier on you at the time. As a developer, you need to think about those that will come after you and maintain your code. Don't make it any harder on them than it needs to be. Their jobs are already hard enough.

What are your thoughts? Where do you use the var keyword? Where do you NOT use the var keyword?

(image)



Steven Sinofsky, Senior VP of Windows, in Open Space

Tue, 28 Oct 2008 13:38:23 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/10/28/steven-sinofsky-senior-vp-of-windows-in-open-space.aspx

Great news everybody! I just got word that Day 2 of the PDC (that's Tuesday), at 12:45pm, Steven Sinofsky will be giving a 30 minute Open Space session on "Windows 7 Keynote Discussion."

Yes, that's correct. The Senior Vice President of Windows and Windows Live will be in Open Space at 12:45pm to discuss with you, our customers, what you think about the announcements made in Tuesday morning's keynote on Windows 7.

So if you want to get the ear of the man in charge of Windows (who only answers to Steve Ballmer himself), make sure to drop by Open Space Tuesday afternoon at 12:45pm to partake in what is sure to be a great discussion!

(image)



SmallBasic is here!

Fri, 24 Oct 2008 11:26:42 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/10/23/smallbasic-is-here.aspx

I'm VERY excited to finally talk about this publicly. A while ago, I was able to start playing around with a programming language called SmallBasic being developed internally at Microsoft by Vijaye Raji. And now, it's finally been announced as part of our new Dev Labs effort.

So what is SmallBasic? From the website:

"Small Basic is a project that's aimed at bringing "fun" back to programming. By providing a small and easy to learn programming language in a friendly and inviting development environment, Small Basic makes programming a breeze. Ideal for kids and adults alike, Small Basic helps beginners take the first step into the wonderful world of programming."

Why develop SmallBasic? Well, I can tell you the reason that I'm excited about it. I personally feel that in the absence of QBASIC, GWBASIC, etc., there is no longer a programming language that is easy for non-programmers to get hooked with. All our modern .NET languages currently are more "professional" languages. But what is out there for 6-10 year olds (for example) to play around with easily in order to "get the bug" of programming. Nothing from Microsoft, if you ask me.

 

This is why I'm so ecstatic that SmallBasic is finally available publically (keep in mind, it's not an official product, simply DevLabs bits that you can play around with). So, even if you are a professional programmer, feel free to go over, download it, and play around for a bit.

One of my favorite things? For one, the editor. It's a pretty clever take on Intellisense and the editor is a great example of a "friendly" IDE.

Enjoy!

(image)



PDC 2008 - Open Space Details

Thu, 16 Oct 2008 18:57:56 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/10/16/pdc-2008---open-space-details.aspxI've announced previously about the inclusion of Open Space at PDC 2008 this year. I'm here to let you know some of the details of how Open Space will work at PDC and how anybody at PDC can participate. Believe it or not, Open Space is going to be open anytime there are sessions going on at PDC. The first thing you need to know about is how you can participate in the conversation and perhaps even suggest a conversation that you wish to moderate (or just wish to discuss). A description of the process straight from Wikipedia: At the beginning of an Open Space the participants sit in a circle, or in concentric circles for large groups (300 to 2000 people). The facilitator will greet the people and briefly re-state the theme of their gathering, without giving a lengthy speech. Then someone will invite all participants to identify any issue or opportunity related to the theme. Participants willing to raise a topic will come to the centre of the circle and announce it to the group.   Someone writes the topics on sheets of papers which get posted on a wall, creating an agenda. No participant must suggest issues, but anyone may do so. However, if someone posts a topic, the system expects that the person has a real passion for the issue and can lead the discussion on it. No limit exists on the number of issues that the meeting can post.   When someone determines that the posting of all issues has finished, the meeting sets times and places for the individual sessions; and participants sign up for those individual sessions. Sessions typically last for 1.5 hours. The opening session lasts about an hour, even with a very large group.   After the opening session, the individual groups go to work. The attendees organize each session; people may freely decide which session they want to attend, and may switch to another one at any time. Online networking can occur both before and following the actual face-to-face meetings so discussions can continue seamlessly. So, how is this going to work while PDC sessions are going on? Here's what the Open Space schedule looks like: Monday 11:00am-12:45pm - Opening Circle - Agenda Creation 12:45pm-6:30pm - Open Space sessions (aligned with conference session schedule) Tuesday 12:30pm-1:45pm - Opening Circle - Agenda Creation 1:45pm-6:00pm - Open Space sessions (aligned with conference session schedule) Wednesday 10:00am-10:30am - Opening Circle - Agenda Creation 10:30am-5:00pm - Open Space sessions (aligned with conference session schedule) Thursday 9:30am-10:15am - Opening Circle - Agenda Creation 10:15am-1:45pm - Open Space sessions (aligned with conference session schedule) 1:45pm-3:00pm - Closing Circle So if you are going to be in attendance at PDC 2008, feel free to drop by an participate in Open Space. And if you participate during the week, we highly encourage you to attend the Closing Circle to help close the (Open Space) loop! We look forward to seeing you there! [...]



Threading Basics: Race Conditions, Part 1

Fri, 19 Sep 2008 08:13:42 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/09/18/threading-basics-race-conditions-part-1.aspxI've talked in the past about the importance of parallel computing for all us developers. It's a trend in computer software and hardware architecture that is not a fad. Currently, in the US, it is nearly impossible to buy a new computer that has only a single core. We're even starting to see some of the first quad-core laptops hit the market. It's becoming very important for developers to start dealing with parallel code. There's one problem: multithreaded development is hard. And in the class of Threading 101, Race Conditions is one of the first chapters you have to deal with. So what is a Race Condition? According to Wikipedia, the source for all information on the Internet (emphasis mine): "A race condition, or race hazard, is a flaw in a system or process whereby the output and/or result of the process is unexpectedly and critically dependent on the sequence or timing of other events. The term originates with the idea of two signals racing each other to influence the output first." That's nice and all, but what does this mean to us developers? Let's look at a simple example. I have a Logger where I want to keep track of the number of messages that are logged. 1: class Logger 2: { 3: public static int TotalMessages = 0; 4:  5: public void Log(string message) 6: { 7: // Do something with message 8: TotalMessages++; 9: } 10: } Now let's call this method a bunch of times from four different threads and capture the total number of times Log message was called: 1: int messagesPerTask = 200000; 2: int unitsOfWork = 4; 3:  4: var logger = new Logger(); 5: Parallel.For(0, unitsOfWork, (taskNumber) => 6: { 7: for (int i = 0; i < messagesPerTask; i++) 8: { 9: logger.Log("Message " + i.ToString()); 10: } 11: }); 12:  13: Console.WriteLine("{0} Expected", messagesPerTask * unitsOfWork); 14: Console.WriteLine("{0} Actual", Logger.TotalMessages); What do you expect the output to be? The obvious answer is "well, we are adding 200000 messages on four different threads, so it's obviously 800000". Unfortunately, the obvious answer also happens to be the wrong answer. What's the right answer? It depends, and it can change every single time you run the application. For example, this were the results from the first time I ran the code: 800000 Expected680354 Actual Wait... how is this possible? Did we lose updates? Did I not call the method enough times? This surely must be a horrendous bug in the .NET Framework! Damn Bill and his blasted company. Trust me, it's not a bug. There's a good explanation of this behavior. If you haven't written a lot of multithreaded code yet, the problem with the above code may not be obvious. Truth be told, there really isn't a problem with the code... IF you are only running the code on a single thread ever. But the likelihood of running on a single thread is becoming smaller and smaller. And as you can see, when we are running this in a multithreaded environment, there is most definitely a problem with the code. A lot of .NET developers look at "TotalMessages++" and interpret it as one line of code, one execution, one instruction, etc. But there's the rub, it isn't. The code "TotalMessages++" is actually four instructions when compiled down to IL. 1: L_0001: ldsfld int32 CSharpSandbox.Logger::TotalMessages 2: L_0006: ldc.i4.1 3: L_0007: add 4: L_0008: stsfld int32 CSharpSandbox.Logger::TotalMessages These four lines essentially say the following: Get the current v[...]



Great posts on F# and the power of Function Composition

Wed, 30 Jul 2008 17:15:05 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/07/30/great-posts-on-f-and-the-power-of-function-composition.aspx

If you want to see real F# programming showing off the power of function composition, I found some great blog posts earlier tonight. They are actually by Dustin Campbell on his blog: http://diditwith.net/CategoryView,category,Project%2BEuler.aspx.

 

I think these posts are some of the best F# posts I have seen out there so far. I love them because they show off the real beauty and power of F#, and don't do the whole “here’s how F# can behave like other languages” treatment that I’ve seen in so many other places.

 

Those posts (and any other F# posts on Dustin’s blog) are a MUST READ if you are at all interested in F# or functional programming.

(image)



Building A Fluent Interface for MEF

Sat, 05 Jul 2008 09:59:01 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/07/04/building-a-fluent-interface-for-mef.aspxHow would you like to use the following way to configure dependencies in MEF? A fluent interface with POCO support (no attributes necessary)? Yup. var resolver = new FluentResolver(); resolver.Register(). And().As(). And().As(); var domain = new CompositionContainer(resolver); // HelloWorld has dependencies on IGreeting and IOutputter var helloWorld = domain.Resolve(); helloWorld.SaySomething(); Lately I've been digging more and more into the first CTP of the Managed Extensibility Framework (MEF) coming out of Krzysztof Cwalina's team here at Microsoft. By default, a developer needs to sprinkle Export and Import attributes in their classes at the point they are needing something to be injected, or on classes that need to be exported in order to be injected into other classes. However, if you don't like this behavior, MEF provides several extension points you can use to provide a different interface into MEF. In my "ideal" Dependency Injection interface for MEF, there are several requirements that I would like: No Export/Import attributes necessary; hence, support for POCOs (Plain Ol' CLR Objects) Registration of types with container, not registration of object instances (where I would have to create the object myself before adding it's type to the container). Simply ask container to resolve a type into an instance for me. Other than the container and resolver, none of my "domain objects" should be "new"-ed up by me. No need to tell the CompositionContainer to Bind(). It should know about all the types necessary. For "ease of use", I want to configure dependencies via a Fluent Interface. I'm on a little bit of a Fluent Interface kick right now. I admit it. My name is Jason Olson and I'm a Fluent Interface junkie. If I could type emails via a Fluent Interface in code (rather than Outlook), I probably would. My addiction is just... that... bad. Before we dig into how we will leverage MEF's extension points, let's just take a quick peek at the classes we are wanting to wire up via the interface shown above: class HelloWorld { public IGreeting Greeting { get; set; } public IOutputter Outputter { get; set; } public void SaySomething() { // Our dependencies above determine where the output // is written to, and what the greeting will be. Outputter.WriteLine(Greeting.Greet()); } } interface IGreeting { string Greet(); } class HelloGreeting : IGreeting { public string Greet() { return "Hello Fluent Interface!"; } } interface IOutputter { void WriteLine(string message); } class ConsoleOutputter : IOutputter { public void WriteLine(string message) { Console.WriteLine(message); } } So how do we enable this new behavior? There are two primary MEF extension points we will use, a custom ComponentBinder and a custom ValueResolver. According to the CTP documentation (emphasis mine): "The role of the ComponentBinder is to create a collection of primitives associated with its component. There is only one ComponentBinder per component. The CompositionContainer will use the collection of binders during the bind operati[...]



True CCR Concurrency - Using CCR without Iterators

Sat, 21 Jun 2008 19:22:40 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/21/true-ccr-concurrency---using-ccr-without-iterators.aspxAs developers get up to speed with the CCR, they quickly come across the (ab)use of iterators to achieve "concurrency." Okay, "(ab)use" may have been a bit of a low-blow. I call it an abuse as it is a totally unorthodox use of what iterators are usually used for, and I've came across my fair share of developers who find this unorthodox usage highly confusing. Not only is it confusing, but it's not what I would consider true concurrent code. In a concurrent environment, if I create twenty different tasks that need to be executed, I expect several of those tasks to be executed at the exact same time (depending on the number of processors I have on my system). As a side effect of this concurrent execution of tasks, the order in which those tasks are executed is not guaranteed. If you don't have several tasks executing concurrently, and order of processing is indeed guaranteed, that's about as close you can get to being normal sequential code. Look at this sample (example 18) from MSDN. If you execute and step through this code, you will find that the method actually executes sequentially. The code posts a number, processes the number, posts another number, processes that number, etc. This is highly sequential. One could argue this is simply not the best sample for CCR iterators. However, after using CCR when developing robots using Robotics Studio, you will find that this "sequential but not" pattern is a very frequent pattern that is used when using CCR iterators. There's also the impact of having a method that essentially never exits due to the "while (true)" nature of the iterator-based method that is determining what tasks need to execute (leading to a highly coupled, monolithic application). This doesn't mean that the CCR itself isn't useful though. You just need to know how to leverage the framework while avoiding some of these "rough spots". So let's take a look at an example of how to use CCR to achieve "true" concurrency with the CCR without the use of iterators (for you VB fans, the great part of this approach is that it is entirely possible with VB like I show here). Dim myPort As New Port(Of Integer) At the heart of the message-based infrastructure in the CCR is a Port. A Port is where messages are posted to, and pulled from when tasks are actually executed. As seen above, Ports are strongly typed through the use of generics, and so they support posting/pulling of largely any POCO (Plain Ole CLR Object) you wish. In the case of this very simple demo we just use integers, but in a real system this might be self-defined types like StockQuoteRequestMessage, FoodOrderMessage, etc. Sub Main() Dim taskDispatcher As New Dispatcher(4, "Sample Dispatcher") Dim taskQueue As New DispatcherQueue("Sample Tasks", taskDispatcher) In the CCR, a DispatcherQueue contains a list of tasks to be executed, while a Dispatcher controls the execution of those tasks. Here we force our dispatcher to run four tasks concurrently even if we are on a single processor machine just so we can see the concurrency in action. Then we simply pass our dispatcher to the queue that contains the tasks that will be managed. ' Create the task that will handle our work Dim workReceiver = Arbiter.Receive(Of Integer)(True, _ myPort, _ Function(i) ProcessValue(i)) ' Register the task with the CCR task queue Arbiter.Activate(taskQu[...]



Avoiding Inheritance Dependencies Using Generics and Lambdas

Sun, 15 Jun 2008 13:18:41 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/15/avoiding-inheritance-dependencies-using-generics-and-lambdas.aspxOne realization I have come to when talking with many other developers is that there is a good number of developers that don't realize that inheritance introduces dependencies directly into your classes. Your derived class is now dependant upon the interface and behavior of your base class. Worded another way, your derived class is now strongly coupled to your base class. I've met a number of developers that are very passionate about managing their dependencies via inversion of control, dependency injection, etc. and yet they implement solutions that have a class hierarchy 5+ layers deep. This strong coupling can become problematic if you need to change either the interface or behavior of my base class. For instance, if I need to add another abstract method I didn't originally think of, every single class that derives from that base class now must change in order to implement that behavior. Or, if I change the behavior of one of the methods in my base class, I can find myself in a situation where one of my derived classes will break because they were relying on that base class behavior to act a given way (even more confusing when the change doesn't impact any other of the derived classes). Over-using (read: abusing) inheritance in your code can very easily lead to brittle classes that prevent you from being as agile as you need to be. While it is easy for developers to look at dependencies as other external classes your class is dependant upon, you have to keep in mind that your class is also strongly dependant on its base class as well. The beautiful thing is that with some of the functionality introduced into .NET in both 2.0 and 3.5, you can avoid developing these brittle classes by using Generic programming. "Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters. This permits writing common functions or types that differ only in the set of types on which they operate when used, thus reducing duplication." I know this description can be a bit confusing at first. Let's learn about Generic programming by example. And as an example, let's take a look at possible implementations of the Command pattern. "In object-oriented programming, the Command pattern is a design pattern in which objects are used to represent actions. A command object encapsulates an action and its parameters." In these examples, we are going to look at a home automation system. Specifically, let's look at the code it takes to automate lights using the Command pattern. In order to do this, we of course need a Light that we are actually automating (automation code removed for readability purposes): class Light { public void TurnOn() { Console.WriteLine("Light Turned On"); } public void TurnOff() { Console.WriteLine("Light Turned Off"); } } So, let's dive right in. In the "typical" way of implementing the Command pattern, you have an abstract base class Command that your detailed commands inherit from, overriding a virtual method to actually execute the command (this could also be an interface ICommand as well, instead of an abstract base class). abstract class Command { public abstract void Execute(); } class LightOnCommand : Command { [...]



Lambdas - Know Your Closures

Fri, 13 Jun 2008 18:28:48 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/13/lambdas---know-your-closures.aspxIn this post I want to discuss with you the importance of realizing how lambdas work (and why you should care). Let's dive right in with some code. Given the following code snippet, what would you expect the output to be (no cheating :P)? var actions = new List(); for (int i = 0; i < 10; i++) { actions.Add(() => Console.WriteLine(i)); } foreach (var action in actions) { action(); } Would you believe me if I told you this is the output you get? 10101010101010101010 At first glance, one might expect this output: 0123456789 But all tens are output instead. Why does this happen? Let's crank open Reflector and find out why...   The first thing you'll notice is that the compiler has created a helper class to enable the closure we have. This helper class created by the compiler contains a local variable that we use to iterate over and a method that our delegate is contained within. This helper class is especially interesting because it is where the magic happens.   [CompilerGenerated] private sealed class <>c__DisplayClass2 { // Fields public int i; // Methods public void
b__0() { Console.WriteLine(this.i); } } Rather than diving into MSIL, let's look at some pseudo-code of what the compiler _actually_ executes with the original code above (based on the generated MSIL):   var actions = new List(); <>c__DisplayClass2 localFrame = new <>c__DisplayClass2(); for (localFrame.i = 0; localFrame.i < 10; localFrame.i++) { actions.Add(localFrame.
b__0); } foreach (var action in actions) { action(); }   Perhaps now you can see where the problem is. The "problem" in our original code exists because of the scope that our closures are defined. The local index from our for loop is now stored in our helper class <>c__DisplayClass2. And the code that is executed by the action is contained within the compiler generated
b__0() method now. So the Console.WriteLine() method now uses the local variable from <>c__DisplayClass2 when it is executed.   So while we are looping through building all our actions, we are also incrementing the property i in localFrame (an instance of <>c__DisplayClass2). Then at the end when we are actually executing the actions, the
b__0() is called and uses the local i property (which by this time, has already been incremented to 10 from our loop). And that's why every action we execute prints "10" instead of the 0 through 9 like we expected.   So, why do you need to know how these work? Take the following code that outputs items from an array of strings:   var actions = new List(); string[] urls = { "http://www.url.com", "http://www.someurl.com", "http://www.someotherurl.com", "http://www.yetanotherurl.com" }; for (int i = 0; i < urls.Length; i++) { actions.Add(() => Console.WriteLine(urls[i])); } foreach (var action in actions) { action(); }   This code looks pretty innocuous. Our bounds are protected, and we just index into our array to output a string. But, [...]



Open Space At PDC 2008!

Tue, 10 Jun 2008 18:49:07 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/10/open-space-at-pdc-2008.aspx

This year for PDC 2008, we have decided to learn from a successful model used by various customers (like the ALT.NET crowd) in order to help ensure that PDC 2008 is the best conference ever. Our goal with these un-sessions is to really enable attendees with common interests to have some great conversations in an efficient setting.

So what is Open Space? Taken from the description we have on the PDC website (you can also refer to the Open Space Technology entry in Wikipedia):

Open Space is a way to bring together groups of people interested in a common topic to have an interactive discussion. In an Open Space session, there may be an expert who is passionate about a topic presenting to an audience or there may be a small group of people discussing an idea.

Four principles of Open Space:

  1. Whoever comes are the right people to be there
  2. Whatever happens is the only thing that could have happened
  3. Whenever it starts is the right time
  4. When it's over, it's over

All you need to do is suggest topics onsite that you wish to discuss and participate in sessions that sound interesting to you. It’s the unconference with content by attendees, for attendees.

Not only are we doing Open Space at PDC 2008, we want to make sure it is a _real_ Open Space. None of this "Microsoft doesn't understand, they don't grok it, they entirely and utterly butchered the whole Open Space concept".

 

Not only are we passionate about this topic, we are also fans of the Open Space movement. Of course there will be modifications that will have to be made to scale this to the size of a PDC as well as the fact that this is more of a "conference within a conference", but we hope those changes will keep the essence of Open Space unchanged.

 

If you have any concerns about Open Space @ PDC 2008, you can contact me directly at jason.olsonATmicrosoftDOTcom. I would love to hear from any of you regarding this topic. Otherwise, I look forward to seeing you in L.A. participating in Open Space @ PDC 2008! FOR THE DEVELOPERS!!!!

(image)



Managed Extensibility Framework CTP Released

Thu, 05 Jun 2008 17:22:02 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/05/managed-extensibility-framework-ctp-released.aspx

What a great week to be a developer. First, the latest Parallel Extensions CTP was released to the net, and now the first Managed Extensibility Framework CTP has been released onto Code Gallery.

So what is the Managed Extensibility Framework? From the announcement:

"The Managed Extensibility Framework (MEF) provides developers with a tool to easily add extensibility to their applications and with minimal impact on existing code. The application developer can define extension points according to the functionality required of an extension, while the extension developer uses those points to interact with the application.

MEF enables this extensibility to take place without creating a hard dependency in either direction. Applications can be extended at run time without recompilation, and extensions can be used by multiple applications sharing the same extension requirements. MEF also allows an application to delay the loading of an extension while still examining its metadata, enabling efficient traversal of large catalogs of extensions."

 

To make a medium-size story even shorter, the Managed Extensibility Framework (MEF) is essentially a framework for dependency inversion/inversion of control.

If you are a CTP junkie and like to play around with all the latest bits like I do, you have some downloading to do :P. Enjoy!

(image)



Facet Mapping with LINQ, Part 2

Wed, 04 Jun 2008 09:00:19 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/03/facet-mapping-with-linq-part-2.aspxIn "Facet Mapping with LINQ, Part 1", we discussed how to add Facet Mapping to your .NET application using an attribute-based solution. This solution just doesn't leave me very excited. As we recounted, there are some problems with using an attribute-based approach: Littering domain models with presentation layer-specific attributes  Doesn't support existing POCOs (that perhaps can't change) Can't support combinations of members (without create a new method property that actually does the combining (read: ugly)). I personally only want one area of code to change if I alter my facet mapping. Having to change my POCOs when I want to change facet maps "smells" to me (and is itself a violation of the Single Responsibility Principle). Let's look at another way we can implement facet mapping in .NET via some more LINQ-goodness. In a previous post, I talked about my new-found love for Fluent Languages in .NET (ala Moq or NInject). With attributes out of the way for facet mapping, I wanted to develop a library for facet mapping that was easy to use and could be used with existing code. Here are some of the "requirements" for the new facet mapping code (read: "requirements" means arbitrary features that I think are good and that I would like to see :P): Usable with an existing set of POCOs (without having to change a single line of code in those objects) Easily support combination of properties/methods or any arbitrary code that a person would want to create a facet on Readable and easy to use (read: my own reason to try to a fluent language interface :P) Let's take a look at the proposed API (taken straight from my unit tests): // Given our list of cars List cars = new List() { new Car { Make = "Toyota", Model = "Corola", Price = 20000, Year = 2001 }, new Car { Make = "Toyota", Model = "Corola", Price = 30000, Year = 2002 } }; // Generate a facet map (list of Facets) that we can use var facets = FacetMap.Create() .AddFacetOn(c => c.Make) .AddFacetOn(c => c.Model) .GenerateFrom(cars) .ToList(); We can also define an arbitrary expression that we want to generate a facet on: var facets = FacetMap.Create() .AddFacetOn("MakeAndModel", c => c.Make + " " + c.Model) .GenerateFrom(cars) .InParallel() .ToList(); With FacetMap being a generic class, we can use it to generate facets on any existing CLR class we wish to. And with the use of lambda expressions to specify what we are creating facets on, our code can be refactored a bunch and not break our facet mapping. Implementing FacetMap isn't actually all that difficult. Since all our operations can chain be chained together with each other, all of them actually return the same interface (our IFacetMap that the FacetMap class implements). The first thing you notice is that we are creating a generic class so that our facet maps can be used with any POCO that exists out there (theoretically). And, we are hiding the constructor so that we can use a factory method (I happen to think it reads better, could just be my personal opinion though). public class FacetMap



Fluent Languages

Tue, 03 Jun 2008 11:16:28 GMT

Originally posted on: http://geekswithblogs.net/jolson/archive/2008/06/02/fluent-languages.aspxThe first time I saw some talk about this "movement", it was Martin Fowler discussing "Fluent Interfaces". An example Martin gives is the idea of time intervals. Here's how one might declare an interval today (in Java): TimePoint fiveOClock, sixOClock; ... TimeInterval meetingTime = new TimeInterval(fiveOClock, sixOClock); Here's how one might to do the same with a fluent interface (anybody who writes Ruby code should recognize this type of programming): TimeInterval meetingTime = fiveOClock.until(sixOClock); Like Jeff Atwood, I haven't exactly been a fan of fluent languages in the past (pre-LINQ). I honestly never saw the point in them (and I thought all the object syntax got in the way of what was being done). My mind has definitely changed though. As of late, you could say I'm on a bit of a "fluent languages kick." LINQ, of course, had a play in this, as did the introduction of lambda expressions. But, it was really seeing two specific libraries that started to get me excited about fluent languages: Moq and NInject. When you compare fluent languages to Regular Expressions and SQL, I can imagine how it's hard to understand the benefit. But when you have a library that reads wonderfully out loud and "fits" an existing problem in order to make it easier to understand, I think it's A Great Thing. Mocking is a topic I've been pretty passionate about in the past. Even with that passion, there was one thing I didn't like about the libraries back then: breaking changes when refactoring. A lot of mocking frameworks in the pre-.NET 2.0 days were string based. If you wanted to mock an aspect about a method, you put the name of the method in a string and pass that somewhere. Well, the second I renamed that method, BAM!, my unit test would stop passing (of course). Yes, the unit test caught it, but it was still highly annoying. Enter Moq. Moq leverages lambda expressions to be able to determine what should be mocked. I think the solution Daniel Cazzulino has used is awesome. Let's look at some Moq code to mock some code: var mock = new Mock(); // WOW! No record/reply weirdness?! :) mock.Expect(framework => framework.ShouldDownload(It.IsAny())) .Callback((Version version) => Console.WriteLine("Someone wanted version {0}!!!", version)) .Returns(true) .AtMostOnce(); I love how this reads. I think the trick behind groking fluent languages is reading them aloud. Go ahead, go back and read that out loud (just ignore the laughing coworkers, we'll get back at them later :P). Not only does this read very well, but if I refactor/rename the "ShouldDownload" method in Visual Studio, the use of that method in my mocking code will be updated as well. The other fluent language that got me excited was the work Nate Kohari is doing on NInject. Assuming you are familiar with Dependency Injection, the best way to understand NInject is to drive write into code: class Samurai { private IWeapon _weapon; [Inject] public Samurai(IWeapon weapon) { _weapon = weapon; } public void Attack(string target) { _weapon.Hit(target); } } So I have my injection point defined in my Samurai class. My Samurai is going to need an IWeapon. So how do we bind these two together with NInject? Bind().To(); Once again, [...]