DEV Community

Discussion on: 10 commandments of programming

Collapse
 
thebuzzsaw profile image
Kelly Brown • Edited

Sorry to be That Guy™, but I'm going to add a caveat to commandment number two.

Yes, don't reinvent the wheel, but learn to recognize exactly which wheel you need! There are plenty of good reasons (beyond "education") to build a new wheel. The widely available solutions are general purpose and often try to solve too many people's problems, and it's unfortunate that we shame developers for daring to build their own variant on a popular data structure. Developers are closer to the real problem than those who created the general purpose solution.

Also, it's kind of funny that we use "wheel" for this analogy. Do people understand just how many wheels are invented every single day? We have wheels for every kind of encounter. We have wheels optimized for smooth roads. We have wheels specialized for rough or snowy roads. We have wheels that are bulletproof. We have wheels that work underwater. We have wheels that work on Mars. We are "reinventing" the wheel all the time.

In general, keep a healthy balance. Do not underestimate the power of existing well-tested well-reviewed solutions, but do not shy away from building a custom solution that solves your problem perfectly. Sure, you cannot reuse your solution in other situations, but that was never the point!

Collapse
 
darlanalves profile image
Darlan Alves

Yes, don't reinvent the wheel, but learn to recognize exactly which wheel you need!

This sums up perfectly my intent with that rule!

It's also nicely illustrated by this image about wheels.

Indeed, people reinvent wheels every single day for specific purposes. Eventually, reinventing the wheel leads to entire new things.

AngularJS was an experiment for a side project. Gmail was some guy's pet project too. Those are great innovations out of someone reinventing their wheels.