Debugging Like A Pro

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ก.พ. 2023
  • Check out our weekly system design newsletter: bit.ly/3tfAlYD
    Checkout our bestselling System Design Interview books:
    Volume 1: amzn.to/3Ou7gkd
    Volume 2: amzn.to/3HqGozy
    Digital version of System Design Interview books: bit.ly/3mlDSk9
    ABOUT US:
    Covering topics and trends in large-scale system design, from the authors of the best-selling System Design Interview series.

ความคิดเห็น • 82

  • @anshulagrawaljbp
    @anshulagrawaljbp ปีที่แล้ว +49

    My first learning of the software industry, "you should know what you are expecting to get before hitting the run button. If you are debugging without knowing the outcome then you are wasting the time."
    It becomes important when you write new code. I have seen people write the code and validate the outcome by hitting the button.
    2nd learning, "Eliminate the possibility, especially in the prod where it is hard to debug the issue."
    3rd learning "Take a break"
    if nothing works, then collaborate (this I always choose as the last option as everyone's time is precious.)

  • @LimitedWard
    @LimitedWard ปีที่แล้ว +46

    Worst case scenario if it only works on your machine, ship the machine to the customer. Bug fixed!

    • @ahmedelgaidi
      @ahmedelgaidi ปีที่แล้ว +1

      true😂

    • @abhilashpatel6852
      @abhilashpatel6852 11 หลายเดือนก่อน

      I never dared to do so😂

    • @hdhdushsvsyshshshs
      @hdhdushsvsyshshshs 8 หลายเดือนก่อน +2

      Its called: dockerize it

    • @herroic
      @herroic 4 หลายเดือนก่อน

      Based on

  • @nekrosis4431
    @nekrosis4431 ปีที่แล้ว +24

    I solve more bugs with the imaginary mentor than with actual help, since I often use imaginary help first, and seek help if that doesn't help.
    Sleeping over it also helps me a lot, however, a coffee break doesn't help me.
    It's amazing how much you can solve, when you stop trying.

  • @timelschner8451
    @timelschner8451 ปีที่แล้ว +3

    One of the best channels on System Design. Many thanks for your excellent work!

  • @ReflectionOcean
    @ReflectionOcean ปีที่แล้ว +7

    1. Obtain as much information as possible to reproduce the problem
    2. Use Print statement to construct a timeline
    3. Comb through all the logs for clues
    4. Take a break

  • @afz902k
    @afz902k ปีที่แล้ว +22

    This is really good, but I wish you'd delve more into breakpoints and introspection tools, either language specific ones or strace/gdb/etc - perhaps for a future video?

    • @Pat315
      @Pat315 ปีที่แล้ว +1

      Honestly, that's so IDE/Language specific it's probably not worth it.
      You can easily look up a tutorial on your own. Also, nothing beats just doing it over and over.

  • @SaHaRaSquad
    @SaHaRaSquad ปีที่แล้ว +5

    I personally love using graphviz dot for debugging graph-structured data/tasks.
    The syntax is so simple you can quickly write methods for auto-generating dot code from the current state of the program, then you write that in a file and one command later you have a nicely laid out visualization. It often shows you at a glance what's wrong while finding the same issue with printing out data would be frustrating and more time consuming.

  • @plontulublalulu
    @plontulublalulu ปีที่แล้ว +8

    If you are using visual studio, it can be really helpful to set break points and then look at variable values. Go line by line to see what is happening, how variables change, the current call stack

  • @gus473
    @gus473 ปีที่แล้ว +2

    🥇 This was like friendly advice from Dad, but with excellent graphics and animation! Thank you! 😎✌️

  • @henrythomas7112
    @henrythomas7112 5 หลายเดือนก่อน

    Thank you so much for this video. Super helpful and well-presented. Your time and effort is most appreciated!

  • @bulaloitech
    @bulaloitech 8 หลายเดือนก่อน +3

    If we could debug efficiently we can write code faster. bugs/errors are basically a obstacle in a road were your cargo truck is gonna have go through, the faster we fix it, the faster we reach our destination

  • @dukecheng6400
    @dukecheng6400 ปีที่แล้ว

    雖然大學第一學期就有OOP和FP的必修 但一直沒有真正理解FP的目的 感謝!

  • @dizelvinable
    @dizelvinable ปีที่แล้ว +1

    Thank you for very useful videos!

  • @stith_pragya
    @stith_pragya ปีที่แล้ว +1

    Thank You So Much for this wonderful video...............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @gigakoresh
    @gigakoresh ปีที่แล้ว +15

    Don't forget to also add instrumentation to your app when possible. A lot of time will be saved when debugging a properly instrumented system, because there is no need to add all those logs and wait for the customer to trigger the bug again. You can prove your theory by looking at the function calls.

    • @andyl.5998
      @andyl.5998 ปีที่แล้ว +7

      What's instrumentation? Thx

    • @gigakoresh
      @gigakoresh ปีที่แล้ว +2

      @@andyl.5998 If you ask instead of googling it's probably not yet time for you to learn about that haha. But for sake of completeness - it's a framework and a cloud service that collects detailed metrics about your application runtime for inspection. Things like exceptions, function calls, heap and stack sizes, session count and so on.

    • @andyl.5998
      @andyl.5998 ปีที่แล้ว +10

      ​@@gigakoresh Thanks for the explanation! (Although the googling bit is uncalled for, it's not very conducive to normal conversation and can come off as somewhat arrogant...) Well, thanks again for explaining!

    • @gigakoresh
      @gigakoresh ปีที่แล้ว +2

      @@andyl.5998 My point was that whatever I explain here in the YT comment isn't really gonna help you understand this thing. I did not intend to come off as arrogant or anything, sorry. And if you actually felt like my explanation was helpful, and are not just saying this to be nice, then I am glad to be wrong.

    • @andyl.5998
      @andyl.5998 ปีที่แล้ว +11

      @@gigakoresh Yes, your answer was indeed helpful because it answered my question of "What's instrumentation?". You can rightly assume that whoever asked that question knew nothing about the term, hence the question.
      But assuming the asker didn't google can be arrogant. If you actually googled that term yourself, the top results had nothing to do with your helpful answer here.

  • @gabrielfuret4852
    @gabrielfuret4852 2 หลายเดือนก่อน

    great video!

  • @XxDraiNx
    @XxDraiNx ปีที่แล้ว +5

    Get help is by far the most efficient.
    How often did I write an email explaining the issue and after 80% of the email I got an idea how to solve the issue.

    • @franciskas588
      @franciskas588 ปีที่แล้ว +2

      Thats true but if you ask help too early all the time you wont improve your debugging skills.

  • @f.p.5235
    @f.p.5235 ปีที่แล้ว

    I love the get rest idea

  • @user-rv1bx8hx4v
    @user-rv1bx8hx4v 9 หลายเดือนก่อน

    Thank you! Great video

  • @YU_meineLiebe
    @YU_meineLiebe ปีที่แล้ว +2

    I just recently arrived in the data analysis world, and although it's not network engineering, but I can relate so much to this video. Thanks!! My solution so far if my codes were not working or having g bugs, was mostly closing my computer, and crying for hours.Or finishing a jar of ice cream. Or sleeping, or taking a loooong walk then sleeping. And magically some codes will work in the next day. But not always. 🥺😭😭😭😭. And I am not talking to rubber ducks, I am always talking to the trees along my long debugging walk. 😞😟

  • @wwhill8033
    @wwhill8033 ปีที่แล้ว +1

    Great stuff thanks

  • @dontesmall5784
    @dontesmall5784 ปีที่แล้ว

    Great tips !

  • @Martinit0
    @Martinit0 ปีที่แล้ว +1

    Adjacent topic suggestions:
    Logging frameworks - what they can do and what are the differences
    Application Monitoring - what they can do and what are the differences

  • @anupamgarg3590
    @anupamgarg3590 ปีที่แล้ว +4

    This is so different than Alex's other videos...more human emotions than tech logic :)

  • @BennySmith1976
    @BennySmith1976 11 หลายเดือนก่อน

    Thank you

  • @abuyusufsherakhmatov
    @abuyusufsherakhmatov ปีที่แล้ว

    Thanks for awesome video sir

  • @fullmastrinio
    @fullmastrinio ปีที่แล้ว +1

    "Works on my machine!"
    ""We will ship your machine to customers then"

  • @a.nk.r7209
    @a.nk.r7209 ปีที่แล้ว +2

    I can assure every developer that half the time you'll be using the debugging skill that you earn the hard way. This will help you do things quicker

    • @wexwexexort
      @wexwexexort ปีที่แล้ว

      I usually use print here then take a walk. xD

  • @dpokorna5
    @dpokorna5 ปีที่แล้ว

    thank you 🙂

  • @alco8864
    @alco8864 ปีที่แล้ว +6

    To own a cat is really important

  • @porroapp
    @porroapp ปีที่แล้ว +3

    take a walk saved me many times.

  • @DemPilafian
    @DemPilafian ปีที่แล้ว +2

    I won't even start looking into a bug unless a TPS report has been filed with a completed cover sheet. The cover sheet is very important.

    • @gus473
      @gus473 ปีที่แล้ว +1

      🎈I believe you have my stapler. 🤓🔥

  • @gavin8535
    @gavin8535 ปีที่แล้ว

    Yes I like print here

  • @raj_kundalia
    @raj_kundalia ปีที่แล้ว

    thanks

  • @antoineleduc7611
    @antoineleduc7611 4 หลายเดือนก่อน

    Race conditions are absolutely the worst to debug and understand what you are dealing with at first
    Had it once in my job, and it was a production only bug on top of that, fixed by adding a good old sleep 5 between runs 😂, it was an automation process in an internal tool, no user interaction once it’s set up, so it’s ok if it takes time

  • @shivananduppar1130
    @shivananduppar1130 ปีที่แล้ว +1

    Please do videos on Load balancing and. Error 404, 403, 502 bad gateway. It will be more helpful for us. Also videos on TCP, DHCP, HTTP, HTTPS.

  • @boringmanager9559
    @boringmanager9559 ปีที่แล้ว

    what sources would you recommend to read to design a low-load alibaba?

  • @jadenguyen8771
    @jadenguyen8771 ปีที่แล้ว +1

    How about debugging in microservice system during dev stage? I need to restart the service when I have changes in the code and it take like forever. My IDE is Intellij. Thanks for the tips!

  • @amitaiefrati4111
    @amitaiefrati4111 ปีที่แล้ว +3

    Thanks.
    In what video editor are you using for animations and transitions?

    • @BenGras
      @BenGras ปีที่แล้ว +1

      I’m wondering the same thing. They are phenomenal.

    • @deepaknbk
      @deepaknbk ปีที่แล้ว +1

      true , video editor and the animations are just awesome. anyone know how they are created ?

  • @in03
    @in03 ปีที่แล้ว +2

    I like writing questions on SO. Most of the time I'll realise I'm asking a poorly defined question or making too many assumptions. I often find the fix before submitting the question. Taking a break will often get me the same result if I'm just being dumb. But drafting a question is great for the complex ones.

  • @andyhall7032
    @andyhall7032 ปีที่แล้ว +4

    3:55 java errors are always null pointer exceptions. thank me later.

    • @SaHaRaSquad
      @SaHaRaSquad ปีที่แล้ว +3

      ArrayIndexOutOfBoundsException and IllegalArgumentException want a word.

  • @bibliusz777
    @bibliusz777 ปีที่แล้ว +1

    i don't agree with the possibility of always finding a cause, since compilers are often nondeterministic

  • @vmened
    @vmened ปีที่แล้ว

    Funny, Im literally didnt used debugger in java for last 10 years at all. Usually my problems related with rewriting a code due to growing requests and lack of scale capabilities.

  • @Plukh
    @Plukh ปีที่แล้ว +4

    In my experience, the most important jump in debugging skills is when you stop using the built-in IDE debugger. It's the most horrible and inefficient tool for solving actual production bugs that was ever created, but unfortunately it's also the one you'll probably be taught in your CS class or programming bootcamp. It just blew my mind when I understood that literally every other debugging technique provides at least 10x more efficiency compared to blindly stepping through the code and looking at local variables.

    • @youtubereview8176
      @youtubereview8176 ปีที่แล้ว +1

      That sounds really awesome. I'm mostly just familiar with the IDE debugger. Is there a better way to debug backend code and programs like Java?

  • @Carol-b8Carol___8ome
    @Carol-b8Carol___8ome 20 วันที่ผ่านมา

    Don't miss out on a chat with Binance's CEO about the future - exclusive interview

  • @ditsomusic
    @ditsomusic ปีที่แล้ว +1

    No hair pulling

  • @CyberMew
    @CyberMew ปีที่แล้ว +1

    All these are fine but asking for help immediately without even trying to resolve the problem by themselves not be an option

  • @pravinprabhu7295
    @pravinprabhu7295 ปีที่แล้ว +1

    The best strategy is to just start debugging, I don’t know why so much drama. What is Alex trying to say ?

  • @software_training-ck9ng
    @software_training-ck9ng 5 หลายเดือนก่อน +1

    The problem is: You talked about social techniques, like getting a pause, or talking to a duck, but you didnt explain any coding techniques to debug a code.
    Today I had to mentor another developer and mentioned clearly to comment parts of code, to lower the number of lines responsible for the problem.

  • @Parallaxxx28
    @Parallaxxx28 ปีที่แล้ว

    I thought I was the only one who uses print “here” 😭

  • @chrishabgood8900
    @chrishabgood8900 ปีที่แล้ว

    your dev machine is very different than prod server.

  • @2009Spread
    @2009Spread ปีที่แล้ว +15

    Now we can send the issue to chatGPT

    • @MrTyty527
      @MrTyty527 ปีที่แล้ว +1

      This is equivalent to emailing to an imaginary mentor. I tried it, it works.

    • @2009Spread
      @2009Spread ปีที่แล้ว +1

      ​@@MrTyty527 No, emailing to an imaginary mentor has another effect. During emailing, you move the issue from your head to "paper". After this, you can see the issue from the side. ChatGPT likes Stack Overflow but receive you only one page
      solution, sometimes the response not truly

    • @DemPilafian
      @DemPilafian ปีที่แล้ว +2

      Sending the issue to ChatGPT has the additional benefit of letting Microsoft use your buggy code to inadvertently inject bugs into the code of your competitors who also rely on ChatGPT.

  • @ethanneff9817
    @ethanneff9817 ปีที่แล้ว +26

    Get help is the most effective. All the others are just chopping trees. Understand which forest you should be in before you start chopping.

    • @nekrosis4431
      @nekrosis4431 ปีที่แล้ว +3

      I found that the imaginary mentor (explaining the problem in an email I never send for example) helps me solve a lot of problems.

    • @xslr
      @xslr ปีที่แล้ว +2

      @@nekrosis4431 indeed. That’s the idea behind the rubber duck!

    • @SacredCASHcow
      @SacredCASHcow 2 หลายเดือนก่อน

      getting help handicapped me personally. i can't learn that well from others I dont think like most people