When programming, consider the rule of three

Written Aug 30, 2017

In software engineering, there is a rule of three which can make your programming work more efficient.

Here are some quotes to get you inspired to think about it and use it:

The first rule of 3. Don’t worry so much about code duplication if you only have two classes or two functions or whatever. Engineers often focus way too much on reducing duplicated code.

If you are building the first implementation of some hairy unknown problem, don’t assume you’re going to nail it. Take shortcuts. Hack around nasty problems. You’re probably not going to keep this system anyway — at some point it’s going to break.

You need at least 3 examples before you solve the right problem.

To build something truly reusable, you must convince three different audiences to use it thoroughly first.

So the next time you think “I’ve built a reusable thing!”, stop, and think “how can I find three users, customers, or audiences, to prove that I’ve built something reusable?” instead.

Sources

https://erikbern.com/amp/2017/08/29/the-software-engineering-rule-of-3.html

https://blog.codinghorror.com/rule-of-three/