3 ms·
This is always a good idea. Here are some of the things I do - Establish conventions early; Conventions in managing projects, conventions in code. And stick to
by abc_lisper 11y ago
This is always a good idea. Here are some of the things I do
- Establish conventions early; Conventions in managing projects, conventions in code. And stick to those conventions. Be predictable,
in the code. Use simple names.
- Protect your interfaces. By this I mean, use a central place like a wiki to document your interfaces, so all involved parties may agree upon. Write unit-tests for interfaces. Use libraries like mockito and hamcrest that make it a breeze.(You would lock your home every time you go out, don't you?)
- I mentioned this in the previous bullet, but write tests. Write lots of them, write tests that document any tricky, magical behavior.
Cover all the cases(A boat with one hole is bad as one with two holes). Cover all the invariants, any thing that you notice but didn't mention in the source code. Write tests for the bugs you just fixed.
- If you are developing in Java, please use an IDE. I use Intellij, but Eclipse is good too. It makes refactoring code much easier.
Rename fields, pull classes up the hierarchy, create abstract classes, create getters and setters automatically with refactoring tools. I am not against emacs or vi, but it is hard to manage Java's sprawl with them.
One of the best programmers I know writes code like it has been generated with a program. It is boring, dull and looks alike in every direction. Every field and method is documented, it says what its purpose is, and why it is needed. He is very fast(fast for a startup, not your average enterprise), accurate and gets a lot of stuff done without magic.