Skip to main content

Command Palette

Search for a command to run...

Design Pattern

Published
•4 min read•View as Markdown
Design Pattern

Whenever I sit to code my next new project or just code something for the fun of it, I never really think about what I would need to consider should I decide to refactor it later on. Then during one of my classes, I learnt about design patterns and they sounded interesting, even though I didn’t understand them because the language was too technical lol.

This blog post is the first in a series of design patterns and will be me sharing what I know about design patterns and how they can be used during your software development and maintenance. This is meant to help me and also someone out there learn what design patterns are.

Now that we have gotten past that very awkward introduction lol, let us actually look at what design patterns are in the simplest way.

dp.jpg

What Are Design Patterns?

Before defining what a design a pattern is, we need to understand what a pattern is. A pattern serves as a "guide" to creating good design. If we are to look at the technical explanation of what a design pattern is, we would say,“it is a general, reusable solution to a commonly occurring problem”. However, that definition doesn’t make sense to someone who doesn’t know what a reusable solution is.

That was the technical definition, now let us look at my personal definition. A design pattern is a way to solve problems that are always occurring in any application that we make and design. You can basically use a design pattern to help you make your code easy to maintain after you have developed it.

Having a way to easily maintain our applications is something that is very vital and hence every software developer and engineer should know them especially when dealing with the object-oriented design approach. Communicating using patterns makes it easy for other developers to know what you saying and hence leads to better communication pattern fever.png

So, we looked at what a pattern is and what a design pattern is which leads to us to why we need to know them and finally the different types of patterns that can be used.

Why Should You Learn Design Patterns?

Learning design patterns will help you in various ways such as:

  • You become an expert through experience, reusing solutions that worked for you before.
  • Patterns describe solutions to design problems that occur over and over again.
  • Patterns also record design decisions, alternatives, and trade-offs gained from experience.
  • Once you know the pattern, many design decisions follow.
  • Knowing patterns helps you get designs right faster.
  • Knowing the vocabulary surrounding patterns helps communication between designers, and can ease the documentation effort.
  • Knowing patterns makes designing and maintaining applications easy, flexible and makes code reusable
  • Knowing patterns will get you highly paid because you can solve problems in the easiest ways possible.

If this is not enough reason for you to learn to design patterns then I do not know what will.

Types of Design Patterns

Design patterns can be categorised into three: creational patterns, behavioral patterns and structural patterns.

Creational patterns are used when we want to create new objects in your applications.

Behavioral patterns on the other hand are used to describe the functionality or better yet, the behaviour of each object or class in your application.

Structural patterns are used to ease your design by identifying a simple way of knowing relationship between or among entities.

When you combine all three categories into your application, you are assured that your application will work to its best while also maintaining standards that are accepted by other developers and engineers.

There are a lot of patterns have been developed over the years that fall into one of the three mentioned categories but for this series we will only look at the following:

  1. Strategy Pattern
  2. Expert Pattern
  3. Creator Pattern
  4. Controller Pattern
  5. Façade Pattern
  6. Model View Controller
  7. Proxy Pattern

Thank You for Reading

f693d6332b5468427075a09c6b7d93f8.gif

Thank you for reading up to this point. This is my first post and I hope it was at least helpful to someone out there. I want you to know that we are all learning together and this is just the first step.

Check out my twitter

N

Kudos for the excellent article.

Below is a good read about the design pattern for the database layer: medium.com / towards-polyglot-architecture / design-patterns-for-the-database-layer-7b741b126036

1
A
Akebu3y ago

Thank you so much for reading! I've added the article, I need to learn a lot about databases so this is really helpful. Thank you 🙏

D

Great intro to the series of blog posts, looking forward to seeing what I can pick up next.

1
A
Akebu5y ago

Thank you so much for reading

C

Thanks for sharing! I love it! I hadn't found information as clear like your post. You are the best!

1
A
Akebu5y ago

Thank you so much for your kind words. It truly means a lot 💖

J

I am sharing this and I am gonna wait for your next blog! Great post!

1
A
Akebu5y ago

Thank you for reading and for your kind words 💖

J

Your article is very well written, it makes me want to learn more about design patterns. Thank you!

1
A
Akebu5y ago

Thank you for reading, I am happy it made you want to learn more about patterns

S

Awesome! 🔥

I was just thinking of diving deep into design patterns and here are you with this series! Excellent article! Wanna see mooooore ❤️‍🔥❤️‍🔥

2
A
Akebu5y ago

Thank you so much Sergii, I truly appreciate it🧡

J
Jorida5y ago

I loved this article!!

I's the first time I read something about design patterns and I really enjoyed it!

Awesome start Akebu 🥳💜

2
A
Akebu5y ago

I truly appreciate your kind words Jori. Thank you so much for reading💕

3
Y

this is such a good intro to design patterns! can't wait for the rest of the series! this would be a good refresher for me. Great job Akebu!

1
A
Akebu5y ago

Thank you very much for reading ❤

R

I've worked a lot with the high level implementation of those patterns and I look forward to reading your views on these!

1
A
Akebu5y ago

Thank you, I hope I don't disappoint

1

Design Patterns

Part 1 of 2

In this series, I will cover some of the majorly used design patterns to help you make your applications easy to maintain

Up next

Strategy Pattern

A Must Know Design Pattern

More from this blog

Akebu's Blog

16 posts

An avid learner who gets slightly obsessed with learning.