#### [[The DRY principle]]
---
The **DRY** Principle is an approach to writing software that is both computationally efficient, as well as easy to refactor and evolve.
The Acronym stands for:
`D`on't
`R`epeat
`Y`ourself
This approach yields dividends when applied to duplication of code that can be abstracted away or the outcome can be achieved through more efficient means ex:
```python
# Instead Of 100
print('Hello Worlds')
# you can just use a for loop
for 1 to 100
print('Hello Worlds')
```
This principle can be applied to a variety of contexts, in essence the approach comes down to doing what is most efficient, and utilizing any available means to perform the heavy lifting (*like for loops instead of 100 print statements*) while also reducing wasted effort down the line when you might need to refactor a function name or something.
This type of reduction in future cost is another way to reduce [[Cognitive Load]].
---
- Tags:
- [[Programming]] - [[DevLog/s/l/python/workflow]] - [[Cognitive Load]]
- Reference:
-
- Related:
- [[Enforcing coding style and conventions reduces cognitive load by presenting familiar patterns and expectations]]