Don't repeat yourselfMay 31, 2023 | Tips
So for today, I wanted to "reiterate" a basic "principle" I encountered quite a lot today.
DRY. Don't repeat yourself.
The basic principle behind this is to remove any unnecessary redundancy and have most of your knowledge in one place.
This has the advantage that in case of any changes you need to make your changes at one centralized place. I mean. It can easily happen if an update is needed.
Well. Usages of those pieces of code are quickly overlooked. In those cases bugs will inevidently happen, so... Yeah. So yeah...
Rather than duplication, use things like references to pre-existing knowledge, templates, or encapsulation to prevent this scenario to happen.
Think about it when you need to do something "more than once".