- Design your code before you start writing it!
- Seek to simplify the problem/design/code wherever possible. This makes it easier to understand, code correctly, and maintain.
- Try to break the design/code into small well defined functional units (folders, files, namespaces, classes, methods) to keep the codebase logically organised and well structured
- Encapsulate behaviour where possible so that the implementation is hidden from the end user.
- Get a coding style guide - there are loads on the web. Read many and pick out the best ideas from them (Don't just follow a rule because someone says you should - look for a good reason for every rule)
- Document the code. Writing down how it works to a level where another programmer understands how to use it without having to ask any questions forces you to think about it, and often highlights problems.
- Single-step your code so you fully understand how it actually works (as opposed to how you meant it to work)
- Unit & regression test
- When you find a bug, don't just fix it; work out why it happened and learn from the mistake.
- The best way is to work as a team. Learn from each other, and the code others write. (Work on other people's code, pair program, discuss ideas in dev meetings, do code reviews)







0 comments:
Post a Comment