DEV Community

Blazebrain
Blazebrain

Posted on

Design Patterns - Flutter

Introduction

Across diverse languages and frameworks, some tested and trusted sets of steps/procedures have solved problems in the software world. These processes form the core of many solutions to specific issues. On their own, they are not the solutions to these particular problems, but they form the core upon which various solutions lies upon. These set of steps/patterns are what we refer to as Design Patterns.

What are Design Patterns?

Design patterns are a series of patterns that provides a template or description of how you can solve a common problem. On their own, they are not complete solutions to problems but instead offer an explanation or way to solve a general re-occurring problem in the world of software design.

As a result of the similarities between issues raised, there was a need for a unified way of solving these common problems. That was what brought up the initial set of design patterns. You might have applied many of these solutions while developing a product(well yeah!). They are solutions that go deep into software development and tend to solve core problems without restricting them to a language or framework.

Importance of Design Patterns

Design patterns provide you with lots of benefits, some of which include:

  • Providing a general standard for communication among developers.
  • Reducing development time and speeding up the development process.
  • Providing proven solutions to common re-occurring problems.
  • Provides best practices to get a clean reusable, and bug-free codebase.
  • Providing a core/foundation upon which you can build solutions to re-occurring issues in software design ## Gang Of Four Design Patterns

These are a set of design patterns proposed by four authors: Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. They are most often referred to as the Gang of Four. They wrote a book titled Design Patterns: Elements of Reusable Object-Oriented Software, which introduces the design patterns and gives more information on each. This book was a significant aid for the Software Development world as it tackles many of these problems and how these patterns intend to solve them. There are 23 design patterns proposed in the book, which is divided into three categories

  • Structural
  • Behavioural and
  • Creational.

We will discuss more on each of these categories in the next section. Note that the "Design" here does not refer to UiUx Designs but is more about the design and development of software. One significant benefit of Design Patterns is that it's not specific to a particular language/framework but can be developed and implemented/used across various programming languages.

Categories of Design Patterns

We would look into each design pattern and why they are grouped into these categories. Each of these categories deals with a particular use case, and the patterns under them revolve around the solutions to similar situations in development. Since we can't go deep into each of the 23 design patterns, I have included links to study further each of these patterns and how they can be applied in Flutter. In future articles also, we would go deep into specific design patterns and walk through their implementations using Flutter.

Creational Design Patterns

These are the design patterns that deal with the way Classes and Objects are created/instantiated. There are five design patterns in the Creational Design Pattern category. They are:

Structural Design Patterns

These are design patterns that deals with the way Classes and Objects get composed. It deals with the way objects combine to achieve the desired result. There are seven design patterns under this category, and they include:

Behavioural Design Patterns

These are design patterns that deal with how Objects communicate with one another. There are 11 design patterns in this category. They include:

Some of these terms may/may not be familiar; you probably might have noticed a few that you have used while developing before; these guides would give you a better understanding of why they are used and what they solve.

Conclusion

In conclusion, these patterns offer solutions to typical and re-occurring software design and development problems. They do not depend on a particular language/framework. However, they do not present immediate solutions to those problems; they serve as a basis/ground upon which you can build solutions to these problems. A deep understanding of these patterns would impact the quality of your codes and enhance communication between you and other developers.

If you have any questions about any of them or questions on Flutter, you can
reach me through on any of the platforms listed here. I would be glad to answer. Cheers!

Top comments (1)

Collapse
 
kendyjaky profile image
KendiJ💙

great read!!!