Why you Should get Into Coding Patterns Right Away 🏁
Tags: beginners, programming, patterns, discuss
Published: 2022-06-07 06:36:13

*First and for most - I would love to hear your thoughts on*
 
> When in ones developer journey should one look into the topic of patterns? 

*As of my opinion is as early as possible and here is why!* 😊

Software development can be simply descripted as solving problems and occasionally drinking coffee ☕. Although this is what we as developers do and also what we hopefully enjoy doing, there is not always a need for that. *You might ask why?* Well, firstly that in your hand is properly not your first one of the day, and secondly lots of people, especially four very dedicated man, already did a lot of thinking for you 🧠. 

**Disclaimer**
Do not get me wrong, finding your own way of problem solving and kind of developing a 64-bit sense for it is a crucial skill you *need* as a developer, yet I think especially for beginners it is not any less interesting as it is educational to see how other people approach all sorts of problems. 

## Where to Start
When talking about design patterns in software engineering the [Gang of Four Design Patterns]( https://springframework.guru/gang-of-four-design-patterns/) are what most people think of. Those are your `goto` for any sort of somehow generic problems like... 

**Factory Method:** To create instances of different implementations of an interface.

**Composite:** To compose objects into tree structures and work with these structures like with individual objects.

**Iterator:** To iterate all elements of a collection without exposing their underlying representation.

Just to give a quick overview on those patterns, there 23 of them, categorized into: 

- Creational Patterns
- Structural Patterns
- Behavioural Patterns

In the book *Design Patterns: Elements of Reusable Object-Oriented Software* each pattern is descripted and exemplify with UML diagrams, template source code and a real-world example. It is very well-written and gets you right into the different topics and use cases.

## How I Practiced Them
Back in school, my professor always did the following three-step-approach of showing us the purpose of a new pattern:

1. Explain a problem
2. Give time to the students to come up with their own solution
3. Discuss the approaches and present the pattern-solution

I loved this technique of him teaching us as we were given the chance to think about a problem and understanding it as a whole. Additionally, since then I always had a distinct example for every pattern in my mind! 

## What to do Next
So, now that you got all your sources of information ready, maybe even a collection of code snippets and explanations, what next? Think through them, maybe find real-life examples based on your own experience and *code, code, code* as one of my professors always used to say: 

> *I didn’t really understand it - until I tried it!* 

## In the End 
Design patterns are a great thing to know. They make the life of a developer much easier and are optimal against headaches and bad code design, yet bear in mind that these patterns should support you and you should not just blindly follow along. 

**Understand what code can do and what you can do with code!** 

Photo by [Jonas  Svidras](https://www.pexels.com/de-de/@jonas-svidras/) on [Pexels](https://www.pexels.com/de-de/foto/schwarzer-und-gelber-elektronischer-chip-785418/) 🎉

**Ps.:** Also an amazing tip in terms of improving your coding skill and the overall quality of your code is the [Clean Code Initiative](https://clean-code-developer.com/) providing the theoretical input and also a roadmap on how to go about it.