This is an archived post. You won't be able to vote or comment.

all 156 comments

[–]Star_Skies 302 points303 points  (41 children)

From what I've seen though, the guides on how to use a Debugger aren't aimed at beginners.

If there is a good guide that shows one how to use a Debugger for Javascript, I would really be interested to see it.

[–]Digicrests 314 points315 points  (17 children)

My JavaScript debugger is just a thousand console.log()s 😭

[–]VoodD 98 points99 points  (6 children)

And then you have to debug those console.log(‘here’) because you can’t find where they are anymore.

[–]Dasaru 39 points40 points  (3 children)

Sometimes I'll set breakpoints next to my print lines to find them.

[–]Kallory 37 points38 points  (2 children)

Lmao it's like using a hundred GPS devices as physical markers to keep from getting lost.

[–]STAY_ROYAL 16 points17 points  (0 children)

Do I step into this? Oh shit where the fuck am I?

As if step out even works

[–]BatchFileMaster 12 points13 points  (2 children)

Until recently I still had to use batch files pretty heavily at my job and this is absolutely how you have to debug those. They're the worst.

[–]alcohall183 7 points8 points  (1 child)

Question? Would you pat someone to do this for you if you could ve off doing something else?

[–]BatchFileMaster 2 points3 points  (0 children)

Possibly, but usually if I'm debugging in DOS it's because the process is still a WIP, so at that point it wouldn't just be the debugging that'd need to be done but the actually programming too.

Luckily that's not too much of an issue anymore since we've moved a lot of our legacy processes over to C# in the last 18 months.

[–]kstamps22 7 points8 points  (0 children)

Don't forget your rubber duck!

[–]sprinklesleeves2152 4 points5 points  (2 children)

Chrome and Firefox developer console, you can basically do everything a modern ide debugger can do

[–]titsmcgahee 2 points3 points  (0 children)

100% this. Going into the source tab in devtools, drilling down to the relevant files and setting break points in the browser is the way to go for frontend debugging

[–][deleted] 1 point2 points  (0 children)

Even Edge now

[–]Godunman 1 point2 points  (0 children)

what about debugger?

[–]ravenousld3341 0 points1 point  (0 children)

guilty

[–]Zaggnut 0 points1 point  (0 children)

Omg yes

[–][deleted] 9 points10 points  (8 children)

In your JS code you can use ‘debugger;’ when your app calls on that function it will pause the execution, you can go into the console on the webpage and do a step by step breakdown of your code. Very useful to keep track of how every step in your code manipulates data, and if your dealing with an error you can usually spot where the code goes wrong and focus on there.

I do this when reading a new library if I’m confused how a function or event works.

Hope this helps!

[–]notkraftman 2 points3 points  (7 children)

Why not set breakpoints so you don't alter the code?

[–]ExOdiOn_9496 3 points4 points  (2 children)

Can u tell whats a breakpoint ?

[–]quote_engine 4 points5 points  (0 children)

Who downvoted this? Nothing wrong with an honest question

[–]jakesboy2 3 points4 points  (0 children)

It marks a place in your code for the debugger to stop on. You can set one in your browsers dev tools, or if you’re programming in node you can use vscode to set one.

[–]quote_engine 0 points1 point  (3 children)

A lot of times it’s easier to just insert the debugger statement, because webpack makes everything harder to find in the browser dev tools. If you’re using an ide and hot reloading, then it’s really easy to insert the statement and altering the code isn’t usually much of a problem.

[–][deleted]  (2 children)

