Is this the WORST CODE I've EVER SEEN? // Code Review

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


🔗 LINKS

💰 Links to stuff I use:

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

How many times did you spot the cat? 🧐

TheCherno
Автор

Impossible. The worst code is always the code I wrote yesterday, followed closely by the code I wrote a year ago.

wowkster
Автор

About to send him the sidescrolling action-platformer I made when I was a teenager and didn't know what classes, interfaces, or lists were.
The entire game takes place in a single update function with several hundred nested if statements. Every item and enemy is its own set of variables.
It's made in Macromedia Flash MX. AlexIsCool321, you think bad code is your ally? I was born in it, *molded* by it.

skribblestyle
Автор

7:00 Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function. - John Carmack

pyajudeme
Автор

Maybe challenge that guy and send my code ?🤔

estyyt
Автор

Writing C++ with a functional style can be magical, too. I think as Cherno pointed out in previous videos, sometimes makese sense to have functions over classes

spongythecake
Автор

the bigges issue with having code running at loading time is that you can't know the order of operations, and suddenly your project breaks down because of some obscure order of operation.

oysteinsoreide
Автор

Const correctness is another thing that was missing completely. const float a, const float b etc. It does make a difference for the compiler and makes a huge difference when reading code, since you directly know what values cannot change in the function after being initialized.

Rosen
Автор

I am sort of glad I was able to come up with a similar solution to improve his code, I was definitely coding like this a few years ago, global variables, singletons everywhere...

eheh
Автор

One thing that is bothering me, and (I think) hasn't been mentioned, is how in SphereIntersect t0 and t1 are calculated for every pixel even though they are declared only in the scope of the function and not returned. So for every frame we have two operations with square roots which are fairly expensive performance-wise. In a regular raytracer we'd still calculate t0 and t1 for good reasons (which are mentioned in this video), but in this specific case there's no reason to.

harowana
Автор

This time the switch to the ad was smooth

claucirmaci
Автор

I have never seen someone refer to dx, dy, and dz as direction... usually it's delta, though I guess direction is technically correct.

mrt_
Автор

Phew, thought he'd got some of my code at first ...

davefb
Автор

Also gripe about "code quality": It's very much scale dependent, and also dependent on the skills of the maintainers.

Like the primary metric of code quality would be how quickly can you add a feature without any side effects, or how quickly you can onboard a new dev to make said changes.

When you have a sub 1k line code base, almost nothing can be considered "bad".

I have a few ~6k line files and those I would call bad code as it's the entire program in a single file and it starts to take a considerable amount of time just jumping around looking for specific things that you forgot the exact names of. You could make it "good code" by just splitting it up into different folders and files to compartmentalize what all of the different features/functions do, but that takes effort and I just never care enough to do it as I don't spend much time changing things these days.

LiveType
Автор

this is not the worst code, not the best code, this is the funniest code

oleksiistri
Автор

The math code is bad because all it is is written out vector dot products that should be extracted into a method in Vector3

yoavmor
Автор

The worst code I've ever seen was some React and NodeJS code at a previous employer. It was the worst example of over-engineering ever. Everything was so overly complex and difficult to do. Just changing a simple text label was complicated. I even argued with the tech lead about it more than once. I guess he thought the more complicated he made things, the smarter he felt as a developer. I think also it was his way of securing his job. By making the code super complicated, no one really understood it except him. But the code was very buggy, as you would expect, and just painful to work with. I eventually left after a few months.

samus
Автор

I agree that OO shouldn't be the only solution but rather a tool in the box, but in the case of a game or game engine, I feel like an object that separates out the functional bits of the program makes sense, especially when you consider that it makes it easier to run more than one at a time with ease. As for implementations of mathematical algorithms, I'd like to see some of the individual steps broken out into full-fledged functions marked as constexpr. However, I do agree on using a three piece vector to represent the data.

anon_y_mousse
Автор

"I didn't identify my member functions". Hungarian notation, one of the most pointless programming styles ever invented, particularly for strongly typed languages and especially C++ which allows you to create your variables where they are used. Plus it's 2024, every bit of information encoded into your complicated and confusing prefix is available from the IDE.

axelBr
Автор

These review vids are great! Thx for taking the time and effort to share them! 😀

coxsj
welcome to shbcf.ru