|
|
|
|
|
by Stratoscope
1206 days ago
|
|
If I were teaching someone Python, or pretty much any programming language, the first place I would start is the debugger. I would have them write a program as simple as this: x = 1
print(x)
y = 2
print(x, y)
And then instead of just running it, I'd have them step through the code, line by line, and observe both the console output and the debugger variable display.Some developers seem to think that using a debugger is a sign of weakness, or that it leads you to write bad code. I see it differently: the debugger is one of the best tools not only for debugging, but also to help you understand a complex codebase that you are jumping into. |
|
Totally agree.
In the first week of programming, students should be allowed only use the debugger (no direct runs) in every course/collage around the world. I saw firsthand how many courses/collages students struggle with logic because debugging was never introduced, and they were unaware of how to step through each line.
Another mistake that new programmers make is writing 30 lines of code and then run and lost why bugs occurring. As a rule of thumb, they should debug/run the program every 7 new lines of code.