Design Patterns

Have you ever encounter a problem somewhat common? Or a recurring problem? How do you solve these problems?

In computer science there are typical solutions for problems that appear often. These are not copy-paste solutions, they need to be adapted into your project. Design patterns are structures of how you may solve the problem you are facing, other people already identify what problems are very common and they created a clever way of solving them. These solutions are already tested and optimized for the benefit (of mister kite) of the coder. Design pattrens are a high level solution for the problem.

There are different types of patterns

  • Structural: This kind of pattern are all about keeping organozation and structure (duh) of the different classes and objects in your project.
  • Behavioral: Are patters describing how classes talk to one another and these patterns solve a common way of their communication.
  • Creational: These are about the instantiation of said object.

Lets make an example.

Imagine you wrote a book about design patterns. You took time in the investigation and its quite large, you publish it and it becames popular. Another fellow coder wants to take a look at your book, so instead of writing the whole thing againg, you give him wha you already wrote. This pattern is called singleton. The singleton return the object instantiated, it does not create another object.

Leave a comment