Christopher Alexander had a problem. Actually, all architects had a problem. There they were, being hired to design buildings, and their clients understood the buildings more than they did. The problem, essentially, was translation. How could an architect take what the client described and turn it into what the client wanted?
Simple, Alexander said. Clients want basic variations of a set of buildings. We need a language that describes basic stuff (that's a technical term) in our problem domain, building buildings, that is simple enough to be understood and used by our clients: a
pattern language. "The elements of this language are entities called [design] patterns. Each pattern describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice."
Design patterns are not one-size-fits-all, cookie-cutter solutions. Instead, they are skeletons, templates, general descriptions of how one might solve a type of problem. For example, it has been determined that people like rooms where natural light comes in from two directions. That's a design pattern. Notice that the pattern does not say, "Put one 16"x30" window on the north wall, and one 24"x30" window on the west wall." It says, "The optimal room has natural light coming in from two directions."
Alexander came up with this concept in 1977. To this day, it has had a mixed reception in architecture. In 1987, however, Kent Beck and Ward Cunningham got the idea of applying the principles of design patterns to software. The "Gang of Four" (Gamma, Helm, Johnson, and Vlissides) popularized that usage in their 1994 book,
Design Patterns: Elements of Reusable Object-Oriented Software (
Wikipedia).
Good design patterns, in computer science, are classified in four categories: creational patterns, structural patterns, behavioral patterns, and concurrency patterns.
Creational patterns define how an object is created.
Structural patterns define relationships between entities.
Behavioral patterns define methods and patterns of communication between entities.
Concurrency patterns define how to deal with multiple threads in a program.
Wikipedia has some good descriptions of software patterns.
An example of a good design pattern is the creational pattern
abstract factory. An example of an abstract pattern is the AbstractCollection class in Java. This class provides the basic skeleton required to create a collection of objects. It has methods to add items to the collection, remove items from the collection, get the size of the collection, etc. Individual methods in the class can be overridden in subclasses to provide functionality specific to that implementation. Several classes implement AbstractCollection in a more specific way. ArrayList, by way of AbstractList, implements the methods so that they work with a resizable, sortable list of objects of a specified type. List implements them to work with a list of specifiable, but fixed, size.
To put it in simpler terms, an abstract factory pattern is like the definition of a triangle. The abstract definition of a triangle is that it is a shape with three sides. The abstract methods would be implemented in the classes RightTriangle, ObtuseTriangle, and AcuteTriangle, which would place restrictions on the angles of the triangle, as shown below (
Wikipedia).

Bad design patterns are called
antipatterns. While good patterns have dry names like "abstract factory", "composite", and "chain of responsibility", antipatterns have been given such monikers as "spaghetti code", "God class", and (my favorite) "big ball of mud". The big ball of mud starts out as a relatively simple piece of software, then through the addition of bits of throwaway code, quick fixes, and piecemeal growth, becomes an unwieldy, mutant program that would take a good deal more time and money to fix than it would have taken to properly maintain it in the first place. By leveraging all of my considerable artistic talent, I leave you with this insightful look into big balls of mud: