Reading other people's .NET code
One thing that makes HTML easy to learn is the abundance of examples. You can go to any old website and view the source to see how it’s put together, or look through templates on a site like Open Source Web Design or Open Source Templates. It’s easy find examples of good (and bad) practice.
Scott Hanselman’s article Reading to Be a Better Developer got me wondering why we don’t do this more with .NET code, and the problem for me seems to be finding good code examples. Scott recommends looking at the Coding4Fun Developer Kit, but I wanted something more specific to web development.
So here are a few places I found ASP.NET source code that’s worth studying and learning from.
Microsoft Enterprise Library
A great place to start is the application blocks in Microsoft’s Enterprise Library. These are application service components designed to follow Microsoft best practices and include modules for caching, cryptography, data access, exception handling, logging, policy injection, security and validation.
Website Starter Kits
Another good place to look is the ASP.NET Starter Kit Websites, a collection of working ASP.NET demos that can be examined or built on. They cover DotNetNuke, e-commerce with PayPal, blogging, project time management, media library and plenty more.
Codeplex
Lastly Codeplex, Microsoft’s open source project hosting site. There’s so much goodness here it’s hard know where to start, so try browsing the most popular or active projects to start. Here are the top ten that caught my eye:
- BlogEngine.NET
Full featured blog engine targeted at .NET developers. It is light weight and very simple to modify and extend. - Umbraco
Simple, flexible and friendly ASP.NET CMS - DinnerNow
Sample marketplace application designed to demonstrate how you can develop a connected application using IIS7, ASP.NET Ajax Extensions, Linq, WCF, WF, WPF, Powershell, and the .NET Compact Framework. - Community Kit for SharePoint
Set of best practices, templates, Web Parts, tools, and source code for creating a community website based on SharePoint. - Facebook Developer Toolkit and
Facebook.NET
.NET wrappers and libraries for the Facebook API. - DbEntry.Net
Lightweight, high performance Object Relational Mapping (ORM) database access compnent for .NET 2.0. - PublicDomain
.NET packages for time zone support, logging, dynamic code evaluation, GAC API, unzipping, RSS, Atom, OPML, screen scraping, and utilities for strings, arrays and cryptography. - ASP.NET RSS Toolkit
Gives ASP.NET applications the ability to consume and publish to RSS feeds. - NGenerics
Class library providing generic data structures and algorithms not implemented in the standard .NET framework - Html Agility Pack
Agile HTML parser that builds a read/write DOM and supports plain XPath or XSLT. The parser is very tolerant with “real world” malformed HTML. The object model is very similar to System.Xml, but for HTML documents.