November 2008 - Posts

LINQ IQueryable toolkit available on CodePlex

Matt Warren has put the IQueryable toolkit on CodePlex.  I’m excited about this for a number of reasons.

I’ve commented before about how much I’ve learned reading Matt’s posts about building an IQueryProvider. That makes LINQ much more powerful.  However, building an IQueryProvider from scratch is a difficult and lengthy task. Without any jump-start, creating an IQueryProvider is almost always more work than it’s worth. (The counter-examples are those providers for very broad use sources like SQL, XML, or Amazon).

Adding Matt’s sample code gives you the jumpstart you need to create a reasonable Query Provider. My hope is that enough people find the IQueryable toolkit useful, and it finds its way into the .NET BCL in some future version.

In the meantime, it’s a great way to get started creating your IQueryProvider.

Yet another cool use case for Live Mesh

I use Live Writer to create weblog posts.  It’s a great way to compose thoughts that might not be ready for prime time, and then post them once I’ve completed and reviewed them.

This post from On10, shows how you can use LiveMesh to sync your drafts, and recent weblog posts, using LiveMesh.

Because I often switch back and forth between two different machines, tthis is sweet.

Charlie Calvert and I on Deep Fried Bytes

Deep Fried Bytes #19 went live on Friday.

Charlie Calvert and I got cornered by Keith and Woody while at PDC for a quick chat about C# futures, our book, and other cool stuff was announced at PDC.

We had a brief discussion on C# 4.0, other language innovations, Charlie’s upcoming book, my new book, and more.

One of the other topics was Azure, and it’s roots in PLATO. That is still one of the more interesting lessons from college: collaboration as a core component in software. Props to Ray Ozzie and how far that vision has come.

Q & A on last post (Duck Typing)

My last post on duck typing generated this question:

 

I have a question regarding your recent post about Duck Typing and anonymous type scope in C# 4.0.  Does this now open up the possibility of using an anonymous type (say, the results of a LINQ query) outside the scope of the method it was created?  Something like the following using the example in your post:

 

   1: public static void PrintLabel(dynamic thing)
   2: {
   3:     Console.WriteLine("ID: {0}, Label: {1}", thing.ID, thing.Label);
   4: }
   5:  
   6: public void GetAnAnonymousType(string key)
   7: {
   8:     var item = (from application in _Repository.GetApplications()
   9:                where application.ApplicationKey == key
  10:                select new
  11:                           {
  12:                               ID = application.ApplicationId,
  13:                               Label = application.LastName
  14:                           }).SingleOrDefault();
  15:  
  16:     PrintLabel(item);
  17: }

 

Very simply, yes. This construct is a great use of dynamic types in C#. Dynamic provides a form of escape hatch into a a world where your types can be tested at runtime.

CodeMash Session List posted

Holy wah.

Dianne Marsh (who is on the speaker committee) posted the final list of the CodeMash 2009 sessions. Wow. She and Jason Gilmore did an incredible job somehow selecting 60 sessions from an incredibly rich pool of submissions.

I'm rather proud that our little company accounts for 4 of the talks. Lots of prep working coming, but it's great.

 Even more, its amazing how CodeMash hsa grown over the three years of its existence. It's been a great success, and the entire committee deserves thanks from all of us.

 

 

Duck Typing in C# 4.0

I’ve been having fun learning the new upcoming C# 4.0 features Anders described at PDC (see video here). One of the the more interesting areas is dynamic, and the ways you can use dynamic to support duck typing.

In C# 4.0, you can create methods that take parameters that are dynamic. That means those parameters are statically typed to be dynamic.

For example, this method is a simple bit of code that writes information about an object to the console:

   1: public static void PrintLabel(dynamic thing)
   2: {
   3:     Console.WriteLine("ID: {0}, Label: {1}", thing.ID, thing.Label);
   4: }

You can call it with any type that supports an ID property (or field), and a Label property (or field).

For example, you can pass anonymous types to methods that expect dynamic types:

   1: var foo = new { ID = 1, Label = "This is a string" };
   2:  
   3: PrintLabel(foo);

You can even use different anonymous types, with different static types for the ID and Label properties:

   1: var foo2 = new { ID = "1234", Label = "This is a string" };
   2:  
   3: PrintLabel(foo2);

You can even pass a type that has a user defined type for the ID or Label property.

Suppose you created this sample class:

 

   1: class Sample
   2: {
   3:     public string Name
   4:     {
   5:         get;
   6:         set;
   7:     }
   8:  
   9:     public override string ToString()
  10:     {
  11:         return "My Name is " + Name;
  12:     }
  13: }

