Friday, January 19, 2007

CodeMash Agenda

Well, I'm here at CodeMash and I'm loving it. There are some really cool sessions. I went to one yesterday by Owen Taylor where he described Jini and the whole "grid computing" realm. It was very interesting and he had some cool demo that showed how it all works. Today I went to Scott Gutrhie's keynote on LINQ. I didn't realize how cool linq was until I saw him getting crazy with it. He described how we are all single thread programmers by nature and that this is a problem as we move more and more away from Moore's Law. In the future, we will be dealing with more and more multi-core machines.

Here is a problem area:

  List<customer> customers = GetCustomers();
foreach(Customer cust in customers)
if(cust.Salary <= 40000)

With LINQ, all of the complexities are handled for us... No 'GetCustomers()' method to extract the values from a database or or XML file (or whetever). There is also no need to do the dreaded "for loop" with all the all the "if this, then that" crap. The complexities and tediousness is gone. Here is the new approach:

  // syntax might be wrong, but...
var customers = from c in customers
where salary >= 40000 select c;

The beauty of this is that everything is handled "under the covers" for us. For example, if you have a quad core processor, each core will be able to contribute to the results of the query, not just a single thread. Pretty cool! There is more to it than this, but this is the one thing that stuck out for me. :)

See also: Generic Query Operators for .NET 2.0

No comments: