From the course: Programming Foundations: Design Patterns

What are design patterns?

From the course: Programming Foundations: Design Patterns

Start my 1-month free trial

What are design patterns?

- [Instructor] Design patterns are all about reusing experience, design experience. Design patterns aren't algorithms, and they're not code. A design pattern is an approach to thinking about software design that incorporates the experience of developers who've had similar problems, as well as fundamental design principles that guide how we structure software designs. A design pattern is usually expressed by a definition, and a class diagram, and collected into a catalog of patterns. In these catalogs, you'll find example scenarios when a pattern might be applicable, the consequences of using a pattern, and even some sample code. As you'll see, patterns are pretty abstract. It's up to you to determine if the pattern is right for your situation, and your specific problem. And once you've figured that out, how best to implement it. Design patterns are not specific solutions for specific kinds of software. There isn't one design pattern for banking software, and a different design pattern for game software, and another pattern for social media software. Rather, design patterns are general solutions for common problems that crop up in all kinds of applications. For instance, you might be working through your class design and discover that if one object changes, several other objects need to know about that change. Is there a way to structure objects so they aren't too tightly dependent on one another? This is the kind of problem that you'll encounter in software systems across all domains. And while there are many different ways that you could solve this problem, there's a proven way to solve it. A best practice called the observer design pattern. We'll be learning more about the observer pattern later. In this course, we'll be focusing on six of the 23 original patterns in the Gang of Four Catalog. These are the patterns you're likely to find most useful, because they're approaches to the most common problems that crop up as you design and develop a software system. Once you've learned how to read and understand these six patterns, you'll be able to explore more patterns on your own. You'll find a more complete treatment of the original 23 patterns in our book, "Head First Design Patterns," a brain friendly guide to design patterns. We'll describe each pattern conceptually, talk about it's object oriented design in the form of a class diagram, and then show code snippets to show you the key features of a pattern implemented in code. Our goal is to demonstrate each pattern as simply as possible so that you can apply it to your own problems.

Contents