[MUSIC] Hello and welcome to the second course in the Software Design and Architecture Specialization. Brought to you in partnership by the University of Alberta and Coursera. In this course, we'll be exploring design patterns. If you're joining us for the first time, you may want to consider visiting our first course in specialization on Object-Oriented Design. Although, if you're just interested in learning about design patterns, all of our courses stand alone as individual courses. This course It's just like the others in our specialization, consists of four modules with the first three focusing on the content. You will complete assignments for the capstone project throughout the course, but the rest of the work will take place in the fourth module. So what are we going to cover in these modules? What's next in your journey to designing it right? What is a design pattern? Well, design problems and application can be resolved through design patterns commonly applied by experts. In this course you will extend your knowledge of Object-Oriented Analysis Design, by learning how to apply design patterns to addressing these design issues. Though a survey of established design patterns you will gain a foundation for more complex software applications. You'll also several design principles to make a more reusable, flexible, and maintainable. Finally, we'll teach how to identify bad software designs by referencing a catalog code smell. When you reach the capstone in this course, you'll get to apply your newly acquired knowledge. You'll be challenged to critique an existing job application for code smells. You'll also get the opportunity to redesign the application to apply to side parents. For the first module, we'll be teaching you about creational and structural design patterns. So let's begin. >> In software engineering, you will often come across the same design problem many times. There are so many ways to deal with these recurring problems but over time some solutions are preferred over others, because they're more flexible or reusable. A design pattern is a practical proven solution to a recurring design problem. Instead of solving a particular software problem by basic objectory into programming principles every time, where you would have to decide what objects to use? How objects need to relate and so on? You can use previously outlined solutions that expert developers have often used. These design solutions are not theoretical proposals of only academic interest. These are actual solutions that are used in industrial software. Think of design pattens like the way you would think of recipes in cooking. There are some dishes that people have experimented with and cooked over and over again. After a while, a certain way of cooking a particular dish would be preferred because it creates the best tasting dish. Over the years, developers have experimented with many different design solutions. And these design patterns outline solutions that often create the best outcome. There are 23 design patterns identified in a famous book called Design Patterns, Elements of Reusable Object-Oriented Software. By authors Gamma, Helm, Johnson, and Vlissides. This course will go through a selection of these patterns. However, it's important to note that it won't be so simple to look at a software design problem and automatically know which design pattern to use. There are many design patterns available and sometimes one particular design pattern may seem applicable, but it may not actually be the right fit to the problem at hand. Using design patterns is sort of like playing a game of chess. There are many ways to win by putting your opponent in checkmate. A beginner chess player may only know the basic moves of each piece. Whereas an expert chess player will look for appropriate patterns on the board. There are established chess patterns called the exposed king or the isolated pawn, for example. And these are patterns that experts will look to exploit while playing the game. Through experience, they are better able to judge which patterns to use or create in a particular situation to win the game. Similar to chess, beginner software developers might only know the elements of language syntax in programming software. They know elements like how to create a for loop, a method, and so on. But with more practice and experience, these software developers will write more idiomatic code that follows common conventions. Also, they can become design experts who know the design patterns to use in solving particular software design problems. Another thing to note about design patterns is that it's not just a concrete set of source code that you memorize and put into your software, like Java libraries or frameworks. Design patterns are a bit more conceptual. It is knowledge that you can apply within your software design to guide its structure, and make it more flexible and reuseable. So, why should you use design patterns? Design patterns help software developers so that instead of building everything from scratch, they have a guide that helps them solve design problems in the way experts do. A beginner athlete may have the natural talent and basic knowledge of the sport they playing. But a couch with years of experience will be able to help that athlete to become better and use their talent to achieve greater things. Design patterns are already proven by experts, and they've gone through the hardships. You can skip the trials they've already gone through, and just to straight to creating better written software. Finally, design patterns help to create a design vocabulary. Rather than having to explain the details of a design solution over, and over again, you can simplify the discussion by having a suggestive word to describe it. For example, there's a very common design problem in software where you have two objects and the first object depends on the second object. If the second object changes, the first object should be notified. This is a situation that occurs often in software and we take some time during the discussion to describe a solution involving super classes or interphases and certain methods. Design patterns help to address issue by giving each pattern a name and making it easier for developers to communicate. Instead, you can simply say we'll use an observer design pattern here. Prior knowledge of this particular pattern outlines a solution and clarifies the original situation. So the discussion can focus on other issues. Knowledge of design patterns leaves less room for misunderstanding. My description of this situation and solution could've been vague. And you could've misunderstood the design to be implemented. If I simply say, this is an observer pattern, we both know exactly what we're discussing. You will learn many design patterns throughout this course. You will learn what to look for, and how to use each design pattern. Design patterns are important techniques to use and learn as you design software. So now it's time to start designing like an expert.