Design Patterns vs Principles – Understanding the Differences

cdesign-patternsjavaobject-orientedterminology

What is the difference between Object Oriented Design Patterns and Principles? Are they different things? As far as I understood both of them try to achieve some common goal (e,g. flexibility). So can I say a pattern is a principle and vice versa?

Design Principle = SOLID (i.e. Dependency Inversion Principle)

Design Pattern = Gof (i.e. Abstract Factory Pattern)

Best Answer

No, they aren't the same.

Patterns are common solutions to object-oriented programming problems. (I'm not aware of any similar books for functional or declarative programming.) The idea was crystallized in the famous "Design Patterns" book by the Gang of Four in 1995.

As Andre points out, patterns are common in every paradigm. I'll reiterate my previous statement: I'm not aware of any similar books for functional or declarative programming, but Andre has remedied my ignorance with the link he provided below. (Thank you, Andre.)

Principles are less about particular languages or paradigms, more general. "Don't Repeat Yourself" - DRY principle - is true for all programming.

Related Topic