Embed Notice
HTML Code
Corresponding Notice
- Embed this noticeRandom blog-posts about my own ideas :D
I follow a mixture of uncle bob's clean code and (try) to follow nasa's specifications. I find writing code to be easiest for me to follow and maintain in this way.
Namely:
(NASA)
1. All loops must have fixed bounds.
2. Restrict functions to a single printed page.
3. Restrict the scope of data to the smallest possible.
4. Compile with all warnings active; all warnings should be addressed.
(CLEAN CODE)
5. Follow standard conventions.
6. Reduce complexity as much as possible.
7. A class should know only its direct dependencies.
8. If you do something a certain way, do all similar things in the same way.
9. Choose descriptive and unambiguous names.
10. Replace magic numbers with named constants.
11. Functions should prefer fewer arguments.
12. Don't write redundant comments.
(NOT SURE BUT IT'S ALWAYS HELPED ME!)
13. The software should be modular, I should be able to rip out an entire library / module and have the rest still work.
14. Cancel out of a function as quick as possible (avoid if/else and prefer if (return) return.
There are others I try to follow but they're less explicit and not things I actively think about.