You can create a type (anonymous type below) that uses a Sample object as the label:

   1: var foo3 = new { ID = "1234", Label = new Sample() { Name = "Bill Wagner" } };
   2:  
   3: PrintLabel(foo3);

This is a powerful new way to create algorithms that get resolved at runtime. However, it will require a bit of practice, and more testing to understand when to leverage this feature. There are performance costs for runtime dispatch. The team is doing everything they can to improve the performance, but runtime dispatch is different than static dispatch.

On the other hand, the dynamic dispatch is a powerful feature. I will continue to look for opportunities where this feature will be the right solution.

Mark Mydland (VS Test Edition Principal Group Manager) coming to AADND

 

We’ve got a great treat for Ann Arbor .NET this week.  Mark Mydland, from the Visual Studio Test edition, is coming through our region to speak at a variety of user groups.  (Thanks to Jennifer Marsman for setting this up). It promises to be a fun evening, because in addition to the talk, Mark wants to know as much as possible about issues customers have with the product. 

As always, AADND takes place on the second Wednesday of every month, at 6:00, at SRT Solutions office in downtown Ann Arbor (206 S. Fifth Ave, Suite 200).  Please stop by.

Here’s the abstract and bio:

The phrase “drive quality upstream” has been abused so badly by ALM software vendors that it has to be relegated to the platitude junk pile along with such all time favorites as “work smarter not harder,” “Think outside the box,” and “Synergistic leveraging of code reuse.”  Before we drive quality anywhere we need to give quality a seat at the table. VSTS Rosario release will do this by automatically gathering critical information about the project and code and making that data available when, where and to whom it is needed. During this discussion we will examine how Rosario impacts quality across the application lifecycle by:

•    Allowing testers to provide developers with details about what the code did instead of just providing the details about what the tester did.
•    Allowing development leads and architects to visualize and understand their current code (not the code they wish they had, but the code they really have) so that they can minimize the impact of changes; and
•    Allowing developers to understand the impact of their changes in terms of affected tests, concurrency and bounds checking. 

The Rosario release of VSTS will bring all project stakeholders together to allow richer information to be shared across every role to make software quality accessible and achievable.

Mark Mydland is the Principal Group Manager for the Visual Studio Team Edition for Software Testers product at Microsoft.  In the past 12 years, Mark has worked as a developer and consultant across a wide variety of applications and industries.  Mark first joined Microsoft in 2001 working as a member of the Natural Interactive Services Division (NISD).  During his time in that group, Mark was the development manager for a team focused on analytics for assessing the efficacy of natural language interpreters with a particular emphasis on driving authoring simplification and relevance quality for user assistance.  Based on this work, Mark filed numerous patents and coauthored a paper for the SIGIR journal.  In 2004, Mark left Microsoft to work as a Director of Development at Getty Images where he led a change in process from a traditional waterfall methodology to a scrum-based agile approach which brought the release frequency from 12-18 months down to 1 month.  Since Getty made extensive use of VSTS, it seemed a natural fit for Mark to join VSTS on his return to Microsoft in 2006.  Mark received his B.S. from West Point in 1991.  He has also held positions with USWeb/marchFirst and Andersen Consulting/Accenture.  ec

Starting a Company? We (and Microsoft BizSpark) can help

Yesterday Microsoft formally launched BizSpark, a new program that is designed to help increase the chances of success for startups in the software business.

The timing couldn’t be better for the Michigan business community. We’ve come to realize that we need a rich ecosystem of entrepreneurialism  to diversify our economy, and improve the overall business climate. The obvious risk is that a majority of startups fail. In fact, a vast majority of startups fail.

That’s where Microsoft BizSpark comes in.  Microsoft BizSpark connects startups with the resources they need to succeed: software, knowledge, and timely publicity.

I’m quite happy that we are network partners in this program. We were chosen because of our track record of success building software. We’ve built software that drove the success of startups in our area, and software that brought 10s of millions of dollars to large enterprises’ bottom line. Our commitment to Microsoft BizSpark is to help other new companies succeed with their software (or software as a service) business endeavors. We’ve been successful in the software field, and we want to help the next generation of businesses succeed as we have.

The obvious tangible benefit is that Microsoft provides free licenses for many of its developer tools and server platforms. But that’s not the key benefit. 

The most important benefit is intangible. Startups get access to network partners, who provide their expertise to your business. Having that expertise along the journey will increase your chance of success. Our role as a network partner is to work with startups and increase their chance of success.

