Here the 5 debugging tips every programmer should know! Link to the source code I used today: github.com/ykdojo/editdojo Join our community on Discord: csdojo.io/d
Пікірлер: 358
@CSDojo5 жыл бұрын
Hey guys, I recommend 1.25x or 1.5x speed if you want to get through the video quickly. Also, here’s the source code I used today: github.com/ykdojo/editdojo
@ratansingh22485 жыл бұрын
Love u sir
@veipuniilana18425 жыл бұрын
How much seconds do take to solve Rubik cube
@CSDojo5 жыл бұрын
haha I haven't solved it in a while, so no idea
@ropro98175 жыл бұрын
But if you succeeded to reproduce the issue locally, why not just run it through a debugger instead of the hassle of littering the code with print statements?
@CSDojo5 жыл бұрын
Hmm I think that's what I would've done if I was more comfortable with pdb. Since I wasn't that used to using it, I just went with printing this time - which took less learning up front.
@iRapplexD5 жыл бұрын
1. Come up with hypothesis and test it. Repeat. 2. Reproduce the problem locally. 3. Read the source code carefully. 4. Read print statement effectively. 5 Read a debugger effectively.
@bharatbommena34595 жыл бұрын
Thanks! , I was about to rewatch the video to make notes.
@ditsokar41684 жыл бұрын
6 flip out and call the computer stupid
@zabiullahs.z98673 жыл бұрын
@@ditsokar4168 Yoooo wtf I do that all the time 😅😅🤣🤣
@viewerguy102 жыл бұрын
Thanks for the recap
@ALEXEIS5 жыл бұрын
The silliest bugs are usually the most frustrating.
@ALEXEIS5 жыл бұрын
ai4k A native English speaker understands my statement.
@ALEXEIS5 жыл бұрын
ai4k Ok 👍
@Lucy-dk5cz4 жыл бұрын
Same as farts
@zerosandones75474 жыл бұрын
The ones that can make you go "this is the correct code, why is it not working?" type of bugs
@jkf16m962 жыл бұрын
@@zerosandones7547 oh boy, that feels frustrating.
@joaovfeijo5 жыл бұрын
kkkkkkkkkkkkkkk 90% of the problems a programmer faces are of this type. It was just hilarious when you said "ah.. turns out it was just a typo" xDDDDD
@xCaleb5 жыл бұрын
João Victor Feijó We need Grammarly for programming
@merazmi19715 жыл бұрын
@@xCaleb create one.
@starlord92205 жыл бұрын
:)
@FaizanAnwerAli5 жыл бұрын
Similar techniques were taught to me by my senior developer for php. Instead of importing and checking in command line you can use print_r or var_dump in php to print out every single thing a variable holds.
@lngwnd14 жыл бұрын
This was a very valuable video! I literally said "when debugging use print statements effectively" in an interview a got the job lol... Thanks for sharing!
@adarshchaudhary53625 жыл бұрын
Easiest way is to copy the error Paste it in google Open most similar stackoverflow links. Boom done!
@saifallauddin5 жыл бұрын
This is for the people who answer at stackoverflow :p
@adarshchaudhary53623 жыл бұрын
@MANISH SHARMA bhai jo bhi errors aati hain unhe bugs kehte hain. Errors/bugs ke removal wali process ko debugging
@adarshchaudhary53623 жыл бұрын
@MANISH SHARMA hn bhai.
@alimfuzzy5 жыл бұрын
Thanks. Showing your thought process is so helpful.
@zakirme5 жыл бұрын
1 missing letter and a few hours debugging made you create this awesome video. Perfect!!!
@josephgaviota5 жыл бұрын
I always enjoy CS DOJO vids; I learn a little something every time.
@Chaosman885 жыл бұрын
I have a very hard time reading other people's codes in Python. Could you make a video of you reading a brand new python code that you haven't seen before? And while you read it, you would say out loud how you think, and understand it. Would be very useful for me ! :) Do you use the debugger to understand the code? If so, that you could include that too in the code reading tutorial vid :) Or any other tool that is helpful for the purpose.
@kwii227895 жыл бұрын
That just comes from experience and seeing a lot of code. You will get it. Python language was created with readability as one of the main focuses so it shouldn't be a too much of an issue.
@Chaosman885 жыл бұрын
@@kwii22789 yeah, Python is even easier to understand than other languages, yet I still struggle reading, and understanding others code. When I need to implement a feature from zero, its not a big deal for me. But when I need to add a feature to an existing project, that someone else wrote, and its quite large already, thats a problem.. I dont even know where to start, and what to modify. So a code reading tutorial would be very nice!
@MinecraftMasterNo15 жыл бұрын
@@Chaosman88 Unless there is a reason you want to modify how a framework or library works, the only thing you should care about is what input you need to have and what is the expected output. Both of which should be in the doctring/comments if the original developer was organized enough.
@Chaosman885 жыл бұрын
@@MinecraftMasterNo1 No, I want to modify my colleague's code to add a new feature. Its a large repo with partly legacy code, and partly written by my colleagues. Nor the legacy part, nor my colleague's part is documented, and its written in such a way that is hard to decode for me. Like there is a function that does nothing but to wrap another function, that does something and call an API function, etc..
@TuanTran-og5te5 жыл бұрын
@@Chaosman88 Yeah, the two tools of the trade that I use are: 1) git blame to see the context of why a line of code was written (to fix a bug, or part of a feature, when, by whom) and 2) IDE with debugger so you could step through the code line by line while looking at all the values of all the variables (raw pdb is good, but it doesn't have a UI, too toxic to use in large code base).
@JoaoPedro-zn8bn5 жыл бұрын
Thanks YK, your videos help me not only to get better at programming, but also to improve my english listening skills!
@xiaoyu885 жыл бұрын
I would say that having a duck or a buddy to talk about it with, is the most effective way. how many times Ive went to a friend, told him about it and before he was able to respond I was like "OH RIGHT" went back and solved it. Thank you for everything you post here. youre a gem!
@sanyoun43284 жыл бұрын
Wow! So It's like to be a detector! I haven't known about debugging correctly, but you spot it on to me. Thank you Dojo!
@naveenkarthick5285 жыл бұрын
That was a pretty nice video, well done. Being a fresher in software development this can help me when I face frustrating bugss.
@tinnguyen22195 жыл бұрын
Thank you so much for this useful data ! Greatly appreciated.
@codeonmars5795 жыл бұрын
This is a nice topic, learning new things and debugging are the 2 important things for any software developer.
@lin-zchang47745 жыл бұрын
This is great! I would also say, you can get some insight from the Http Status Codes you received from printing your response variable. I think you had 403 and 401 show up, if you Google those codes I believe 403 (from your local environment) means access was forbidden, and 401 (from the server) means unauthorized. It can help you identity what's going wrong sometimes if you check out what code you're getting :)
@gustavobertocco5545 жыл бұрын
I had a lot of issues on my iOS project with the google and facebook auth... Looks easy when you get this libraries that are already for this purpose but the effort for putting everything in your project.. This is the real deal! Great video :))))
@david-nb5ug5 жыл бұрын
Great vid! Quick question, if you have a rule about print statements in production do you know of any tools that can get rid of uncommitted print statements when you commit but keep them locally so you can keep debugging?
@yashseetaram21275 жыл бұрын
I love your videos so much for the past 1 1/2 years you've helped me a lot thank you so much man you're the best and keep up the fantastic work 😃😃😃😃😃😎😍😍😍😍😋😋😋😃😃
@bryanchoong59205 жыл бұрын
Nice video quality, lighting, well decorate background and sound quality😃
@HandledRoute5 жыл бұрын
Subbed since 1k can't believe how much you progressed ^^
@CSDojo5 жыл бұрын
Thank you!!
@llittlegreyhound5 жыл бұрын
I also look at Chrome's Network tab in the dev tools to inspect the responses. Just make sure to preserve logs there and you're ok.
@bjmaldonado5 жыл бұрын
Napoleon M. I was coming in, to comment this very thing. Usually auth failures are caught by Chromes Dev Tools! Great Video tho.
@suchi193 жыл бұрын
Thank you so much for your debugging strategies.
@gordongood2 жыл бұрын
This is great! Drilling deep and not giving up is the key to being a bug fixing ninja.
@asashish9053 жыл бұрын
Loved the session. ❤️ And the ending.😀👍
@lakhtey68375 жыл бұрын
I think another way can also be to think of something different we have done in two same code base on two different environments. If we can answer to this question then it will be a lot easier to trace the issue at the very early stage. btw great video CS DOJO :)
@faisalkhan-gy5ef5 жыл бұрын
Another Helpful video from a great man...
@LeetLife5 жыл бұрын
OMG, that was so funny to look at now. But I can feel the pain of going through it. I am very happy you cracked it.
@Naz-yi9bs3 жыл бұрын
haha awesome, thank you for the video! Quick question, what's your recommendation for the best Python Debugger if your IDE is VSC? I realized your using the built-in debugger, but is that your recommendation? Thank you!
@aviadlampert59565 жыл бұрын
The print statement tip is very useful.
@szpitor2 жыл бұрын
Super useful information how to start debugging. Thanks
@tiktokers82185 жыл бұрын
You are the man inspired me
@johnadams78435 жыл бұрын
Sense you're using VScode, I think it would be helpful to create a break point on the line you want to print, right click and edit break point and click log message and type in the message there, you get the same functionality without cluttering up the code with print statement, great video also
@reemaalhamdan13 жыл бұрын
Thank you this was a super clean video!
@mikediaz9033 Жыл бұрын
Cool. Thanks. Just learning. Continue don't give up, respect your history first.
@LetsLearnWithUs5 жыл бұрын
thanks cs dojo.. its very good tips for debugging
@ratansingh22485 жыл бұрын
Such a great video sir
@user-um8hn3sd2r5 жыл бұрын
wow pdf is blowing my mind. Thanks a lots :)
@ercanciftci19075 жыл бұрын
Love your vids. Thanks !
@vivekalagarsamy73394 жыл бұрын
I would also recommend seeing following logs to understand the bug better, such as 1. Application log 2. Web server log (Apache/Tomcat/Anything?) 3. Database log (if relevant) 4. In this case it can be API Provider official error documentation page. For info on error code and its description. Which can also pinpoint what can be the issue exactly. 5. Last but not least I may be checking server logs(linux/Anything?). For instance, memory allocation issue or disk space or anything. I hope it helps
@NajibBoudjije5 жыл бұрын
Hey , thank you for the video :) i have a problem in django when I type python manage.py runserver I see this error! : ModuleNotFoundError: No module Name 'django.html' any solution?
@betheprogrammer53595 жыл бұрын
i learn from this video today thank you cs dojo
@rockyfrancisco92754 жыл бұрын
Thank you,i will always like your videos. I will learn lots of basic and tip,tricks.
@tokugeeky29315 жыл бұрын
Well like in life we miss the obvious solutions sometimes. Cool videos as always man look forward to more.
@danilocecilia78315 жыл бұрын
great tips! thank you!
@TheXxBananeroxX3 жыл бұрын
Nice video. Just curious what IDE are you using?
@nonohajar38864 жыл бұрын
thank you so much for this effort sir, but I wanna know if i follow the code will the program executes well? I mean is it ready to use if I copy & past your code? I am planning to make the same thing in my software engineering course project & I wanna be sure that it is working completely fine, coz I read the source code but could not understand =(
@jasworld96725 жыл бұрын
That was really helpful, 🎉 thanks
@moimc705 жыл бұрын
Excellent video !
@sebbes3335 жыл бұрын
*@CS Dojo* In PHP there are some "magic constants" ( php.net/manual/en/language.constants.predefined.php ) and my preferred logging method is: *print( 'Line: ' . **__LINE__** . ', in function: ' . **__METHOD__** . '(), in file: ' . **__FILE__** );* The output looks like this: *"Line: 42, in function: my_class::my_function(), in file: C:/full/path/to/file.php"* The best part is that it's super easy to remove, just search & replace with an empty string, because all these debug functions looks exactly the same but prints the information you need. Check if your preferred language also have any similar "magic constants" that you can use like this, it's super convenient.
@technicalilm89995 жыл бұрын
Pdb was new for me . Great video yk
@sonalimishra31935 жыл бұрын
what books or cousera should I choose for data analytic
@neto62304 жыл бұрын
insted of thinking i waist 4 hours debugging it would be i spend four hors learning something new. Great Video i learn a lot too
@xCaleb5 жыл бұрын
When I debug, I usually insert like a dozen breakpoints around the suspected area of the bug and step through them lol
@FelixAVargasA5 жыл бұрын
Sorry what's a break point? Thanks
@codeonmars5795 жыл бұрын
@@FelixAVargasA Place where you want your code to pause while running, so that you can inspect values.
@Loppy23455 жыл бұрын
Pro debugging tip: use emoji such as 😃when doing console logs!
@evansmith79115 жыл бұрын
Loppy2345 I’m gunna do that now! 😀😀😀
@mayrw15 жыл бұрын
Is it because it will be easier to spot it in the logs? Sorry I'm new 😅
@codeonmars5795 жыл бұрын
nice
@mayursaroj43605 жыл бұрын
I end up logging curse words..due to the level of frustration while debugging...
@aaronbell59944 жыл бұрын
It works!
@michael052420025 жыл бұрын
Nice tips. But, the last 2 tips can be entirely replaced by using an IDE debugger (for example PyCharm), to save your time to write (+rollback) print() statement and pdb commands. IDE usually have nice features like watch variables, or even "backward step into" when stopped in a breakpoint.
@vineetdhage52605 жыл бұрын
Hey man your awsm and I follow you a lot and even I’m on the way of being a programmer and thanks to you man you’ve got my back 😜😅
@NYmarlon5 жыл бұрын
Your front end design looks super nice. You did it yourself or what library did you use?
@yujinggrace85515 жыл бұрын
so intersting!good job!
@vedranjanjetovic51765 жыл бұрын
What have you been using for front-end? Which framework/template...
@AdityaMishra-ve6yu5 жыл бұрын
Keep up the good work YK😊😊
@kosmic0005 жыл бұрын
very informative thanxxxx yk
@sakshamjain79845 жыл бұрын
sir , you are a great teacher
@nicknameyu35885 жыл бұрын
it's really a good thing for us that you missed one letter when you copying the keys because this video you create after that little accident is so inspiring
@sneezygibz64035 жыл бұрын
I have an HP envy 360 17 inch but I'm getting tired of its weight. I was looking at the surface pro 6 but the Microsoft people insist on the surface book 2. What are your thoughts? Please reply. I use unity android studio a lot too
@lizzard20234 жыл бұрын
I took python las semester and the upcoming semester will be debugging.... this was extremely helpful thank you
@iamdandy24365 жыл бұрын
Hey YK, loved your videos from the Python playlist. Could you please make a same playlist on Java, JavaScript or C++ Thanks
@olaoluwadaramola68285 жыл бұрын
Damn Edit Dojo has come a long way
@ashura_amane84994 жыл бұрын
Thank you very much for sharing! ;)
@safaezeouitini2995 жыл бұрын
I love your videos . Thnx a lot
@totbot54085 жыл бұрын
Cool tips! thanks for sharing :-)
@maheswarisengodan62385 жыл бұрын
Bro can you suggest any project ideas for compiler design subject in computer science engineering
@yugioh88105 жыл бұрын
Print statements are the X factor. It works like a charm! I just spam prints at functions or if checks I suspect are the problem. BINGO problem solved.
@nusratakhiislam25235 жыл бұрын
My absolute favourite solution. Function not working? no problem, print/alert/echo. Not entering in the loop, no problem just do the bloody print 😂😂😂
@Manikandan-nr4iz5 жыл бұрын
What's the editor your are using
@gameplayet22515 жыл бұрын
I need to know something WHERE do you type code do you use an app or something
@11chosesen3min2 жыл бұрын
very good video. thank you
@TuanTran-og5te5 жыл бұрын
Great video. Just a few comments coming to minds. 1. I don't think putting in a whole bunch of logging statement is good. Firstly, it clutter your code, secondly, it's just wasteful computations that you force the software to do just to figure out an error and bring no real benefit to clients, not to mention more code == less readibility. Logging is great to keep track of what went wrong in production, then use as a starting point for trouble-shooting production issue that happened in the past. In very rare case, when you cannot reproduce locally, pushing logging statement to production so that the next time it happens, you can have a starting point. 2. The raw pdb is good if you want to debug something quick and simple (again, I dislike putting code into source code just for debugging purposes). I think the best way to debug is to use a proper IDE where you could set a break point, step through the code line by line (some debugger can allow you to go backwards, rerun a block of code multiple times, so you can see what happens), examine values of all variables on a GUI at all times. Some thing like this will do: kzbin.info/www/bejne/rWm0eaKMltJkY6s. The advantage of using a break point is that you don't have to put extra code to debug production code. In my line of work, I deal with a large C++ code base, where a full compilation takes 40 mins, partial compilation of a project might take 1-2 mins. Recompiling every-time you need a new logging statement seems inefficient. 3. Use unittest can also help keep track of bugs, if new implementation can break something already working and save you time from looking at wrong places. 4. You should also mention the legendary stackoverflow somewhere :P
@MuhammadAhmed-wh5kv5 жыл бұрын
Just awesome!
@albl68155 жыл бұрын
If yes. I have an idea. Creating an app for phone or video call. But people not use direct address, they choose theme of discussion or tips of it. For example: " students want to practice their speaking skills. Their choose an issue. let's say - crisis in cold war. They write the name of issue and write some tips like - 1. Why cold war is crisis 2. Which countries were involved. 3. ... . And if somebody interests then can join to conversation. Video call (for example) for art, painting ... And also need background with already given issues for suggestion.
@chetanputtappanavar41765 жыл бұрын
Hey, you told in your previous videos that you did a machine learning project. You mean you implemented a research paper about machine learning?
@freeassange56673 жыл бұрын
What's the steam thing for in the background?
@rishabhrawat99694 жыл бұрын
Is this the last video for this playlist? Will you be uploading more...dying to see what you do as a next step!
@SwapnilSingh4u5 жыл бұрын
Dear brother I had a very hard time in learning and understanding Django framework of python though I know python very well and I have made some good projects on web scrapings, so can u suggest any resources to clear my fear of Django coz I have followed many tutorials but failed to grasp the Django framework.
@djk125875 жыл бұрын
haha, this is so true, a lot of times the hardest bugs are caused by dumb programmer mistakes. But great video, your debugging logic is spot on.
@R_0235 жыл бұрын
Can you please tell me how I can bug bounting hunting through which website or books..
@Lecxlez5 жыл бұрын
That's insane i remember watching one of your videos when you had about 20k and now you have 700k wow
@anilraj27925 жыл бұрын
Nice video regarding debugging, but the error is funny😀
@phatminh20035 жыл бұрын
Thanks !
@not_enoughmana5 жыл бұрын
Uf. I've had this happen to me on Heroku. Environment variable misspellings strike again! Good job tracking that one down, and after it takes hours it's certain to be the first thing a lot of folks check now when something similar happens. We learn our lesson the hard way sometimes, and that's okay. :)
@bsstudy7605 жыл бұрын
NYC video, love from India
@shrihari73865 жыл бұрын
I am not kidding. I got the exact same bug while using google oauth in one of my personal projects. Missed the last "k" in the api key(I couldn't find the difference since it had a horizontal scroll to it :x). Finally found it and was so pissed off. Took me not 4 hours but almost 2 days.
@nut29755 жыл бұрын
I have been ur follower for years...and never found a useless video in your channel....keep Up ThE GoOD work......and pls do a video about kali linux vs parrot if u can
@rishushrivastav45915 жыл бұрын
what languages you used apart from java ??
@wuxinlong43515 жыл бұрын
`import pdb; pdb.set_trace()` in Python, could you please tell me how to do similar things to debug js?
@hamzayaakoubi61815 жыл бұрын
Keep it up YK
@jaehyeokchoi49375 жыл бұрын
Hi! I really enjoy your video as a freshman cs/math student. I was wondering if u were an international student like me. If that was the case, is it extra ordinarilly hard to find a sponsor for your visa as a data scientist or software engineer? Anyways thanks for the great tips man !
@indianfunfunda46225 жыл бұрын
Good explain......
@ip0x0855 жыл бұрын
i think dir() function usefull too, you can get list of valid attributes of the object