DEV Community

Cover image for Are Design Patterns Important To Know ?
Aimen Zairi
Aimen Zairi

Posted on • Originally published at zairiaimen.com

Are Design Patterns Important To Know ?

For Beginners, Making Projects is Simply about writing code that works, in one of the previous posts we talked about why that won't do in the long term, and now we talk about another solution.
That Solution is using Design Patterns to help make the code clear, flexible and extensible.
In Big projects and when you become a real software developer with a job you will see that Design Patterns are used for every single big project.

PS : this was supposed to come with a video with cool animations and all, but i lost the project file, hopefully the next topic comes with a video.

When Not To Use Design Patterns ?

  • Design Patterns + Small Project is the worst combination as it makes the code more complex and bigger than it should be.
  • Using Design patterns doesn't Indicate Quality Code, as sometimes the implementation of these said patterns is wrong which leads to bad experience for developers checking your code.
  • Once you implement a design pattern it is hard to remove when it's not needed or want to replace it with another design pattern.

When To Use Design Patterns ?

  • Design Patterns solve certain problems when writing the code and that's what you have to look for. If you are facing a known problem that has a design pattern as a solution it is recommended that you use.
  • Creating flexibility and Making your project easily scalable.
  • Code Re-Usability when needed.
  • Easy to understand by other developers as design patterns are known standards, so any developer that picks your code can understand it.

Commonly Used Patterns

Though these aren't "Design Patterns" they are called "Architectural Patterns" but nonetheless it's good to have an idea of what a pattern can look like.

You may have seen these when trying out a new framework like Django, .NET ... etc.

There are others but the two most known ones are :

MVC :

Model : Components That Describe the data in used the app.
View : : Contains the interface that the user sees which
contains the representation of this data
Controller : Contains all the business logic done in the
application.

MVVM :

Model : Describes The Data
View : Defines the structure, layout and appearance of a view on screen
View Model : A link between the View and Model, dealing with any view logic.

Discussion (1)