Don't Re-Invent the Wheel!

03 Dec 2020

An Age-Old Adage

We’ve all heard the saying: “Don’t re-invent the wheel”. It’s pretty obvious that means don’t go and waste all your precious time trying to create something from scratch when the ideal basic element is right in front of you. Unless you’re trying to look like a cartoon caveman, carving a square piece of stone to use on his wagon, then you should just take the idea that some genius came up with and use it. That’s what design patterns are like. Yeah, a wheel is a pretty basic example, but I think you get the point.

Springboard Off the Pros

So what’s a design pattern in computer science? Essentially, design patterns are common solutions to problems that come up all the time while engineering software. Yes, you may feel like the only one to have run up against a particular brick wall while coding, but chances are someone else has already. Over time, designers have outlined certain strategies or formulas to approach these issues. These are design patterns. They aren’t specific solutions, but they are the common routes to finding your answer. Ultimately, they allow newbies (like me) to “springboard” off of the experience of many seasoned developers who have faced these problems before. And that’s awesome.

Not Exactly “Plug ‘n Chug”

Okay, so design patterns aren’t exactly like math formulas. You can’t just plug in numbers like you can in algebra or geometry. But think about the underlying principle: you’re building off of the work of geniuses who came before you. Every time you solve a hypotenuse in geometry, you’re benefiting from all of the work Pythagoras did centuries ago. If you didn’t have that theorem, you’d be way behind the curve. Your RPMs would be awfully slow (since we’re talking about wheels here). Design patterns are similar in that way. They give you that basic information, those rules you need to straighten your path to a solution.

Building A Better Wheel

So, we don’t want to (or can’t) invent the wheel again. It’s already got a basic design. But we can possibly make it just a little better, always improving on what we have. And that’s how I feel about using design patterns. Now, given that I learned about them this week…I don’t really have an expert opinion. But in my brief “career” as a student of software engineering, I have already been obliviously using them! Just in the bit of design I’ve done with JavaScript, I’ve been using the Observer, Model-View-Controller (MVC), and Front Controller patterns, just to name a few. As a specific example, the Observer pattern can be used in Meteor via the Reactive Data aspect to enable a MongoDB database to be run again when a collection updates. It’s just another part of the behind-the-scenes awesomeness that I was not aware of until now. What makes me excited is how I can ultimately contribute by coming up with yet another solution via design patterns, building up the resources that others can take advantage of. And the wheel rolls on…