From the course: Spring: Design Patterns

What are design patterns

From the course: Spring: Design Patterns

Start my 1-month free trial

What are design patterns

- Before we begin talking about the design patterns that we're going to use with the spring framework, we need to talk about what they are. And really what they come down to, is that these are a set of best practices for solutions to common problems, designed with good object-oriented programming in mind. And the solution and application or implementation of it. And finally it prescribes how to use the solution as well. So a good, well defined design pattern not only shows you the solution to the problem, the implementation of that solution, but prescribes how to use it to maximize its value. Now you may ask: why do we care as developers about these design patterns? And the answer comes down to that they provide a common answer to common problems. There's no need to solve the same problem over and over again, after all that's just an exercise in futility, and there's no reason to recreate the wheel it's already been done before. And these design patterns are proven implementations that you can leverage for free. And the industry as a whole has adopted them, and that adds even more value to them because other developers look at them and understand them immediately, which makes reading code for them that much better. Now there's some value to developers as well that I just talked about. Now these are trusted and well-tested patterns that makes determining the solution and solving the problem that much easier. Because these have already been tested, and these patterns have already been defined you can get to market faster because you don't have to create a new algorithm. And they're easier to explain your code when you use patterns because other developers will recognize them, and because they're written with highly structured object-oriented programming you can explain your code in a way that makes sense to others doing object-oriented development. And because you're using a pattern and you haven't recreated something from scratch its easier to read your own code later, which makes fixing issues, as well as debugging problems, that much easier later. So leverage design patterns, leverage them for your own benefit, and use these trusted solutions to do your job and to do it well.

Contents