BEST WAY to read and understand code

preview_player
Показать описание


Chapters:
----------------
0:00 - The Secret
4:04 - Example 1
10:50 - Example 2
14:48 - Example 3
16:37 - One Last Story

💰 Links to stuff I use:

This video is sponsored by Brilliant.
Рекомендации по теме
Комментарии
Автор

Thanks for watching, hope this helped! ❤

TheCherno
Автор

As my boss once said: you don't know what your program really does until you've stepped through it with a debugger. With MSVC, you can compile your code with /JMC flag, enable "Just my code" in the VS options - Debugger, and then F11 will not step into standard library functions, only into actual code of interest.

VioletGiraffe
Автор

Reading code is a skill that is learned through practice. I've been doing it for more than 30 years in C++. I also wrote a lot of FORTRAN code before learning C and C++. Code doesn't need to be hard to read. In fact if it is hard to read, it probably should be discarded, or refactored. Don't make excuses for the STL. It is hard to read, for reasons I don't fully grasp. Don't accept hard to read code as being normal. If you have to maintain hard to read code. Make it easier to read.

dougpark
Автор

Feel free to make more videos about debugging! This is full of cool stuff that I honestly didn't know about. That F10 trick is especially cool.

bersK
Автор

Thank you. Schools might teach fresh programmers about "readability" and "maintainability" when writing codes. This shows that, in fact, the "debuggability" might even be more important in real life projects. Especially when things get really big and complex.

icemojo
Автор

This is amazing. When you went into the unreal engine code, I too was like "How on earth do you read this, where do you even start from". But watching you break it down, good Lord!
Now I feel a bit more motivated.

thApostleOfShindoL
Автор

YES! so much this. I worked on a debugger in an IDE back in the day, and I can't tell you how many customers we watched struggling to find issues even in their _own_ code while completely ignoring the debugger that was available to them. And to this day you can see very experienced and talented developers on youtube wasting so much time adding a few lines of printf code here, build, run, nope, need to add some more over here, churn churn. And now the debuggers are even more powerful.

Spongman
Автор

I'm a relatively new engineer that graduated from a good school and got into a big game company thanks to that experience and I've been using a combination of your videos, several books (such as game engine architecture and modern c++) to "catch up" and learn how to work on a large software project.

hawks
Автор

Step debugging is a great idea but reading code can potentially involve a lot of prep. The more complex its interaction is with other code or the more dependent it is on timing (i.e., step debugging introduces bugs that otherwise wouldn't occur if the program were allowed to run at normal speed).

You may have to mock classes or basically apply test-writing techniques to it. You may have to write an application just to exercise the code and output what you want to observe.

IsaacC
Автор

Coming from a corporate Java project, I"m quite amazed how hard to read I find C++. The different ethos of small to no indentation, lack of curly braces and empty lines makes these already abstract and hard to grasp functions harder still to read through. I used to love C++ in college, but now I'm glad I went with Java.

Loved the multi threaded debug stuff!

ghipsandrew
Автор

You’re incredible! Thank you!

And this is simple enough for anyone with code with breakpoints or something with a profiler, whether C++, Python, C#, even GDScript in Godot has ways of putting in breakpoints like this.

I’m sure it varies based on the language how deep the call stack will give you, but it’s an excellent start.

No wonder you have learned so much lol. You’re a treasure when it comes to C++, engine creating, and just programming in general! Thank you for all the time you put into all your stuff!

I truly am gonna look into trying out Hazel but may wait until the next stable build to truly enjoy your new planned features 😊

Gredran
Автор

Imagine starting out coding by trying to read through Unreal's codebase, sure fire way to put off any beginner. Great video though, this kind of stuff is so overlooked in most youtube videos.

Azurantine
Автор

This may sound basic to some but this may be the most precious piece of advice to grow. It took me too many years to fully grasp. Read, debug, and validate with small experiment that you execute.

malstroemphi
Автор

Yan, listen. I owe you a bugfix at work now :D I was doing what I had always been doing for one particular quirk of the app where it just crashes when it can't find a certain 3rdparty lib, and you would usually just put the .dll files and a .jar file (don't ask me how an enterprise C++ app depends on a .jar, it's a long story) into a specific folder and it would work. And I was doing it the way I always do it, and it still crashed. Then I watched your video, thought "Well, why don't I try this out?". Ran the scenario in the VS debugger and it spits out "cannot find jvm.dll". Guess what, I put the path to the jvm dll into the PATH variable and it suddenly works now. I'm really annoyed at myself for not trying this out sooner :D

Thanks man, you really saved me a few days of suffering just now :D

asoulinsearch
Автор

I subscribed for c++ series. These are the videos I stayed.

killeraloo
Автор

8:33 debug => Window => parallel stack

nhanNguyen-wofy
Автор

14:50 absolutely perfect timing, I'm here waiting for UE5 to compile to try fixing the physics bugs present in their physics engine myself (at least for some temporary fixes/workarounds because it is REALLY broken) and I always struggled with fully grasping how the engine worked and somehow never really considered using the debugger this extensively for this

Flad.
Автор

Cherno has the best way of explaining things in such a way that I feel like i understand, imo

c.codyflick
Автор

When I first started programming, my brother who was working in industry told me about walking through the application to figure out how it works. This video finally gave me the appropriate context to truly understand what he meant when he said that.

MaJetiGizzle
Автор

Not quite only other peoples code but mainly knowing the language and being able to implement and design the software using design pattern and software paradigms...so studying the field really is the only way to know what you're doing and beeing able to optimize..things like red black tree structures..search algorithm..understanding big O notation and such are essential to write 'good code'.

Neolord