how to never write bug

841,226
0
Published 2022-10-18
Debugging is one of the most important skills of a software engineer. Learn 7 techniques, strategies, and tools for debugging as a modern web developer.

#programming #learntocode #software

💬 Chat with Me on Discord

discord.gg/fireship

🔗 Resources

Testing in 100 Seconds    • Software Testing Explained in 100 Sec...  
VS Code Tips    • 25 VS Code Productivity Tips and Spee...  
Crash Bandicoot Bug www.reddit.com/r/Games/comments/1pp4oj/how_a_loads…

🔥 Get More Content - Upgrade to PRO

Upgrade at fireship.io/pro
Use code YT25 for 25% off PRO access

🎨 My Editor Settings

- Atom One Dark
- vscode-icons
- Fira Code Font

🔖 Topics Covered

- What tools to engineers use to prevent bugs?
- How do you catch bugs during software development?
- How do you learn debugging?
- How to use VS Code debugger
- How to console log in JavaS

All Comments (21)
  • @tex824
    "in hell the only programming language they have is java" will to live immediately restored
  • @re1konn
    "thou code shall not work" had me dying 🤣🤣
  • To stop writing bugs, become a project manager. You'll transcend logic bugs and progress to the realm of misunderstanding whole product visions
  • @Onrirtopia
    I think this fits here; "if debugging is the process of removing software bugs, then programming must be the process of putting them in" Edsger W. Dijkstra
  • Another good tip: when you get a massive amount of compiler errors, only look at the first or last error, solve that and try to recompile. This can be a huge help to keep you focused on the right thing when working in languages like C++ and C#, where 1 thing is written wrong, and the compiler keeps chugging along trying no matter how confused it gets. Most of the errors are nonsense, and only 1 needs you to fix it (which I almost always have seen to be the first or the last error).
  • @Untou4
    One of my favourite quotes, kind of fits here: "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." (c) Brian W. Kernighan
  • There are 3 things programmers struggle with: 1. Naming variables 2. Off by one errors
  • I was working on a microcontroller project and I had this strange bug that took me weeks to fix. What I learned is that the branch prediction hardware while executing assembly code was different for 2 different chips that were the exact same except for the temperature rating. I looked through the errata for the chips and nothing was documented about it. The way the bug worked was on the chip with the slightly higher temperature rating, only during specific interrupt routines, certain instructions would take 4 clock cycles on 1 chip and only 3 on another chip, making my timing-critical application take 1/3rd longer only during very specific times. I looked through everything, the oscillator, the all the different registers for controlling the clock, the oscillator calibration registers that came factory calibrated with the chip, but in the end the 2 chips acted the exact same at every other time except for in that interrupt routine. One of the few cases I've found where it was literally my chip fabricator's fault my code didn't work.
  • @xorinzor
    The biggest thing when debugging you should ALWAYS remember is: don't. assume. ANYTHING. It's when you start assuming things that you start reading over bits that will be important. If there's a really tough bug to squash, just resort to rubber ducking. It'll be worth it in the end.
  • This guy is so good at sharing info while keeping us entertained. Kudos!
  • I can't stress enough on how important the bonus tip is! There have been a lot of times when I couldn't solve some issue for days, but as soon as I took a break and went out without thinking about it and came back, I solved it instantly!
  • @shableep
    this is extremely solid advice that should be given to every entry level developer.
  • Taking a break with an issue helps a lot. I spent forever yesterday trying to determine why something wouldn't work. Took a 5 minute walk. Came back and turns out I forgot a letter.
  • @maelhagel
    One useful tip to avoid bugs, never update your IDE in the middle of a project to the latest version, some new "features" usually break your working code
  • @heron619
    Plays stock footage of Logging whilst talking about Logging. Simply genius level of content making from Fireship once again!
  • @ItzZed
    Can’t have bugs if you don’t have any code. Big brain strategy.
  • Great tips, for the first ones around googling your problem, I've used that approach for a long time but I've seen a lot of people that just straight up copy paste everything and then wonder why they haven't found anything.
  • @laxsjo.
    There was a team in a Nordic programming competetition with the amazing name of "the floor is made of Java". Just feelt the world needed to know this.