How to write solid code?
-
empathy / perspective-taking is the most important.
- realize that code is written for human to read first and then for machines to execute.
- software is so "soft" and there are many ways to achieve one thing. It's all about making the proper trade-offs to fulfill the requirements.
- Invent and Simplify: Apple Pay RFID vs. Wechat Scan QR Code.
-
choose a sustainable architecture to reduce human resources costs per feature.
-
adopt patterns and best practices.
-
avoid anti-patterns
- missing error-handling
- callback hell = spaghetti code + unpredictable error handling
- over-long inheritance chain
- circular dependency
- over-complicated code
- nested tertiary operation
- comment out unused code
- missing i18n, especially RTL issues
- don't repeat yourself
- simple copy-and-paste
- unreasonable comments
-
effective refactoring
- semantic version
- never introduce breaking change to non major versions
- two legged change