7 ms·
In school, you're always told to show your work. I'm sure a lot of us here tended to be among the smartest in your class, at least before university, and we of
by tallanvor 10y ago
In school, you're always told to show your work. I'm sure a lot of us here tended to be among the smartest in your class, at least before university, and we often thought having to show our work was silly. That's why a lot of us get tripped up when it comes to the type of debugging the author is talking about (it certainly still happens to me sometimes).
Showing our work reminds us that solving problems is an iterative work, and when we get the wrong answer, it lets us (with or without the help of the teacher) step through and figure out what we did wrong. For teachers and professors, it probably becomes second nature, and maybe they forget who explained this to them, or when they realized it themselves.
Even once we're out of school, I think we need to remind ourselves that this is the same reason we don't write a 1000 line function, rather we break it up into smaller parts, each designed to solve a specific part of the overall problem.
Now, what I really wish we had had in university was a CS course on using gdb and/or WinDbg - not just to understand how to analyze a core/dump file or step through running code, but also to help drill it into our head what compilers do to our code, and how processors really work. --It's amazing how often I have to remind people that debuggers will often lie to you, and you often have to look into the registers for the real data!
- erikpukinskis 10y agoI just think debugging is art and parcel of programming. Debugging should come up in the first practical exercise in a Graphics 101. It should come up the first time you do an ML assignment in Programming Languages. Its absence in any course is conspicuous. But at the same time more than half of the professional web developers I know don't really use a debugger. Equally problematic.
- dagw 10y agoBut at the same time more than half of the professional web developers I know don't really use a debugger. Equally problematic. I wonder how much that has to do with tooling? When programming in python I run everything in a debugger basically all the time. When doing JavaScript front-end work it's back to print debugging.
- majewsky 10y agoExactly. Have fun debugging a microservice in production. All you can do is increase the log level, and even that is sometimes not possible because the program would spew out so many logs that it would bring down either some disk or the network. In these cases, the Feynman method is sometimes all that you can apply. I have already spent plenty of hours with a stacktrace on one screen and the source code on the other screen, stepping through the source code in my mind (usually backwards from the end of the stacktrace).
- rnabel 10y agoIn many ways, the tooling around web development is far superior to other languages (e.g. golang with delve). Most browsers ship with excellent debug tools. The caveat obviously being that debugging code written using some JS frameworks, like Polymer, is a nightmare.
- senorjazz 10y agoand in many ways the tooling around web development is absolutely terrible (eg not a brand new language eg go but an established language eg any of them)
- erikpukinskis 10y agoThat's it. Declarative asset compilers like Webpack break debugging. Transpiling breaks debugging. Convention-over-configuration frameworks and tools like Ember break debugging. Other declarative APIs like promises and and virtual DOMs break debugging. PHP and JavaScripy are great for debugging. Even Node is awesome. Rails and mainstream JavaScript frameworks... not so much. Nothing about the languages.... The people who design the frameworks and build tools just don't seem to value it.
- Waterluvian 10y agoWhich is so odd to me because the JavaScript debug tools are some of the most complete and easiest to use. They're right there!
- 10y ago
- tallanvor 10y agoIs an ML course now a common part of an undergraduate degree program, though? --I genuinely don't know, which is why I'm asking. These days it would certainly be much easier to teach students how to use a debugger - most students probably aren't doing their work on mainframes anymore where resources might be limited (anyone else remember getting emails asking you to release your semaphores because the server is running low?), but professors still have to decide which topics are the most important to cover in a limited amount of time.
- OJFord 10y agoEdit: skim-read GP, got the wrong ML. I touched on the PL ML in a type systems course. I can't speak for how common it is though. It's certainly much more likely for someone who takes a course on type systems or PL theory though, presumably given that choice it's pretty common. -- > Is an ML course now a common part of an undergraduate degree programme, though? There were several available to me. It's not really a particular interest of mine, but I took an introductory course anyway, since it would have seemed a bit remiss in today's world to have graduated without knowing an NN from an SVM. Unfortunately for my grades, performance usually reflects interest... I still don't think I actually regret it though.
- erikpukinskis 10y agoYeah, I was referring to MetaLanguage, not Machine Learning.
- pjmlp 10y agoIt was to me, as a "Artificial Intelligence II" optional lectures, in the mid-90's. I rather focused on compiler design and graphical programming options instead, but I remember that all the basis for neuron learning algorithms were already part of the content.
- jnordwick 10y ago> debuggers will often lie to you, and you often have to look into the registers for the real data What do you mean by this?
- gambiting 10y agoWell I don't know what OP meant, but I work in games programming, and the PS4 debugger will frequently lie to you in visual studio. You hover over a variable and it's just giving you a completely wrong value, which is correct if you look directly into memory window or assembly view. I wouldn't consider this to be a very common use case though, it's a niche within niche.
- SticksAndBreaks 10y agoIts that way in all the niches, which makes it a set of all niches ==> mainstream thing.
- duncanawoods 10y agoOptimised C++ sure but you don't see this issue with C#. If you are using a high-level language that does not have a reliable debugger, time to change language.
- ska 10y agoOne of the things that happens here is the more static and optimized a compiler output is, the harder it is to do source level debugging. Conversely, more dynamic, less optimized languages are easier to write and verify debuggers for. This isn't a strict ordering, of course, but a general trend. Unfortunately, the very aspect that make some languages easier to debug make them poor at some of the applications you might want the former for (cf C# and c++ as you bring up). Luckily debugging is not merely the act of using a debugger !
- pjmlp 10y agoI imagine this situation might surface when looking at optimized native code, either from JIT or AOT, for example via WinDbg sos plugin for .NET. Still not a reason enough to avoid using a debugger.
- nradov 10y agoWhen I was attending Harvey Mudd College I worked on an engineering clinic team with a significant software component and was shocked to find that none of my teammates knew how to use an interactive debugger. This really slowed the team down and made the work far harder than it needed to be. At the end of the project I wrote a letter to the department head suggesting that they add a unit on debugging to the core curriculum. But I don't know if they ever acted on it.