课程: Programming Foundations: Design Patterns
Object-oriented design experience
- Object-oriented design experience doesn't come easy, and it can take a lot of trial and error to come up with designs that are flexible and extensible. We're all taught the importance of the fundamental properties of object-oriented programming, namely inheritance, polymorphism, abstraction, and encapsulation. When these are the only tools in your toolbox, your design process can quickly go off the rails. In fact, it can lead to software that is downright difficult to design, maintain, and extend. - No doubt, you're already familiar with off-the-shelf libraries, modules, and frameworks. This is packaged up code that you compile into your application so that you can benefit from code that other developers have written. Design patterns, on the other hand, give us packaged up design insight and experience. Design patterns provide paths to solutions for some of the most common object-oriented design conundrums. They're solutions developed over time through trial and error that are well-documented and can be applied to your specific design problem. - We like to say design patterns don't go directly into your code. Instead, they first go into your brain. Once you've studied patterns and you have a good working knowledge of them, you can then start to apply them in your own object-oriented designs. In this course, we're going to start to get those patterns into your brain. - Design patterns were first described in the book Design Patterns: Elements of Reusable Object-Oriented Software Design. This book was written by four software engineers affectionately known as the gang of four. In their book, they catalog 23 of these patterns and began a whole new way of thinking about object-oriented design and programming. While the list of design patterns has grown over the last couple of decades these original 23 patterns are still among the most commonly used today. - So what will using design patterns get you? Design patterns will first and foremost help you to not reinvent the wheel. By using patterns, you can often shortcut your design process by leveraging the hard work of other developers who have already gone through a similar exercise and found good solutions that you can use. - [Woman] There's another big advantage to using design patterns. Using patterns will often help you to create software that is resilient to change. That's an important consideration because software requirements are always changing. New features are always being added, and environments are constantly evolving. Design patterns can protect you from the changes and additions you'll need to make in the future. you'll need to make in the future.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。