4 ms·
Ask HN: How to Teach Debugging?
I am teaching a data science class to people with little to no programming experience. The course uses Python and various ML libraries, and Docker.
I find very difficult to provide the students with a general method of debugging. I find Feynman's method ("think hard and solve it") discouraging.
Anything more step-by-step?
EDIT: typo
- acemarke 3y agoYeah, I did a talk on "Debugging JavaScript" that really is mostly language-agnostic and focuses on the core scientific method approach: - https://blog.isquaredsoftware.com/2023/06/presentations-debugging-javascript/ https://blog.isquaredsoftware.com/2023/06/presentations-debu...
- fdeage 3y agoVery interesting, thanks!
- OhNoNotAgain_99 3y ago[dead]
- dhunter_mn 3y agoLiken it to working on a crossword puzzle
- MatthiasPortzel 3y ago0. Define the intended behavior and the current behavior. 1. Come up with a hypothesis for why they don’t match 2. If you’re unable to come up with a hypothesis (“I’m sure it should work”), then that means you’re assuming something that isn’t true. Identify one of your assumptions and take it as your hypothesis. 3. Gather data until you’ve either proved or disproved your hypothesis. This can be done by designing an experiment, inspecting variable values using print statements, reading documentation, or etc. 4. With this new information, circle back to the problem. Either attempt a fix, or generate a new hypothesis and start at 1. Students, and programmers of all skill levels, get stuck at every step. Some other tips: * Ask for help only with the step that you’re stuck on. You can ask for help creating a hypothesis, but don’t ask for help gathering data at the same time. This keeps questions focused. * Be mentally prepared to run through this loop many many times until the problem is fixed.
- fdeage 3y agoThanks! It's like an extended Feynman. It also reminds me of this: https://jvns.ca/blog/2022/12/08/a-debugging-manifesto https://jvns.ca/blog/2022/12/08/a-debugging-manifesto You're right to emphasize the looping it takes to solve bugs. Many students are not prepared for this.
- sargstuff 3y ago[dead]
- sn9 3y agohttps://www.debuggingbook.org/ https://www.debuggingbook.org/
- sargstuff 3y agoUsing outlines/flowchards & data science class assignment, can setup automated tests[0][1] of common issues in order to provide more detailed feedback than python. [0] : Automated testing with python using pytest, tox, and github actions : https://www.youtube.com/watch?v=DhUpxWjOhME https://www.youtube.com/watch?v=DhUpxWjOhME [1] : Short overview of python debugging tools/techniques : https://www.linkedin.com/advice/3/what-most-effective-ways-debug-errors-your-python-8tzye https://www.linkedin.com/advice/3/what-most-effective-ways-d... https://medium.com/@yellalena/a-guide-to-debugging-python-code-and-why-you-should-learn-it-ae30d20419b7 https://medium.com/@yellalena/a-guide-to-debugging-python-co... Why logging/debugging : https://www.youtube.com/watch?v=w9JfBb0M5LU https://www.youtube.com/watch?v=w9JfBb0M5LU python ide's : https://www.datacamp.com/tutorial/data-science-python-ide https://www.datacamp.com/tutorial/data-science-python-ide https://towardsdatascience.com/practical-debugging-for-data-science-fd744c21f332 https://towardsdatascience.com/practical-debugging-for-data-... https://khuyentran1401.github.io/Efficient_Python_tricks_and_tools_for_data_scientists/Chapter6/logging_debugging.html https://khuyentran1401.github.io/Efficient_Python_tricks_and... https://towardsdatascience.com/practical-debugging-for-data-science-fd744c21f332 https://towardsdatascience.com/practical-debugging-for-data-... https://github.com/PacktPublishing/Debugging-Machine-Learning-Models-with-Python https://github.com/PacktPublishing/Debugging-Machine-Learnin... https://github.com/topics/debugging?l=python https://github.com/topics/debugging?l=python