Reduce reuse recycle: the 3 R’s applied to programming

‘Reduce reuse recycle’. We’ve all heard the chant-like slogan that promotes green waste disposal — whether you were taught it in primary school, had your child recite it to you, or happened upon it in some other way.

The 3 R’s are all about minimising waste and using the resources at your disposal. Although they apply first and foremost to environmental health, they can also teach us lessons for improving our programming and code practices.

So, here’s how you can apply the reduce reuse recycle idea to your programming.



Reduce code and processes

Reduce: The act of making something smaller or less in amount

Applying the ‘reduce’ part of reduce reuse recycle in programming is about making — and keeping — things as simple as they can be. This is true of your code, your processes and your product alike.

With code, reduction is about cleaning up. Reducing your lines of code by removing extraneous, overly complex or redundant code from your program is a process known as negative coding. It tidies code, makes it easier to read and maintain, and helps your program run more efficiently.

You can also reduce the programming processes that distract from more valuable pursuits. If something you must complete every day isn’t bringing value, find ways to reduce the effort or time put into them. For example, maybe your team works better if you turn your daily stand-up meetings into ‘every-other-day stand-ups’ instead. Maybe your code reviews quibble too much over trivial issues. Or maybe you should try automating some of the more repetitive, simple tasks.

Finally, it can pay to reduce the number of features you’re trying to include in your product. To remain competitive, programmers sometimes fall foul of feature creep. Feature after feature is added to a product before release, with the goal of making it bigger and better. But that also overcomplicates your product. So, ask yourself: is every feature you’re working on really going to add value to the core goal of your product?



Reuse code and knowledge

Reuse: To use a resource again or more than once

Programming is all about problem-solving. When you come to a new solution that works well, then, it makes sense to reuse it where you can. In programming, the ‘reuse’ of reduce reuse recycle is seen best in the sharing of knowledge, code and solutions across the development team.

Code reuse makes sure that teams aren’t reinventing the wheel when it comes to solving repetitive problems. Software libraries, design patterns and frameworks are all great ways to achieve this. Seek to identify units of reusable knowledge, and store it into a knowledge base. Write code that can be easily extended in future. Be more modular. By taking the time to code with reuse principles in mind, you’ll save time long term.

However, there is a caveat to code reuse. Taken too far, it can lead to more wasted effort, rather than less. Code reuse is not to be confused with ‘copy-paste programming’, nor should it be used as a way to cut corners when quality becomes compromised. Your goal is not to simply reapply the same code to multiple problems time and again, but to have a solid foundation to reuse valuable functionality.



Recycle ideas

Recycle: Turning waste into something usable or returning a resource to a previous stage so it can be used again.

Just as programming breeds innovative solutions and ideas, it can also involve experiments, tools and ideas that didn’t quite hit the mark the first time around. When this happens, it can be tempting to scrap it all and start again.

Unfortunately, this wastes the time, effort and energy that went into the dud solution. Why not recycle that idea instead?

You had the idea to use a new tool to help manage a project, but it’s not worked. Instead of ditching the idea completely, try applying it to managing the team instead of the project. Maybe you thought of a good way to code a feature, but it hasn’t worked properly. Instead of deleting it all and starting again, rework it into something that you can use elsewhere.

Recycling in programming is about trial and error, testing if something works for the team in different settings or scenarios. Basically, if you’ve put effort into something and it hasn’t worked as planned, there’s no reason you can’t rework it into something useful for another part of your project.



Reduce reuse recycle

Reduce reuse recycle is all about managing wasted resources. In programming, your resources are your time, effort, cost and code.

By effectively applying reduce reuse recycle to your programming, you’ll avoid excess waste of time and effort, and encourage effective use of your resources. You might even end up with a cleaner, smoother product to boot.

So, what are you waiting for?



Useful links

The positives of negative code

The sunk-cost fallacy: is your code worth the effort?

Sustainable UX design: saving the environment with smarter websites