Posts By: Patrick

Anti-Pattern and Code Smell Defined

I had pretty much assumed that nearly all software developers would know what I mean when I use the words anti-pattern and code smell. Over the last couple of months, I have come to the conclusion that this is not strictly true. What is an anti-pattern? When asking this question, I have received a number… Read more »

Object Cesspool Anti-Pattern

Object pools are a common pattern in development. The canonical example is probably a database connection pool. If objects returning to the pool are not validated, the pool can gradually fill with garbage objects, turning it into a cesspool of unusable objects. How to Identify The two easiest ways to identify if your object pool… Read more »

Heartland Developer Conference 2012

Looks like I will be attending another developer conference this year! I was just notified that I will be speaking at HDC 2012, September 5-7, 2012. I will be giving a talk on advanced JavaScript concepts and techniques. Get your tickets now!

Input Kludge Anti-Pattern

As an anti-pattern, input kludge describes a poor user interface that either rejects or incorrectly handles valid input. How to Identify The most obvious code smell that may point to this pattern is ad-hoc input validation routines. Look for: JavaScript validation function defined directly in web page or view code. Server-side validation routine defined in… Read more »

Code Smells and Anti-Patterns

What is an Anti-Pattern? If you know what a pattern is, then you probably already know about anti-patterns, even if you didn’t know it! In a nutshell, a design pattern is an observed good method to solve a re-occurring problem. You have probably observed patterns in your own development. For instance, maybe you have an… Read more »

New Home!

It didn’t take long for me to determine that I needed my own domain to host my blog. Now I have more control and autonomy. Since I build websites for a living, I thought I should give myself a more professional online home. Since my day job, family, consulting and speaking take up so much… Read more »

St. Louis Days of .NET 2012

Check it out! I will be speaking at this year’s Day of .NET conference in St. Louis! My topic is going to be centered around code anti-patterns. Why they are bad, how to identify them, and how to fix them. Here is a deep link to my session page on the conference website:¬†http://www.stlouisdayofdotnet.com/2012/sniffing-out-sucess-identifying-smells-and-anti-patterns-in-your-code If you… Read more »

Critical Blocks and Improper Lock Objects

Quick catch-up… critical application blocks are blocks of code that can only be executed by one thread at a time. Stock example for illustration: public static class SmackTracker { private static int smackCount = 0; private static object locker = new object();   public static void HitItAgain() { lock (locker) { smackCount++; } } }… Read more »

Order of Operations in nested try..catch..finally

Let’s dive in and take a look at some common and not-so-common exception handling arrangements. Everyone should be familiar with the standard try..catch..finally construct: try { //this code will run only until an exception is thrown } catch { //this code will run only IF and exception is thrown } finally { //this code will… Read more »

Exceptional Introduction

There has been a lot of discussion over the years about when and how to use exception throwing and handling. The general consensus¬†seems to shift every once in a while. The performance of exceptions is not the primary purpose of this article, but I felt the need to discuss it in order to truly address… Read more »