Tord Romstad wrote:
- Use some sort of version control system! What VCS you use is largely a matter of taste (except I would recommend a modern distributed VCS like Darcs, git or Mercury rather than an old-fashioned centralized VCS like Subversion or CVS), but you should definitely use one.
I fully agree.
Tord Romstad wrote:
- Never try to do something difficult! C and C++ are very low-level languages, and using them to do something difficult is asking for trouble. When you are faced with some difficult problem, leave your computer, sit down with pencil and paper in your favorite park or café, and work out how to decompose the difficult problem into tiny and trivial sub-problems. Afterwards, go home and code your solutions to these trivial sub-problems. This approach gives you much clearer and less buggy code than if you just try to attack the difficult problems head-on, and saves you a lot of time in the long run. An additional advantage is that you get a chance to be away from your computer for a while.
I fully agree, although sometimes I find myself breaking that rule
Tord Romstad wrote:
- A related point: Don't debug! If your code doesn't work, and it isn't easy to see precisely what is wrong, it's a sure sign that it is too complex. Discard the old code and replace it with something simpler and clearer.
Here I can agree partially only. A powerful runtime debugger (e.g. the one of Visual Studio), used efficiently (depends on the developer's level of experience), may save a huge amount of development time when trying to find very stupid bugs in very simple code. You are right of course when the root cause of problems is code complexity but I'm quite sure there are many of these stupid bugs around in everyone's code which are not found by reading the source again and again, so you must debug somehow in this case.
I also learn quite a lot from finding my own bugs, which would be impossible when throwing away the code which contains an unknown bug.
Sven