+ 3
How to avoid errors while codding ?
7 Antworten
+ 8
Avoiding is hard. For limiting them I personally find it helpful to code and test a few lines at a time.
If you write too long a piece of code in one run, let's say 100 lines, just hoping it will work, in the likely case it doesn't work you'll have to figure out the mistake reading 100 lines. That will take eternally.
So, in your mind or on paper, partition the tasks into little sub-tasks that will each only need a few lines.
Write each mini task and test it until you're sure it does what it's supposed to. Only then write the next bit.
Put the tasks into functions/methods. You test for them returning the right value for every argument you pass. If they do, when you write the other functions/methods, you can rely on the formerly written ones.
+ 16
It only comes with years of experience. But even if you are a professional programmer, you can't foresee all different scenarios. Something can easily pop up.
Great example: I watch some YouTube videos where highly experienced programmers do live-coding. Sometimes their apps / programs stop working as expected. And they spend some time trying to find this silly bug that ruins everything.
+ 7
By gaining experience, making mistakes in the first place but learning from them will help you minimize your errors in the future.
+ 4
Learn to write good unit testing using tools like Jest, Mocha, Pupperteer
+ 4
make practice man perfect
so, try to write programs as much as possible.
and one your error completely vanished
+ 2
Breakpoints
0
can you name same good youtubers from where we can learn how to code