This program is already generating some national press coverage. This article on Information Week discusses the program.  In this video, Dan’l Lewis, who heads Microsoft’s Emerging Business Team, discusses the program and who it’s designed to help.

Finally, if you’re thinking about creating a startup in our area, go to the Micorosoft BizSpark page and sign up.  We’re registered as a Network Partner, so you can work with us to go through that process. Understand it’s not simply about free software. If we work with you as a network partner, we must be committed to working together to ensure your success. We’re proud of our track record, and we want to work with startups that want to succeed as businesses.

If you’re not sure yet, keep an eye out for local and regional events. We (along with other Network Partners) will be presenting more details about the program, its benefits, and its purpose.

A question on the Kindle

Dear readers,

I noticed that More Effective C# is available on a Kindle edition.

I don’t have a kindle, and I’m curious what people think of the experience with a programming book in a Kindle edition.  (Historically, the knock against the kindle was that it was not a pleasant experience to read code examples on the kindle. 

Has that been addressed?

Is the experience good?

Thank you.

Full PDC Wrapup: The Next Big Thing

The Microsoft PDC is positioned as a forward looking conference. Roughly 75% of the content is pre-release content, and only 25% is on products and platforms that have already shipped.

On the one hand, that makes it very challenging to understand everything that’s going on. No matter who you are, there’s a bunch of stuff you’ve never seen before.

On the other hand, that’s what makes it fun and special. So now, after letting some of the cool stuff sink in, it’s time to prioritize what I’m investing my time on.

That last sentence is important: This post discusses where I’m putting my learning time. It’s not a complete list of what was discussed at PDC.

Cloud Computing, Azure, Windows Live Services

I’m lumping these together, because at the moment, they are very bundled in my mind (at least at this point in time).

We’ve already got customers looking at Amazon’s offerings. We’ve been waiting for this for too long. I like the fact that at the API level, Microsoft has abstracted away the concept of machines, CPUs, and disks (or other storage media).   With SQL Services, even the concept of the database engine is abstracted away. You write your service against an abstract set of OS services, without thinking about a particular server box.

I’ve only had the briefest of times to write my own services, but I’m currently rolling through some of the PDC talks I didn’t get to see, and learning more about how this will apply to the problems we’re trying to solve now. The beauty of Azure is that I’m thinking about services, not scale out.  It’s a different programming model, but it’s a good one to match the problems it’s designed for.

Personally, I believe Azure will be a major player.  Microsoft has the infrastructure to run a cloud computing platform. It’s got the basic API correct. And, I can see a path from code I have now to code running on Azure.

There are risks of course. Microsoft has not said anything about the SLA for Azure, or the final pricing model. Both will be important variables for many customers.

New Language Enhancements

I’m impressed with C# 4.0. The integration with dynamic objects is seamless, yet noticeable. When I look at code, I can see when the object is a dynamic object.  That’s good. And it’s also a small price to pay while coding. You can be efficient, and yet, you will show the intent of the code.

The COM interop is going to make C# much more efficient when working with legacy COM systems, like Office. I know of no one that enjoys working with MS Office in C#. That’s because the Office APIs are quite painful to use from a strongly typed language.  Bad API design examples abound.  C# 4.0 provides named and default parameters, along with PIA-free linking that will make this much easier.

I’m not spending much time on this subject, because several blog posts will show code and language features for C# 4.0 in the near future.

Surface

I’ve got a lot of geek love for surface.  I was playing with one at PDC, and I kept coming up with new ideas.  I can’t wait to have a real business case for one, so I can buy one and start building code for it.

In the meantime, I’ve downloaded the workstation SDK so I can start experimenting.  More code coming soon.

Things for Later

Of course that’s not everything.  I intend to spend some time investigating Windows 7, multi-touch, Office 14 and other announced goodness once I get my hands around the big three items I have listed first.

How about you?  What got you excited?

It's a good thing they 'do no evil', or this would bother me

"Google Abandons Standards, forks Open ID"

 Excerpt:

Basically, Google has rewritten OpenID. Not only is it not exactly the same as the current OpenID protocol, it’s so different that existing OpenID relying parties won’t be able to use it. Only a handful of “partner sites” have been updated to understand Google’s perverted version of the OpenID standard, and anyone else hoping to authenticate via “OpenID” to Google’s servers will need to do the same.

You can read the entire blog post here.

Search

Go

Blog Group Links

Nascar style badges