Let’s try to not reinvent the wheel… kind of

Everyone knows what a bike is, and if you don’t, here is one:

“bike” by monikomad is licensed under CC BY-SA

You can get a general idea of how the bike is formed by the simple experience of looking to a lot of them. The bike is generally composed by:

  • Two wheels
  • Two pedals
  • A-frame
  • A sit
  • A handle

With this blueprint, we could create our bike, and also add a lot more if we wanted to. Maybe we need a basket, or perhaps we need it to be more aerodynamic, we just need to hack it.

We create this new bike based on the standard, the blueprint, of a bike. This blueprint can be defined as our design pattern of a bike.

Design patterns

The term design pattern is not that common in the biking world as in the software development world. But, besides this, the idea presented above is, in general, what a design pattern is. Design patterns are solutions to common problems in software design.

These design patterns are general blueprints of tried and tested solutions for common problems. Sometimes without knowing them, we are capable of applying them because, in the end, it is the standard solution. Because of this, is why it’s essential to know them at least to save time trying to reinvent the wheel in every new problem we encounter.

Imagine again we are creating our bike and we need to add the tires. But, because we chose to avoid the blueprint, we imagine that square tires are the best bet.

Maureen O’Hare, CNN

After a few tries, we may notice it is not the best option, and we decide to use a circular tire, and that worked. But if we had just used the blueprint, we have saved a lot of time and resources.

This blueprints in the software world can be classified in different kinds depending on their use:

  • Creational: These are the patterns used for the object creation, increasing flexibility and reuse
  • Structural: These explain how to assemble objects and classes into the larger system
  • Behavioral: Algorithms and assignment of responsibilities between objects

You may think that besides all this, and after a few googling, you decided that you don’t need any pattern, and it’s OK! Don’t stress too much about this fact. These patterns are only the recommendation of how to approach some problems, but they may not feet your case, and it’s totally fine.

For a great guide on Design Patterns, visit this site, I loved it, and has a lot of exciting information!

One thought on “Let’s try to not reinvent the wheel… kind of

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.