michiguel wrote:No kidding. Tord is exaggerating, but I can relate to what he says. I use pencil and paper a lot when I am at the first stages of designing a new feature. Before that I spend several spare time hours spread over several days just thinking about it. That is what happens when a programming is not your mother tongue. I do not have huge chunks of time to invest on this hobby, and hours are scattered. If I want to take advantage of those hours, I better have clear schemes of what the heck I want to write.
The more time I spend with paper and a pencil (which I like), the less I spend on debugging (which I hate and it is already a lot of time).
Yes -- I was exaggerating a little, and what you write above sums up my feelings and style of working very well. Like you, I'm not a real programmer, but a mathematician. I do have a few years of professional programming experience, but only in Common Lisp, a language which is about as far as you can get from C/C++ in terms of style of work.
There are two main reasons I can't just sit down by a computer and program in C or C++. The first is that I find the inifinite edit-compile-run-debug loop typical of C programming unbearably painful. The only way to work for me is to do all I can to make sure I never create any bugs in the first place. I try to work out everything on paper first, and only sit down and type the code when I am 100% sure everything is correct. Of course, in practice it usually turns out that it isn't correct even when I am 100% sure, but in most cases the errors are very easy to spot and fix. In the remaining cases, i.e. when something doesn't work and it is not instantly obvious
why it does not work, I take it as a clear sign that my code is too complicated, and that I should do some more pen-and-paper work and break the problem down to simpler sub-problems. I can't remember the last time I used a debugger.
The other reason is that C/C++ is too low-level to match my way of thinking. I lack the skills to write any non-trivial algorithm directly in C/C++, and I'm amazed that there are many programmers who seem to do it completely effortlessly. My approach is to first sketch everything on paper in vaguely Lispish pseudo-code, and run it through the slow and buggy pseudocode to C compiler built into my brain before typing it all on the computer.
Tord