1. To not worry about my code being judged too much. Everyone's code can be improved. The real art is to know the balance between good enough, and not contributing obvious technical debt.
2. Not being afraid to break things. (unit testing helps lower that fear, so is documentation, single responsibility principle, open closed principle etc)
3. Assume you will probably never have time to rewrite it.
4. Assume you will probably never have time to do a major refactoring on it either.
5. Boy scouts rule. Due to the above, just gradually make the code a little better everytime you touch it. You see something bad in the neighboring method? cleanup, even if you didn't write it, and make sure the unit test covers that (shows how unit tests are important. It's not just to test your code, it's to allow people to feel comfortable changing your code when you are not there)
6. Unit test (almost) everything on one hand, but feel ok to skip testing a function that does something so trivial that the test itself is just repeating the same logic. Also consider mutation testing over code coverage as a metric.
7. The obligatory - check your own code first before blaming others, Google everything, if something looks WTF, then you are either looking at the wrong server, have cache issues, wrong git branch etc... (9/10 of the times)
8. Use other people's code, avoid NIH syndrome, use open source (with the right attribution) and don't be afraid to try and contributing back to the community. Best code is code you never had to write.
1. To not worry about my code being judged too much. Everyone's code can be improved. The real art is to know the balance between good enough, and not contributing obvious technical debt.
2. Not being afraid to break things. (unit testing helps lower that fear, so is documentation, single responsibility principle, open closed principle etc)
3. Assume you will probably never have time to rewrite it.
4. Assume you will probably never have time to do a major refactoring on it either.
5. Boy scouts rule. Due to the above, just gradually make the code a little better everytime you touch it. You see something bad in the neighboring method? cleanup, even if you didn't write it, and make sure the unit test covers that (shows how unit tests are important. It's not just to test your code, it's to allow people to feel comfortable changing your code when you are not there)
6. Unit test (almost) everything on one hand, but feel ok to skip testing a function that does something so trivial that the test itself is just repeating the same logic. Also consider mutation testing over code coverage as a metric.
7. The obligatory - check your own code first before blaming others, Google everything, if something looks WTF, then you are either looking at the wrong server, have cache issues, wrong git branch etc... (9/10 of the times)
8. Use other people's code, avoid NIH syndrome, use open source (with the right attribution) and don't be afraid to try and contributing back to the community. Best code is code you never had to write.