How to learn to write effectively and without error running a program?

0 like 0 dislike
8 views
Any measures for this purpose should adhere to?

Maybe there's some good literature on this topic.

We are not talking about large projects with more of a bias towards sports programming.


Even though the program is simple and not very big, but personally I'm in the process often admit small annoying bugs. And I want to strive to ensure that the program worked as it should.


(language C++)
by | 8 views

7 Answers

0 like 0 dislike
The first thing that came to mind is C. McConnell "code complete".
But it seems to me that "the program worked as it should" — a utopia.
by
0 like 0 dislike
>but personally, I'm in the process often admit small annoying bugs
I'm sorry, but here I think no literature will help train your attentiveness, he fought with the likes of it this way — all the attention on the code
by
0 like 0 dislike
To work out for themselves their own standard of writing code to, for example,
if I thought "and here I need a loop" then once to get it fully, with all there is {} and the way that there is in your C++ is necessary, and not three hours later amplified the coding to detect that you cycle is not closed somewhere.
At the time, I found it really helped.
Well, plus drawing circuits and writing code to "paper" (it is possible in a simple lyricist) when the text I write is not in the development environment and then just compile very quickly begin to pay attention to the correctness of the code.
Plus it was very fun when he wrote (under Delphi) without a working debugger, I had checks to write himself, also helped to write better.
by
0 like 0 dislike
What you wrote utopia and the reason for neuroses on the subject that you are lousy programmer.
\r
Accept the fact that you write with mistakes. Realizing this, it is already possible to think what to do with it. For example — to write tests. To try test-driven-development. To hire a tester. Then there is the opportunity to give the product.
\r
If anybody needs a programmer who writes without error — just go away from such a customer/employer. It will just dissolve on your guilt.
by
0 like 0 dislike
You don't care about that.
What is truly important:
\r
1. To write easy to read programs
2. To detect errors on early stages
by
0 like 0 dislike
In order to avoid a "small annoying bugs" it is better to start with a minimal prototype that can be seen at a single glance and easy to test. Sometimes rapid prototyping in the international programming competitions helps to know other languages and approaches. It is very helpful to train on a typical Olympiad tasks in order to be able to implement typical algorithms with closed eyes.
\r
These recommendations worked — it is necessary to fix their mistakes, otherwise there will be good feedback and a clear picture. It requires a certain kind of discipline
by
0 like 0 dislike
I agree with wystapienie. To minimize the number of errors (up to 0 you would never bring it) need more practice.
by

Related questions

110,608 questions
257,186 answers
0 comments
28,716 users