I'll add my advices as well.
Code writting :
- Write small and focused function. The smaller and simpler, the better.
- Write Self documenting code. Your code must be so simple, just reading throught it explain what it does.
- The fonction name and it's parameters should explain near 100% of what it'll do. Exemple : If i look at "void Math::SortArray(std::array<T> &_array, bool _ascending) const;" i know that it return nothing, that the parameter _array will be modified by the function, that i can sort ascending or not with the second parameter and that the function will not motify the class "Math", as it is const.
- Comment anything that could be misinterpreted or cannot be made simple.
- If you have a programming style, stick to it. Never deviate. Everyone in your team must be up to date with the programming style and must follow it.
- Never use magic numbers. Use enumerators, or const in c/c++ and final in java.
- Never duplicate large chunk of code. Example: if you have a function that sort integer and another that sort double, rewrite it as a template.
- If you are programming with objects, encapsulate everything that can be encapsulated.
- Every class function must be private, unless it need to be public.
- Learn the most usefull programming patterns*.
- *Try to avoid the singleton programming patterns.
- Sometime, take the time to return to something that you finished and think about if it could be written simpler. Do a little optimization and refactoring here and there during developpement. Don't forget to retest what you change.
- if you are using a language that use header, try as hard as you can to maintain a clean and well sorted header (with comment). Group all draws function, group all getter, all setters, etc... This fall into your programming style or choice.
- Remove anything that become obsolete or unused. Don't worry about losing anything, you have a source control. The worst thing you could do is commenting whole functions. Its making scrolling through the code unnecessary obfuscated.
- Don't over-complicate anything. A lot of thing can be made simple just by taking the time to think it through.
- If you are writing something new, make sure it don't already exist first. Nobody wants three functionally identical functions that return the bounding box or an actor, written by 3 different guys / gals.
- This wikipedia page list a lot of things that can overcomplicate code and make it harder to manage. Print it and pin it on the dashboard where you work.
Code documentation :
- Use a version control, git, mercurial, etc... and a version control software like svn or SourceTree.
- Always commit something with zero errors, zero warnings.
- Try to maintain the documentation up to date with the code.
- Atlassianhave a wide variety of tools for a small team, without paying too much (Confluence for documentation, Jira for bugs, Hipchat for chat, Bamboo for building new versions. Bitbucket for source control). I highly recommend it.