Home ยป code smell

code smell

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 of different responses. Everyone seems to have a basic understanding, but most don’t have any clearer idea than “it’s bad code.”

To understand what an anti-pattern is, you must first know what a pattern is.
Read More »Anti-Pattern and Code Smell Defined

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 may become a cesspool:
Read More »Object Cesspool Anti-Pattern

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 object that needs to be accessed by multiple threads, but the integrity of the application requires that there be no more than one instance. In the countless times that this problem has been solved in the past, most “good” solutions have taken a similar form… what we now call the Singleton pattern.

Read More »Code Smells and Anti-Patterns