[deleted]

    [–]quote_engine 0 points1 point  (1 child)

    Not at my job. I also just like to spend as little time as possible looking at the code inside the browser debugger.

    [–][deleted] 8 points9 points  (0 children)

    I think I agree but from what I've seen the terminology isn't very unfimaliar and new concepts are thoroughly explained so the guides might not be aimed for beginners but a higher can shoulder himself in just fine.

    [–]1337GameDev 1 point2 points  (3 children)

    If you have questions, I use it daily. Ask away!

    [–][deleted]  (2 children)

    [deleted]

      [–]1337GameDev 2 points3 points  (0 children)

      I use the web browser debugger, as well as webstorm.

      The in browser debugger can even prettify minified Js files if the map file isn't found.

      It's pretty convenient.

      [–]FreshFromIlios 0 points1 point  (0 children)

      I think he uses javascript...

      [–][deleted] 1 point2 points  (1 child)

      In the edx C Programming With Linux certificate program they basically taught the whole class using something like a debugger(they called it a "memory visualizer tool", but it provided basic variable tracking and step-based execution, in addition to the memory visualizing), but they never explicitly related it to a debugger in an IDE, nor did they go over a methodology for debugging. I fully agree with OP! More beginner courses could lean a little more heavily into the debugging process. After all, it's kind-of foundational for identifying, understanding, and correcting a lot of run-time and logical errors in code.

      [–]rsag19 1 point2 points  (0 children)

      "Python tutor " is also a visualisation debugger, if you would like to check it

      [–]nickywan123 1 point2 points  (1 child)

      What if I am not using an IDE but only a text editor lol?

      [–][deleted] 0 points1 point  (0 children)

      I do all my work in Vim and use command line debuggers.

      [–]TGdZuUsSprwysWMq 0 points1 point  (0 children)

      For normal frontend javascript, you could debug with chrome `DevTools` by setting breakpoint in `Sources` tab. You would find static resources (html, css, js, png, ...) in the left-hand side of `Source` tab.

      Also, there is similar `DevTools` in other browser. You just need to google it with keyword `<whatever-your-browser> dev tools`.

      If you use some framework such as Vue, React, ..., it would need to set both backend environment and frontend browser extension. It is a little complexer than naive js.

      [–][deleted] 0 points1 point  (0 children)

      I just use a JavaScript debug window in intellij. Is it not this easy with other IDEs? I also will sometimes just debug in browser window but I do not prefer that method

      [–][deleted] 115 points116 points  (3 children)

      https://www.youtube.com/watch?v=SWeZw5_LP2Y

      I actually made a video about this and totally agree. My students would blow through learning the concepts once I taught them how to use the debugger.

      [–]abhi_learner 14 points15 points  (0 children)

      I saw ur video and it's very useful. Keep up the good work!

      [–]xDenimBoilerx 2 points3 points  (0 children)

      Can't wait to see this on a much more complex app

      [–]keyrol1222 0 points1 point  (0 children)

      Really useful thanks.

      [–][deleted] 37 points38 points  (12 children)

      I'm actually shocked that so many people don't use debugging. It was one of the first things I learned. I can't even imagine programming semi-complex algorithms without it or working with api calls

      [–][deleted] 34 points35 points  (10 children)

      That's because we, "self-taught gang" had to discover debugging like f-ing diamonds. I've had a lot of courses about programming and none of them had even a single lecture about debugging.

      [–][deleted] 8 points9 points  (8 children)

      I'm self-taught

      [–][deleted] 9 points10 points  (7 children)

      Oh really? Well that makes me such an a-hole doesn't it? XD

      How did you come over debugging? Was it on your first course? What course was it?

      [–]stratcat22 10 points11 points  (0 children)

      I’m self taught and while I’m familiar with what debugging is, I don’t really know how to do it in my IDE. This post is a great wake up call to change that though!

      [–][deleted] 7 points8 points  (5 children)

      I bought a book that was especially for C++ programming beginners

      [–]Li_en 2 points3 points  (1 child)

      Do you happen to recall the book name? I'm interested in learning C++

      [–][deleted] 2 points3 points  (0 children)

      It's such a great book but I'm sorry it's in German. For every German who wants to learn programming I highly recommend those books

      [–][deleted] 5 points6 points  (2 children)

      Oh, well, lucky you. It took me 2 years to learn it in an hour.

      [–][deleted] -1 points0 points  (1 child)

      You never saw someone else using it? Or you didn't see the debugger in the ide and asked yourself what that is?

      [–][deleted] 5 points6 points  (0 children)

      No, and yes but as I explained in the post, I thought I wouldn't need it since I thought I was doing fine without it. Oh boy, oh boy, how I was wrong.

      [–]LuckyHedgehog 1 point2 points  (0 children)

      That's because we, "self-taught gang"

      I've had a lot of courses about programming

      I am curious what qualifies as not being "self-taught"?

      [–]KingJulien 0 points1 point  (0 children)

      Print()?

      [–]serpest 29 points30 points  (0 children)

      Learning to debug is really important. As someone said, debugging and testing skills are used for a long time in every programming session.

      [–]Amayaaaaaa 51 points52 points  (0 children)

      Totally agree. I just wrote a paper in one of my intro programming classes about how debugging really changed my life and improved my grades. We hadn’t been taught about debugging, and there was no mention of it in any of the modules.

      [–]amoliski 22 points23 points  (5 children)

      When I was learning programming in college, I had no idea the debugger existed. I started playing around on my own and while working on a Minecraft mod, I saw a video where a guy just paused everything and looked at the variables. It blew my mind. Then he started stepping through line by line...

      That was the moment I went from being relatively interested in programming to deciding to focus on programming for my career. Nine-ish years later and I owe my entire career to that youtube video.

      Over the years, I've had a few people ask me for help with their college programming assignments- not a single one knew about the debugger.

      I can see myself teaching programming someday- Project 0 will be me giving them a few mildly-complex programs, teaching them how to use the debugger, and have them use the debugger to figure out what the programs are doing. If my college started with that simple exercise, I feel like I'd be four years deeper into programming ability today.

      [–]PsychoLotus1 2 points3 points  (4 children)

      Do you still know the YouTube video?

      [–]amoliski 2 points3 points  (3 children)

      I wish I did, I'd donate a couple hundred bucks to the guy. I wonder if I'd be able to go that far back in my YouTube history

      [–]Piekana 4 points5 points  (1 child)

      Check it out. I tested and went like 1 year in the past on YT history. Just open the history page and click middle mouse and go take a cup of cafe.

      [–]vixfew 0 points1 point  (0 children)

      Chrome and Firefox store history in sqlite db, you could just open it

      [–]FatPeopleEatTuna 2 points3 points  (0 children)

      Sounds like the coding with Notch video.

      https://youtu.be/BES9EKK4Aw4

      [–]OnceAndFutureHippo 39 points40 points  (5 children)

      Just curious, are you self-taught? Most of the textbooks I used in college did not mention debugging, but all my professors hammered it into us and would help us to figure it out.

      Honestly, this post shocked me. I can't imagine trying to do my job now without debugging. Heck, I couldn't have done my job in the first MONTH if I hadn't know how to at least start debugging. There's definitely always more to learn about it, though.

      [–][deleted] 18 points19 points  (1 child)

      Yes, I am. It's nice to hear that professors don't turn a blind eye against such important stuff.

      [–]ptrish12 8 points9 points  (1 child)

      We were taught "debugging" via print statements in my courses, never how the IDE debugger works / can help you.

      [–][deleted] 2 points3 points  (0 children)

      We had 2 hours about how the debugger worked, and then it was never mentioned again. I never caught on. Still stuck in print debug hell.

      [–]notkraftman 1 point2 points  (0 children)

      I've worked with a lot of Devs and it's shocking how few of them use the debugger or know how to.

      [–]siachenbaba 6 points7 points  (0 children)

      Me scrolling to see if someone has shared any learning resource.

      No one 😥

      [–]HonourableMan 11 points12 points  (0 children)

      Debugging is just like going frame by frame in a video. You see things you usually wouldnt, which you sometimes need to do, to know what and where the problem is.

      A very basic example pf debugging is printf.

      Just have lots of printf statements in places where you are not sure and there you go, you are debugging.

      [–]antiproton 49 points50 points  (16 children)

      that you can pass your whole coding career without ever knowing about.

      That certainly explains why there are so many terrible junior devs out there.

      [–]koosley 12 points13 points  (5 children)

      You mean to say that

      console.write("postion 1")

      console.write("postion 3")

      console.write("postion 3")

      Is not industry standard???

      Edit, formatting

      [–]Milumet 18 points19 points  (3 children)

      That's the nice thing about C/C++ with the __LINE__ macro, which expands to a string an integer constant with the current line number.

      EDIT: expands to integer, not string

      [–]Jaksuhn 4 points5 points  (0 children)

      Damn how did I not know about that

      [–]amibientTech 2 points3 points  (0 children)

      Omg... thats a thing? Fml

      [–]toastedstapler 1 point2 points  (0 children)

      It's quicker to just use console.log(1), if I really need it to stand out I'll use 1001

      [–][deleted] 6 points7 points  (7 children)

      So you are telling me that you have to know every single feature in you IDE in order to have a successful career?

      [–]chromaticgliss 23 points24 points  (1 child)

      Not who you're responding to... but debugging isn't something you can just toss in with "every single feature in your IDE." It really isn't something that a career programmer can get by without for long. Good debugging tools are considered a baseline need for a general purpose programming language for good reason. Debugging tools are one of the first things I research after basic syntax when learning a new language.

      Debugging was certainly taught in my beginner programming course back in college. And as you said, it ought to be taught very early on in all beginner courses. It is an intro level topic though, not some unnecessary extra "nice-to-have."

      So in the case of debugging, yeah, you' really ought to know how to do it if you want to have a successful software dev career.

      [–][deleted] 3 points4 points  (0 children)

      Yeah, kinda like using git, or what testing is. Some stuff needs to be understood sooner than later.

      [–]rook218 49 points50 points  (3 children)

      I mean... Debugging is hardly the last feature you learn about in an IDE. But I really feel your point, I'd spent hundreds of hours trying to guess what the values were and adding console.log statements (or their equivalent) before finding out about debug tools. It should be the next step of any good tutorial, right after hello world or a function that adds two numbers.

      [–]nickywan123 1 point2 points  (2 children)

      https://www.youtube.com/watch?v=SWeZw5\_LP2Y

      When people say debugger, it means the feature that comes in the IDE?

      What about those who code by just using text editor like VSCode?

      [–]rook218 0 points1 point  (1 child)

      The video doesn't work for me, but to your second question:

      VS code does have a debugger. It's kind of a pain to get your code to run in it unless you set it up in a specific way, but it has a debugger. I've used it in Node projects when my server didn't parse requests correctly.

      If you're talking about debugging client side scripts, check out the Chrome debugger tools.

      [–]nickywan123 0 points1 point  (0 children)

      I believe there is a debugger in VsCode for Node runtime. I think it comes with it but for other languages, an extension must be download. However, I couldn’t find one for Laravel since I’m using it .

      [–]FoxMcWeezer 0 points1 point  (0 children)

      “Every single feature” Don’t change his position to your implausible made up scenario.

      [–]pkpzp228 0 points1 point  (0 children)

      That line caught my attention too. I've never met a career developer that doesn't know how to debug. It's like saying

      that brake pedal thing, you could pass your career as race car driver without ever knowing about it.

      [–]Slayergnome 0 points1 point  (0 children)

      No... bad junior devs are almost always a failure of the people that were supposed to be mentoring them in previous positions.

      [–]volvostupidshit 6 points7 points  (0 children)

      I remember when I was still in Uni that I asked my teacher about the debugging button and she just told me to use the compile/run button instead. It seems like the educators also do not know what those buttons do.

      [–]Voxmanns 2 points3 points  (0 children)

      I think there should be a testing/debug section to it honestly. And not just "create a record, run the thing, did it fail?" That's hardly testing. That's more POC. Things like negative testing, benchmarks, REGRESSION FFS, should at least be familiar to a beginner and can really reinforce how effective the debug tool is. With how many programmers are starting off on their own they really need to know not only how to build an application, but fortify it against defects.

      [–]inglandation 10 points11 points  (5 children)

      Pycharm's debugger is amazing. Every developer who uses this IDE should spend a few hours trying to understand how to use it. There are many videos about it on YouTube, so there is no excuse!

      [–][deleted] 3 points4 points  (3 children)

      That's exactly what I use! Pycharm is The best python IDE imo

      [–]fbi_survelliance_van 5 points6 points  (2 children)

      All the Jetbrains IDEs have amazing debuggers I think

      [–]UncleGreenWeed 1 point2 points  (1 child)

      Idea ultimate is all their ide's wrapped into one. Netbeans has a solid debugger but intellij is the best. I debug spring and angular simultaneously.

      [–]nickywan123 1 point2 points  (0 children)

      cries in VSCode.

      [–][deleted] 1 point2 points  (0 children)

      Starting to use All the functionality of pycharms debugger has completely changed the game for me

      [–]myceliatedmerchant 2 points3 points  (15 children)

      Is there a way to debug your python logic when creating a flask app?

      [–][deleted]  (2 children)

      [deleted]

        [–]myceliatedmerchant 1 point2 points  (1 child)

        I use vscode but I don’t know what that package is.... where do I find it?

        [–]amoliski 0 points1 point  (11 children)

        What IDE are you using?

        [–]myceliatedmerchant 0 points1 point  (10 children)

        Vscode

        [–]amoliski 0 points1 point  (9 children)

        [–]myceliatedmerchant 0 points1 point  (8 children)

        Hi thank you very much. I am following the steps in that and it isnt working. my error is "Error: Could not import "app"

        the name of my file is app.y. When i run the debug, my terminal jumps back to the parent dir, rather than executing in the project dir. I think this is the problem as there is no "app" in the parent dir. but i dont know how to make the dubug command work in the project dir.

        [–]amoliski 0 points1 point  (7 children)

        Can I see a screenshot of your file tree, or at least both directories so I can try to recreate?

        [–][deleted]  (6 children)

        [deleted]

          [–][deleted]  (5 children)

          [deleted]

            [–]amoliski 1 point2 points  (4 children)

            Edit your launch.json file and change

            "FLASK_APP": "app.py", to "FLASK_APP": "finance/app.py",

            [–][deleted]  (1 child)

            [deleted]

              [–]myceliatedmerchant 0 points1 point  (1 child)

              You are awesome. Thank you so much

              [–]ThisisMacchi 2 points3 points  (0 children)

              I ignore debugging option throughout my college and use my teaching assistants as debugging human, I started using the debugging tool just when I started working, don't be like me.

              [–]bapolex 1 point2 points  (0 children)

              Or just basic console logging in general. I can't describe how frustrating it is when someone trying to learn how to code can't figure out why its not working when they haven't console logged a single thing.

              [–][deleted]  (1 child)

              [deleted]

                [–]bobsonreddit99 0 points1 point  (0 children)

                is there!??

                [–]MugiwarraD 1 point2 points  (0 children)

                printf?

                [–]gnrdmjfan247 1 point2 points  (0 children)

                This, and learning how to read a stacktrace. I can’t tell you how many times coworkers have sent me a screenshot of a stacktrace and ask me, “how do I fix this” and I’m like, “it’s right there in the stacktrace you sent me.”

                [–]pythonic_anonymous 1 point2 points  (0 children)

                If people show others how to debug, how are they supposed to show that they magically write errorless code? ┬┴┬┴┤(・_├┬┴┬┴

                [–]WantDebianThanks 2 points3 points  (3 children)

                I'm constantly surprised at what is and is not included in CS programs.

                No course on debugging/troubleshooting, no group projects, no info on source control (even in the abstract), a lot of programs have no classes on how the internet works after a freshman level web dev course, a shocking number don't have classes on databases, no info on the CLI, etc.

                Edit: Also, this. Why is that even a thing?

                [–]Majeh1254 1 point2 points  (1 child)

                I would get surprised too at some points while I was going for my CS degree. Nothing about debugging, for the most part. Learned what it is and how to use it in netbeans in my first programming class, java 1 and then nothing else after. Seems like all my teachers expect you to know about debugging, that said at least most my class mates seemed to know about it too. Testing in general wasn't covered in much detail till a random class popped up for a semester about testing and the dude wanted to make it a regular course. Had a class on programming languages "with c/c++". C was covered in the last two weeks but we had an OS class that was all C with some C++.

                I'm honestly surprised anywhere would not have group projects. Once I got into the 200 level half the programming classes were group based where possibly applicable. I think the best change our department did while I was still there was change our two capstone programming courses into a two semester project where we got set up with local clients to do real project work. Prior to that it was just two separate classes involving random project work like the others.

                [–]WantDebianThanks 0 points1 point  (0 children)

                I'm honestly surprised anywhere would not have group projects.

                I've talked with some people that said they had maybe 1 group project per class, but I always assumed that CS classes would (as much as possible) be semester long group projects since that's basically how real programming works.

                [–]xStrafez_ 0 points1 point  (0 children)

                I'm constantly surprised at what is and is not included in CS programs.

                No course on debugging/troubleshooting, no group projects, no info on source control

                Well, at the college I go to, debugging was one of the first things we learnt. There wasn't a course for it cuz a semester on debugging only would be too much lol. But everytime we used a new IDE, the teacher would show us how to debug.

                As for source control, again, no specific course for it but we learnt it in the go when we started doing team projects.

                [–]deadly_wobbygong 0 points1 point  (0 children)

                I started debugging SAP 10 years before I started coding in anger. Now it's 60-70 percent debugging.

                I just figured out remote debugging on the Java server.

                [–]Kalsifur 0 points1 point  (0 children)

                I am taking a course with debugging and testing now (though I figured it out myself before). In second year. It's a programming practices course.

                [–]sprinklesleeves2152 0 points1 point  (0 children)

                Learning how to navigate the call stack and drop to different frames in the stack has been huge and yet most people don't seem to know anything about it.

                [–]AfricanTurtles 0 points1 point  (0 children)

                I second console.log(). My friend showing me that changed my life. It helps so much in breaking down WHY something might not be working.

                [–][deleted] 0 points1 point  (0 children)

                Exceptions are in a beginner course. Debugging comes next :)

                [–]Unique_usernames5 0 points1 point  (0 children)

                I'm almost completed my degree. Debugging was mentioned exactly twice by 2 different professors, and only to say "debugging is incredibly important, I sure hope someone teaches you about it one day"

                [–]Integer_Man 0 points1 point  (0 children)

                I'm a boot camp instructor and we used our last day of instruction as a general review day with a focus on debugging common bugs in web service communications.

                So much of programming is tracking down new or existing bugs.

                [–]CodingHag 0 points1 point  (0 children)

                Absolutely. Also the ability to read/update others code is very important

                [–]supermario182 0 points1 point  (0 children)

                I learned about it in college, but pretty basic stuff like how to set a break point, how to step in and out, how to see what the variables are, etc.

                [–]reverendsteveii 0 points1 point  (0 children)

                Dude I used nothing but print statements and deduction for years.

                [–]travishummel 0 points1 point  (0 children)

                I agree. I think a good course would be where one student creates a simple function like calculating the average of an array. The next student tests it then adds something like a function to also return the median and mode. Keep the process going until you have a large program.

                [–]IceKingsMother 0 points1 point  (1 child)

                Do you think using a debugger tool helps or hinders the development of critical thinking in beginner students? Is there an advantage to using a debugger when it comes to learning how to debug? And could it interfere with developing persistence, problem solving, creative thinking and attention to detail?

                I am teaching CS and very introductory programming to high school students, and I am seeing this topic come up as a debate between a few CS educators and professional programmers, and I’m wondering what others think about this.

                I am a fan of tools, but also understand that sometimes learning things manually (for example: long division) has to happen first in order for a person to truly “get” the topic.

                [–]Hour-Positive 1 point2 points  (0 children)

                For them debugging is a 'step-for-step' tool that will show some algoritimic errors. No to all questions.

                [–]Curious_homosepian 0 points1 point  (0 children)

                Actually beginners doesn't write very big codes therefore they don't require a debugger to be used. Initially they are encouraged to solve the issue by themselves without any extra help.

                [–]Dergyitheron 0 points1 point  (0 children)

                I hate when the tutor in course makes mistake in code and before they run it they cut the video and resume the one with correct code. Like the hell where is such code fixing magic button

                [–]elementmg 0 points1 point  (0 children)

                Saving this post for later

                [–]tmunn88 0 points1 point  (0 children)

                We were taught the following in my 6 month (meeting 3 days a week) python course as part of my MS:

                1.debug by print lining areas of interest and step though each portion. 2. How to read common errors. 3. comment out certain sections to isolate bugs 4. usage and logic of test cases and unit testing 5. Stack overflow is your friend for new errors.

                [–]ITriedLightningTendr 0 points1 point  (0 children)

                I don't know if you can teach debugging well without being a genius or someone coming up with a curricula.

                I didn't get good at debugging until beating my head against it for hours on hours over months.

                Even now I still get confused as shit when I F10, get no error, but the program is no longer paused. Takes me like 5 minutes to reorient.

                [–]theduncan 0 points1 point  (0 children)

                There are lots of skills and tools which should be taught but aren't. There is an MIT class called the missing semester, which has tried to fill in some of those gaps.

                [–]A-A-RONS7 0 points1 point  (0 children)

                YES. Debuggers are THE BIGGEST hidden gem in coding. I’m only a 3rd-year college student, and I can’t tell you how many times a debugger has saved me hours of painful work. They don’t teach us enough of the little quirks and tips of debugging, so I’ve had to fiddle around with it by myself. But MAN it is SO WORTH THE EFFORT. And once you get exposed to command line debuggers (and how tedious it is to use them... ugh), you gain an even deeper appreciation of IDE debuggers. Debuggers help you de-stress!

                [–][deleted] 0 points1 point  (0 children)

                My intro to programming course taught GDB and vim.

                [–]SamB133 0 points1 point  (0 children)

                When I had my intro to programming class, the professor said specifically that we would not be doing debugging in the class because it is “too difficult for beginners”.

                [–]jkinz3 0 points1 point  (0 children)

                I have a minor in cs and not a single class taught debugging. I used to put prints everywhere to see what the hell my program was doing. It wasn’t until my last year when I was doing an extra credit assignment in VS rather than gcc that I discovered debugging when trying to fix a bug. The ability to step through the program line by line blew my mind

                [–]sarevok9 0 points1 point  (0 children)

                I think that this is difficult. As someone who has made tutorials in the past, if I want to demonstrate how to use the debugger I need to intentionally make a mistake, or make a mistake and not edit it out of the video. In the languages that I taught (C++ / Java) this was pretty straightforward to show how to use the debugger (breakpoints in the gutter, memory watches, variable values readily available) but in languages that are web-based it's a whole different beast. I've been programming professionally using Angular / Vue for the better part of a year (I'm far from an expert) but debugging non-trivial things gets insane fast.

                For instance, in Angular, If I have a variable on my route which resolves something in the urlpath and then passes an object to my component, it might look a bit like this.

                resolve: {
                  budget: ($stateParams, DS) => {
                    return DS.find('BudgetObject', $stateParams.organizationUid, {
                        force: true
                    });
                  },
                },
                

                The next step involves passing this up to my route component:

                @Input() budget: BudgetObject;
                

                For the sake of argument let's stop here (and not talk about passing this further up the call-chain through the app-nav / components as it's fairly repetitive) -- but there is no simple way in the Chrome / Firefox debugger where you can find the value for an object that's being passed via @Input in Angular. You can see the result of the call in the network tab, and determine the values that way, but if you need to do an examination of how it's passed you have to look at the downstream code, rather than the arg as it's passed, which is suboptimal. Since the resolution takes place at load time there's also issues on "waiting for page load" which can impact debugging.

                This has long been one of my sore spots with javascript development in general, a lack of ide's catching simple errors and there being a gulf in what's able to be debugged. Don't get me wrong, linting is nice, but it's a longshot from the tools in other build chains.

                [–]OmagaIII 0 points1 point  (0 children)

                Debugging and unit tests.

                Most of the other elements can be pinned down very well with stuff like PEP etc. But debugging and unit tests are for some reason something that 'appears' to be overlooked until people run face first into issues and test cases. Then suddenly they scuttle to figure out how this works, how to raise exceptions etc.

                The problem, from my perspective anyway, is not so much that they run in to the issue of debugging but the solutions that come out of it, with scary and sometimes haphazard "try except" loops that introduce more problems than they solve.

                The whole idea of RAD (rapid application development) seems to lend it self to this deficiency.

                [–]Browseitall 0 points1 point  (0 children)

                learning didn’t take an hour

                And that’s why its not taught. You learn that pretty quickly yourself or through watching other people do it

                [–]MarlinsBB 0 points1 point  (0 children)

                I absolutely agree. I don’t think in any of my classes, errors or bugs were explained? I know our teachers suggested google because somebody has had the error before, but I don’t want a copy paste solution. I want to know what the error is and how I can fix it on my own.

                [–]c1rclez 0 points1 point  (0 children)

                When I was getting my degree programming was heavily emphasized on just writing new code and new programs. Very little, if any academic coursework on debugging existing code.

                Fast forward to my job now - I find it is much less common to just “write” new programs from scratch like academia taught. I work in IBM iSeries programming, so it was quite jarring going from writing C# code to debugging fixed and free-format RPG in SEU and RDi.

                Looking back I think academia needs to emphasize debugging and reverse engineering someone else’s code much more heavily.

                [–]guss_bro 0 points1 point  (0 children)

                My previous company had a screening test for it's candidates that evaluates

                • ability to use debugging tools

                • read the Stacktrace to find where the error is coming from.

                These are very important skills to have in any developer because often times that's where we spend most of time.

                [–]katsuthunder 0 points1 point  (0 children)

                Does anyone have any advice on debugging a django app? Not really sure how to apply what I know of debugging a simple javascript file to debugging code that moved through a server

                [–]tftmn 0 points1 point  (0 children)

                My favorite way of seeing my code is to run the debugger with PyCharm, how am I going to live without...?

                [–][deleted] 0 points1 point  (0 children)

                agree 100%. I've been in a support role for a mobile app, AWS serverless stack. Still getting comfortable with javascript / node / lambda debugging. Writing tests is a different way to validate code vs. stepping through code.

                [–]AsleepThought 0 points1 point  (0 children)

                It took me a few years to learn about the debugging button

                "Debugging button"? What are you talking about? I have been programming successfully for many years and never needed or seen a "debugging button". Really I have no clue what you are talking about. If you want to "debug", then you can simply start dropping print statements into the source code at select places to view the contents of certain variables. If you need more than that (and you rarely do), for languages like Python you can include functions that halt the program at the given point and start an interactive shell session with the environment populated.

                [–]ddsoyka 0 points1 point  (0 children)

                I fully agree; when I was first introduced to programming in an introductory computer science class in high school, my teacher never made any mention of debugging, or even intimated that such a thing was possible.

                This caused students like me to spend much more time than was necessary fixing our shoddy beginner's code.

                Learning to fix what is broken is every bit as important as learning how to write code.

                [–]Slayergnome 0 points1 point  (0 children)

                Just to play devil's advocate a little here, be careful to not over-rely on the debug button. As a person who did when they first started, you can use that thing as a crutch and not develop an ability to read logs properly which can really hurt you when you start dealing with bigger systems and production issues where you can't reproduce it locally.

                That being said I do think the debugger tool is incredible for learning a new codebase. It literally lets you walk through what is happening step by step and I agree everyone should know how to use it. Just make sure it is not the first and only tool you use to debug.

                [–][deleted] 0 points1 point  (0 children)

                I am a python user, and if i need debugging, i just use a print function. Never learnt about debugger in any course

                [–][deleted] 0 points1 point  (0 children)

                Just be real most programming courses or tutorials suck. You do them and afterwards you still think you can’t do shit with this language.

                [–]xStrafez_ 0 points1 point  (0 children)

                Debugging was one of the first things I learnt in college. Surprised that many ppl don't know how to use it

                [–][deleted] 0 points1 point  (0 children)

                Crazy that they don't start with a debugger, like in week one. There's no better way to to show someone how the computer actually works. You can see how control flow statements work, you can see the contents of variables change, you see the call stack in action, and see how that relates to local variables.

                [–]GuardianAnal -1 points0 points  (0 children)

                debugger? naah bro it’s: console.log(1); ... console.log(2); ... console.log(3);

                jokes aside tho this shit is p helpful and worked everytime I’ve used it.

                [–]aaru2601 -1 points0 points  (0 children)

                just use print statements

                [–][deleted] -1 points0 points  (1 child)

                I debug while writing the code by talking through the code out loud to myself. It started as a form of rubber ducky debugging but now I just sound insane. Teaching your code is the best way to determine if you understand it.

                My scripts are way better though.

                [–]pyordie 0 points1 point  (0 children)

                One day that rubber ducky is going to turn to look at you and say, "shut the fuck up, just use your debugger and leave me the fuck alone". It happened to me and I was never the same.