3.5 Avoid redundancy and duplication in code
Improve solutions rather than recreating them, using good organization strategies to simplify code where possible and reduce redundancy.
Criteria
- Remove or simplify: Human-testable
Remove duplication and/or simplify and optimize your code for better performance, focusing on essential features so you have a cleaner, less redundant product and codebase. - Iteration over recreation: Human-testable
Improve existing solutions rather than redeveloping and redesigning products from scratch, since the latter would duplicate the coding effort and maintenance burden for developers rather than reduce the learning burden for users.- A Sustainable Design Handbook
- Becoming a Better Programmer: Improve Code by Removing It
- Stop Redesigning And Start Tuning Your website Instead
- United Nations SDGS – Goal 12 – Consumption & Production
- When you Should—and Shouldn’t—Consider Redesigning your Website
- Why Website Redesigns Should be Avoided (And a Proven Process)
- You’ll Rebuild Everything Every Four Years Anyway
- Organize code arrangement: Machine-testable
Use organization methodology and systems such as Don’t Repeat Yourself (DRY) or Write Everything Twice (WET) to optimize the arrangement and output of your JavaScript and CSS.- 3 software development principles I wish I knew earlier in my career
- AHA Programming
- BEM
- Clean Code Essentials: YAGNI, KISS, DRY
- Clean Code Explained
- Clean Code in JavaScript
- CSS: Classes Seriously Sprawling
- DRY CSS: How to Use Declarations Just Once, Effectively
- Organizing your CSS
- Produce clean and maintainable code
- The Art of Clean Code
- The systemic failure of implementing CSS principles
- Web Almanac: Sustainability
Benefits
- Accessibility
Following naming conventions used in methodologies can be easier for developers with accessibility needs to follow and use compared to generic selector identifiers. - Economic
Using an optimized and reusable codebase can enhance productivity and code quality leading to a better return on investment. - Environment
Integrating certain methodologies can add code to your markup, but they also improve maintainability. This reduces development time at scale, and could reduce energy consumption as developers optimized workflows will reduce the time and energy spent on tasks. - Performance
Avoiding repetitive code reduces waste in markup, which reduces the time it takes to download site data. This also reduces server-side impact.
GRI
- Materials: Medium
- Energy: Medium
- Water: Medium
- Emissions: Medium