Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
As you start to get more familiar with object-oriented development, you'll hit the concept of Design Patterns. These are well-tested solutions to common problems and issues we run into in software development. Now these are not business solutions. Design Patterns don't deal with bank accounts and customer classes. They work at a different level than that. Think of them as best practices, suggestions for how you might arrange your own classes and objects to accomplish a result. So they don't deal with questions like, oh, I need to create an email app for a phone, or I need to make a payroll system, instead they deal with more general issues.
Say you're working through your class design, and you realize that if one of your objects changes, it needs to let several other objects know, and you wonder if there is a good way to do that. Well, there are multiple ways you could deal with that, but there is a well-tested proven approach that's been given the name of the Observer Design Pattern. Or another example let's say you realize an object will be changed by a lot of other objects, but you need it to be able to undo the last change. Again, could be done many different ways, but there is a Memento Design Pattern that describes a simple proven approach.
Now Design Patterns are solutions for that level of question. Best practices for solving common software design problems that occur again and again across all kinds of applications from business apps to games. Design Patterns became best known from the Design Patterns book by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, often referred to as the Gang of Four, and you'll see this referred to as the Gang of Four book published in the mid '90s. Now this book detailed 23 Design Patterns which were split into three groups.
The first group was the Creational Patterns. These are approaches that deal with the creation of objects. Instead of you instantiating all objects very specifically and very explicitly, they give you more flexibility in how the objects are actually created. Then there were Structural Patterns, and these dealt more with how classes are actually designed, how things like inheritance and composition and aggregation can be used to provide extra functionality. Then the third group were Behavioral Patterns, and most of these design patterns are specifically concerned with communication between objects as the program is running.
Now Design Patterns are an advanced topic that deserve an entire course for themselves, but we can certainly get a couple of the simpler examples explored so you can get an understanding of where they fit into the world of software development.
Get unlimited access to all courses for just $25/month.Become a member