Archives

Archives / 2003 / September
  • Enums and Lookup Tables

    Everyone knows (or would know if they'd read Code Complete) that 'magic numbers' are a bad thing in your code.  Enumerated types, or Enums in .NET, are a great way to avoid such magic numbers.  For instance, let's say I have a content management system which has articles whose state can vary between Draft, Editing, and Production.  I could simply use 1, 2, and 3 for these states and remember what each stands for, but that's going to be really hard to look at six months later when I revisit the code (or if someone else has to read it).  In languages without enumerated types, named constants would be a step in the right direction, but truly enums are much more powerful … more

  • Cache Configuration Helper Class Article Published

    In a follow-up to my caching best practices article, this one shows how to encapsulate the best practices into a helper class. Creating a Cache Configuration Object for ASP.NET Summary: Learn how the CacheConfig helper class can improve caching policies across an ASP.NET application, improve reuse of cached data, and significantly reduce lines-of-code to implement caching using best practices. This article builds upon the ASP.NET Caching: Techniques and Best Practices article. http://msdn.microsoft.com/asp.net/?pull=/library/en-us/dnaspp/html/aspnet-createcacheconfigobject.asp more

  • NUnit 2.1 Final Release Available

    From Charlie Poole on the TDD List: The final release of NUnit 2.1 is now available for download at http://nunit.sourceforge.net. This release has a number of improvements, most notably that it will run under version 1.0 of the .NET framework as installed. It includes separate configuration files for use with .NET versions 1.0 and 1.1. Both configs are copied and the correct version for the current system is installed ready for use. NUnit 2.1 can run tests built against NUnit 2.0. A sample config file for use in this situation is included. Substantial changes have been made to error and exception reporting. The exception type is listed along with all inner exceptions. In the console runner, … more