Being a better developer by studying other peoples code

The course is wrapped up and I have 2 more entries to get out. Next week I'm at the Edmonton User Group to present about Fit and DDD so catch me there if you're in town. As the course winds down my brain is still in overdrive thinking about things, both technical and personal. I'm going to post a follow-up to the 6 months to a better developer spiel that's been going around, as I feel I didn't do the original question enough justice (that's justice, not Justice).

One thing Scott Hanselman mentioned in the his podcast on the subject was that you could get better by looking at other peoples code. I'm a strong believer of this and have about 200mb of projects squirreled away that I've collected over the years. From time to time I dump them as I realize they're junk, but some examples shine on and I just keep them around as reminders and ideas. I'm always finding little development nuggets in code that I come across (even the entire app is a gong show) and they go onto my USB drive for later reflection. When I was a graphic designer we would keep a physical file cabinet (I called mine a graveyard) where we just kept clippings. Ideas or designs or styles that we liked (or didn't like) would go here and from time to time you would peek inside. Everything was organized by subject or topic so sometimes I was doing a design that would require teddy bears and out came the teddy bear folder from the graveyard, to spark an idea. My USB drive is like that (although I'm trying to find a good way to organize it better than what folders can do).

Anyway, here's a list of projects that I've looked over and find to be valuable to check out if you're looking for coding examples, ideas, and snippets that I consider little gems in the open source world and refer to from time to time.

CruiseControl.NET

CC.NET is a great tool, but people keep forgetting it's open source and there's unit tests for everything. It's not a bad implementation and has some good ideas around separation of concern and handling providers. The code is clean and makes good use of interfaces almost everywhere.

NUnit/MbUnit

Both of these unit test frameworks are open source and their own source is a pretty good resource to check out. Good overall design and good use of various patterns like proxies, listeners, and reflection. You can imagine how hard it might be to unit test a unit test framework but these guys did it and did it right.

Time and Money

This is a utility library written in Java but it follows Eric Evan's Domain Driven Design principles and is a good reference for such. There's a C# version kicking around on SourceForge you can check out (but it's not completed yet and I can't track down a URL for it).

dasBlog/SubText

Blog engines that have evolved. As Scott points out, dasBlog is the abyss but there's some good stuff in there either he, Clemens, or the community has written. Especially check out the HTTP handlers if you've never written one before. Again, lots of unit tests here. I feel the model falls down a bit with the XML dependency and requirement for test files, but all in all they're both good resources to study.

RSS Bandit

Despite my aggregation with this project switching the UI every chance it can get and tying itself to commercial libraries, it's a pretty good example of a WinForms RSS reader. The implementation does suffer from memory bloat (running it just chews up as much memory as it can) but overall it's a good application design and there are some nice things in here like HTML parsers, interacting with RSS,  and a well designed plug-in system.

SharpDevelop

I can't this is a great example of code to learn by, but it's the only open source IDE out there that contains concepts you could follow (and for the most part, they're not that bad). You really can't crack open Eclipse and learn how it ticks but SharpDevelop is written in all C# and pretty easy to follow.

TheBeerHouse

This is an odd name for a project, but it's an excellent reference app for an eCommerce web portal system which offers a forum, CMS-like functionality, blogs, polls, RSS feeds, shopping, and other goodies. A pretty good example of a nicely done ASP.NET website that can not only be used for studying, but building your own site.

DotNetKicks

The codebase isn't too bad here (although I feel there's a little too much in the ASPX code behind) but is a good example of a digg-like community site. Lots of AJAX here with user controls so if you're looking to build the next community, give kicks a look at for ideas.

CSLA.NET

CSLA is an application framework for building business apps. Rocky Lhotka has done an excellent job with the codebase and while I'm not a fan of Active Record or domain objects that know how to persist themselves, the code is clean and a good tool to study from. Rocky keeps it updated frequently.

StoryTeller

While it's still only alpha, Jeremy Miller is doing a bang-up job on making this an indispensable tool for Fit development and using TDD to drive it out. Nice work here to take a look at even in it's young stages.

Omea Reader

Omea reader is supposed to come online with it's source code released by JetBrains. To date they haven't released it yet but plan to. I emailed them a few months ago and they were still working on getting the code ready. Hopefully with a company like JetBrains behind it, the code base will be interesting to examine.

Feel free to add your own to the list via the comments (I'm sure I missed a few key ones) and go ahead and challenge me on my findings here as I may be off on some projects, however this is my opinion and YMMV on your own findings.

3 Comments

  • I love the idea about the USB drive filled with examples of code to demonstrate different techniques. I think I might 'borrow' this to do something similar with my team.

    You mentioned trying to find a better way to organize it rather than folders. How about using tags? Instead of keeping a folders, setup a wiki on a server somewhere central to your team. This way its easily available to your team, its searchable, and you can identify everything by several unrelated tags (for example, 'HTTPHandlers' and 'Shopping Cart Business Objects') instead of trying to force everything into one single folder.

  • I have a similar folder structure thing. I also keep it synchronized with my SVN server at home. I also feel the need for more search and cross-reference capabilities that the folder structure does not allow. I've been meaning to try something like a wiki-on-a-stick but I'm not convinced yet it would be pratical with larger sample codes.

  • Yes, I agree with your opinion. I am also doing the same thing. I've been keeping other people's codes in my PC and once in a while I refer to them to give me ideas and pointers on my projects.

Comments have been disabled for this content.