CodeShare Week (March 8-14th 2009)

Following the example of Jeff Blankenburg’s Contribupendence Day I’d like to declare next week (March 8th-14th, 2009) CodeShare Week.  “What’s this”, you may ask?  Well, it’s just like it sounds: sometime next week share some code with someone. 

“Why”, you may ask?  For the same reason that I thought the Bitslingers event was a good idea.  After several conversations at Open Spaces events and user group meetings I find that the .NET community doesn’t really share (code) well.  Maybe we are scared someone will run off and say the code was theirs, or maybe we weren’t taught to share when we were young.  Who knows.  I think we can all learn from each other’s styles and approaches.  Sharing code gives us new ideas and exposes us to new techniques.  Above all, sharing code is a way for us to learn.

So, now you might be thinking, “yeah, I buy that, but what now?”  Glad you asked.  Sometime next week I’d like you to share some code.  It doesn’t have to be a full fledged application or wizbang utility.  It can be a short PowerShell script on how to do some task, or a favorite utility method you use in every project.  It can be how you name your unit tests.  It can an interesting factoid on a .NET Framework class with a code example.  It can be in C#, Ruby, VB.Net, Pascal, Erlang, F#, Haskel, C, C++, Fortran, Perl, or Foo (okay, so there is, surprisingly, no Foo language I could find, but you get the point.  Write it in any language).  It can be anything you want as long as there is CODE.  Ideally, you’ll share it with the world via the internet in some fashion, but just showing some of your code to a coworker and walking through it is cool too.

If you don’t have a blog to share your code on then you can use several internet services that let you do this for free:

For short snippets:

For larger projects:

Your goal is to create, or use an existing, bit of code or a small project to convey some lesson, technique or just to have a usable utility method/project to be reviewed by others.  Write up the code, post it somewhere on the internet (your blog, one of the sites above, etc.) and then advertise it.  If you don’t want to create an account at any of the services above and don’t have a place to put the code, feel free to send it to me via my contact form and I’ll post it for you with all credits given. 

Now, maybe you are thinking “But my code sucks”.  I can’t say that it does, or it doesn’t.  What I can say is that posting your code will allow others to see it and provide feedback (hopefully very insightful, concise and constructive feedback).  Even if someone slams the code down, you’ve possible learned a few things (how to improve your code for one, and also who NOT to ask for advice from in the future). 

So, go forth and sling some bits.  Write code.  Post it.  Advertise it.  Share it.  Learn.

If possible, please put a comment on this post of where you placed your code snippet.  That will help provide a centralized location of where people can come to find the code snippets from the CodeShare Week.