- Code is complicated, hard to test, difficult to understand and can frustrate others.
- Writing cleaner code can save you from reimplementing software simply that you cannot understand.
- It’s an iterative process and there’s several principles to help you do that.
- Keep it Simple Stupid (KISS) tells us to avoid unnecessary complexity and reduce moving parts. The idea is to write for maintainability.
- Don’t Repeat Yourself (DRY) is about avoiding redundant implementations of the same function. You should think about refactoring.
- You Aren’t Gonna Need It (YAGNI), an Extreme Programming principle, says we should stick with the requirements and avoid adding unneeded features or functions.
- Composition over Inheritance asks us to take care when applying classes an inheritance in your design because it can lead to inflexible code.
- Favoring Readability reminds us that writing software is like writing prose. Organize your code as if you’re writing a novel.
- Practice Consistency tells us to stick with our decisions throughout the project. Keep the same format, implementation flow and design principles.
- Consider How to Test a solution before writing it, or at least while writing. It helps you avoid traps that can unnecessarily complicate the code base.
from Planet Python
via read more
No comments:
Post a Comment