Scott Hanselman

Reading to Be a Better Developer - The Coding4Fun DevKit

August 13, 2007 Comment on this post [5] Posted in Coding4Fun | Learning .NET | Programming
Sponsored By

Coding4Fun Logo I've written a number of articles for Coding4Fun, in fact, there's a whole category for them on my Blog here. Dan Fernandez runs Coding4Fun and there's a LOT of Coding4Fun writers, so I can't keep track of all the cool stuff that's being done on the project.

I was looking around for some really good Source Code to read. You know the whole Be a Better Developer in 6 Months thing? We did a podcast on it, and it's being discussed in the forums. One of the things that I thought was the most important was reading other people's code. I postulated that writers don't become better just be writing, but by reading.

Anyway, I stumbled on a treasure trove of source to read. Recently released, and comparatively quietly, was the Coding4Fun Developer Kit 2008 Vol 1 (BETA) (whew!) that I will refer to as the C4F DevKit because that name is crazy long.

The "Vol 1" designation is cool because it implies it'll be a series of projects. Here's the kinds of stuff it includes (very DIY (Do It Yourself) friendly):

  • Bluetooth – Serial Port, File Transfer and Object Push; plus Device Discovery and Service Discovery
  • Windows Vista Contacts – abstraction of the Windows Contacts API 
  • Messaging – Better APIs for SMTP and POP3
  • Power Management – Access Windows Vista Power Management features like rebooting, hibernating and locking a computer; get battery status on a laptop too
  • Windows Desktop Search – Easy API to Search
  • Windows Vista Picture Acquisition – Acquire pictures and videos from common devices like digital cameras
  • Preview Handler – Resolve predefined file types such as Microsoft Word , Visual Basic and Visual C# source files, images and many others in their own applications.
  • SoundRecorder - record audio sounds and play them back information with Windows Vista's API
  • RSS ScreenSaver - WPF RSS ScreenSaver 
  • P2P Picture Share - share your pictures with family and friends

C4F Toolbox There's a LOT of source here - a bunch of it I could use in some of my on-the-side projects. Some of it is "mashups," brining different APIs together in interesting way, while much of it is very clean abstractions of COM or P/Invoke APIs for useful things like Image Acquisition and Source Recording. These are the kinds of APIs that it'd be nice to see pushed back into the BCL/platform. It also serves as a good primer on how to create a managed API on top of an unmanaged one. I think I'll do some posts on it. The Preview Handler on is very nice.

The other thing that's cool about these "components" is that a bunch of them are done as controls that live in the Visual Studio 2008 toolbox (and they all work on the Express SKUs) so in many cases using them is just a drag-and-drop operation with a Smart Tag. Apparently the plan is to add as many Smart Tags as possible.

While I was able to run the installer and compile most of the code on Windows XP, many of the projects are Vista specific. I think in the future there will be an option to select the projects that are specific to your OS. If you've got Visual Studio 2008 or the C#/VB Express version, you'll be fine. The Express 2008 SKU runs very fast under my XP SP2 VM and I've been very happy with it.

I wanted to see how fast I could get something new written with some of this source, so I set off to create a vCard Preview Handler. Remember what a Preview Handler is? It's those little in-proc plugins that can be used by Outlook or the Vista Explorer to show you what a file looks like without opening the host application. Tim Heuer made a PDF Preview Handler using some code from the obscenely talented Stephen Toub (here's a list of all his articles on MSDN).

My next post will talk about writing a vCard Preview Handler using the code in the C4F DevKit. I wanted to see just how quick and easy (or totally not at all) it would be, considering all the COM Interop and what-not.

I've really enjoyed reading the code in this kit. Nothing makes me realize what a crap programmer I am like reading a good programmer's code.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service
August 13, 2007 8:07
Thanks for pointing this out. I have always heard that reading code is one of the better ways to improve your own coding skills, but finding interesting stuff to read has been tough. Some of the best stuff may solve some of the most boring problems, so it is great to see a nice collection of interesting projects that will make this fun to go through.
August 13, 2007 16:37
If you're going to read code, it helps if the code was intended to be read, just like code that was written with testability in mind is easier to test. Donald Knuth's Literate Programming (http://www.amazon.com/Literate-Programming-Center-Language-Information/dp/0937073806/) is filled with programs that were intended to be read.
August 13, 2007 22:22
Thanks. Let us know whenever you read some really good code.
August 14, 2007 22:43
Thanks for this, Scott. My own code is, of course, so fabulous that I can barely resist the urge to touch myself when reading it - I suspect that would be the problem for most of my audience, hence why it is never shared. I'm not a homewrecker, after all! These projects all sound like great things to read when time permits.
August 14, 2007 22:44
Please insert the ";)" after "never shared", before I suffer another mistake of Ayende-correction proportions. Really, I'm not a *total* egomaniac!!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.