Chris Stuff
Categories
-
Recent Posts
Recent Comments
Archives
- February 2013
- January 2013
- December 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- December 2011
- May 2011
- March 2011
- December 2010
- August 2010
- May 2010
- March 2010
- February 2010
- January 2010
- December 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- January 2009
Category Archives: DRY
AutoMapper Tests Made Simple
I work primarily on a C# ASP.NET MVC application that deals with many other systems which seem to dish out strings all over the place. Hence the need for something like AutoMapper. When converting this data into objects or enumerations, … Continue reading
Also posted in AutoMapper, NUnit, Testing
Leave a comment
Unit Testing Simple ASP.NET MVC Controllers
I have created enough simple projects using ASP.NET MVC with unit tests to notice a very helpful pattern. The following is a sample of a test fixture using RhinoMocks and NUnit to test a controller. 1: [TestFixture] 2: public class … Continue reading
Also posted in ASP.NET MVC, Development, Moq, NUnit, RhinoMocks
6 Comments
Actually Querying with the Specification Pattern
In my previous post, I talked about using the specification pattern for querying collections. I didn’t actually show any code that does what I was talking about, I just showed the set-up and creation of specifications. The following is how … Continue reading
Also posted in Design Patterns, Moq, Testing
10 Comments
Using the Specification Pattern for Querying
The specification pattern is great for adhering to the Single Responsibility Principle (SRP). The reason it can be so powerful is that it encapsulates one piece of logic, and nothing more. I’ve decided to come up with some code that … Continue reading
Also posted in Design Patterns, Design Principles, SOLID
17 Comments
Anti-Patterns and Worst Practices – Utils Class
If you ever start typing “Utils” or “Utility” stop and think a bit; if you need some help, ask a fellow developer a question of what this code actually does. This anti-pattern is caused either by lack of domain knowledge, … Continue reading
Also posted in Best Practices, Design Principles
11 Comments
Anti-Patterns and Worst Practices – The Arrowhead Anti-Pattern
This anti-pattern is named after the shape that most code makes when you have many conditionals, switch statements, or anything that allows the flow to take several paths. You’ll commonly see these nested within each other over and over, thus … Continue reading
Also posted in Best Practices, Design Principles, Legacy Code
8 Comments
Anti-Patterns and Worst Practices – You’re Doing it Wrong!
When shown ideal code, I think developers understand why it is favorable. When it is regarding Separation of Concerns (SoC) or Single Responsibility Principle (SRP) the consensus is something along the lines of “of course, that makes sense”. But not … Continue reading
Also posted in Best Practices, Design Principles, Development, Legacy Code, SOLID, Testing
22 Comments
A Lesson in DRY Learned with jQuery
While working on a credit card entry form I decided to add a dynamic block of XHTML to highlight the credit card that is entered by the user, while graying out others. In this code, I attempt to retrieve an … Continue reading
Also posted in jQuery
5 Comments


Comments are the Devil
I recently read Chris Coyier’s article entitled Show Markup in CSS Comments. I was actually a bit angry that so many responses praised this and so few were turned off from the idea. I appreciate the idea of making things … Continue reading →