Skip to main content

5. Conclusion

You may successfully code without having an idea of what patterns are. Moreover, you might have implemented some of them without even noticing. But conscious usage of tool differs is an important step from a beginner level to professional. You may hammer a nail, and you may hit it with a drill as well, if you make enough effort. Professional developer understands, that it's not a purpose of a drill.

Software development would be much easier without changes at all. But changes are everywhere: requirements, environment, hardware and so on. The main purpose of software development is creation of systems, that will allow localizing and minimize negative influence of such changes.

That is why we should write reusable code with minimal dependency on other parts of the program and use SRP (single responsibility) and OCP (open-closed) principles. That is why we should use abstractions and depend on them rather than on realization details. And also prefer composition over inheritance.

Using design patterns, the code, which conducts these approaches and principles, can be achieved much easier. For example, Strategy pattern allows writing code, which is opened for extension, but closed for modification. Observer pattern allows creating loose coupled code and so on.