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

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 293

  • @TheCherno
    @TheCherno  2 месяца назад +31

    How many times did you spot the cat? 🧐
    Also you can try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/TheCherno . You’ll also get 20% off an annual premium subscription!

    • @em_azh
      @em_azh 2 месяца назад +4

      wasn’t ready for class Cat : public Animal 🤣🤣

    • @irrelevant_noob
      @irrelevant_noob 2 месяца назад

      Wait, she had other cameos, besides the "class Cat : public Animal" one at 6:50? 😳

    • @mirthemw
      @mirthemw 2 месяца назад

      kitty spotted at 22:36!

  • @thePavuk
    @thePavuk 2 месяца назад +558

    Is this... a competition?

    • @Glinkis
      @Glinkis 2 месяца назад +27

      It is now 😂

    • @steffenbendel6031
      @steffenbendel6031 2 месяца назад +18

      You have not seen what I have seen.

    • @orbatos
      @orbatos 2 месяца назад +1

      Such things have been done. For one example look up "harder drives".

    • @vibaj16
      @vibaj16 2 месяца назад +3

      @@steffenbendel6031 you have not seen what I have written

    • @thePavuk
      @thePavuk 2 месяца назад

      "We have such sights to show you" - Hellriser, Cube firmware division.

  • @ferinzz
    @ferinzz 2 месяца назад +104

    another reason for the struct. Fetching data only once and stuffing as much as you can into a single cache line.
    "I like that it's not forced into OOP design for the sake of it" 20 minutes later "If I did it myself I would make it all OOP" Old habits die hard.

    • @31redorange08
      @31redorange08 2 месяца назад +3

      Or best practices die hard.

    • @thebibi78
      @thebibi78 2 месяца назад +3

      I think it depends oop is very efficient for writing applications with different components and reusing them. But you don't want to overdo it, always prefer composition instead of inheritance and try to have your classes as immuatable as possible and limits to the maximum modification of objects outside of their own classes : object should handle themselves. Mixing with functionnal is also a good idea because of immuatability. Making module for utility makes sense it avoid the verbosity of oop. And honestly it also depends on what langage you use, certains are better in other aspects than other

    • @enriquebenedicto9429
      @enriquebenedicto9429 2 месяца назад +3

      The moment I saw the code, I immediately thought: Class, RAII, Destructor. Which is what he ended up doing.
      I won't pretend I'm a c++ expert. But I tend to use simple functions which mostly gather information for initializing objects.
      I did some c code in the past, and once I fully embraced OOP in c++, I never looked back. How miserable things were. OOP and RAII. I love it.
      But I don't work for a large programming company. It's mostly solo stuff. So I might lack exposure to other code. Why I like watching his videos.

  • @pyajudeme9245
    @pyajudeme9245 2 месяца назад +91

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

    • @AdityaSharma-zn7hj
      @AdityaSharma-zn7hj 2 месяца назад +2

      But method is a function right?

    • @thenonsequitur
      @thenonsequitur 2 месяца назад +23

      @@AdityaSharma-zn7hj A method is a function attached to an object. All methods are functions, but not vice versa.

    • @AdityaSharma-zn7hj
      @AdityaSharma-zn7hj 2 месяца назад

      @@thenonsequitur thanks

    • @n00blamer
      @n00blamer Месяц назад +3

      In c++ it's "member function", c++ doesn't have "methods", but everyone knows what it means.. just being pedantic for no reason

    • @thenonsequitur
      @thenonsequitur Месяц назад +5

      @@n00blamer I didn't know that about C++, but C++ is an oddball in that respect. They are called "methods" in most OOP languages.

  • @mind.journey
    @mind.journey 2 месяца назад +60

    Honestly very good code for what it does. Bad code is unnecessarily complicated code, with useless abstractions, obscure one liners and single character variable names

    • @irrelevant_noob
      @irrelevant_noob 2 месяца назад

      Well there were some of the latter. ^^

    • @mind.journey
      @mind.journey 2 месяца назад +3

      @irrelevant_noob true 😅 but it's found very commonly in this scenario

  • @estyyt1356
    @estyyt1356 2 месяца назад +207

    Maybe challenge that guy and send my code ?🤔

    • @matsv201
      @matsv201 2 месяца назад +5

      Well. I probobly can make it worse......

    • @w花b
      @w花b 2 месяца назад +5

      ​@@matsv201 You have to do it unintentionally otherwise it's no fun

    • @matsv201
      @matsv201 2 месяца назад +5

      @w花b well. Im a really bad programer. So that is really not an issue

    • @vibaj16
      @vibaj16 2 месяца назад

      I have some really horrific code, but it's in JS.

    • @MelroyvandenBerg
      @MelroyvandenBerg Месяц назад

      😂

  • @christianlett
    @christianlett 2 месяца назад +134

    There's a distinct lack of const in this code

    • @Cinarbayramic
      @Cinarbayramic 2 месяца назад +6

      Well i dont use const too, i dont know why people use it can you explain

    • @actually_it_is_rocket_science
      @actually_it_is_rocket_science 2 месяца назад +30

      ​@@Cinarbayramictheres the idea of const as a promise. Essentially any time you create a function you const all inputs that you won't change. This means you can more easily understand how functions may impact data just by looking at the function def as const inputs won't change.

    • @TN-cx4qi
      @TN-cx4qi 2 месяца назад

      @@Cinarbayramicthere are many benefits of using constants in c++. You should google it and read up on them.

    • @nan0s500
      @nan0s500 2 месяца назад +12

      @@Cinarbayramici also found const to be completely useless concept that mostly obfuscates the code. I know what people say about const but i have never had any bug due to modifying something I shouldn't modify.

    • @TurtleKwitty
      @TurtleKwitty 2 месяца назад +11

      @@nan0s500 It happens fairly rarely for your own code it's mostly for others using your code like on a team or in a library

  • @manda3dprojects966
    @manda3dprojects966 2 месяца назад +13

    Maybe the code you said worst code made by 10 years old kid. When I was a kid, I made a ray tracing, and when I look back to the code when I'm an adult, I don't judge the code, I'm, just proud of my childhood.

  • @skribblestyle
    @skribblestyle 2 месяца назад +20

    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.

    • @AssemblyCSharp
      @AssemblyCSharp Месяц назад +1

      I remember I did the same type of stuff with minecraft plugins when I was first learning, before java I only did batch and scratch, where in scratch that's kind of how I did everything, as scratch has no objects and I never really knew how to use lists appropriately. I was effectively doing everything with just variables and functions until I learned to use lists to make cooldowns, and then later learned how to properly use classes.

  • @PythonPlusPlus
    @PythonPlusPlus 2 месяца назад +37

    I’m getting a feeling that Cherno is self reporting with this one. This is 100% the first raytracer he made on an old usb stick he found while cleaning the garage.

  • @wowkster
    @wowkster 2 месяца назад +11

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

  • @spongythecake
    @spongythecake 2 месяца назад +34

    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

    • @thewhitefalcon8539
      @thewhitefalcon8539 2 месяца назад +5

      aka procedural

    • @failgun
      @failgun 2 месяца назад +7

      I understand what you mean but "functional" typically doesn't mean "mostly uses free functions". Instead it means code that uses higher-order functions.

    • @spongythecake
      @spongythecake 2 месяца назад

      @failgun higher order, yes. And an OOP minded might fall into the trap of using invariance, objects, and state. When instead a function doing a simple data transformation is all that is required

    • @atijohn8135
      @atijohn8135 2 месяца назад

      ​@@thewhitefalcon8539 they're not the same.
      procedural programming is a paradigm in which you structure your code as a series of control flow steps that operate on variables and bundle common step sequences into procedures (functions).
      functional programming is a paradigm in which you structure your code as compositions of functions. There's no control flow or variables -- you typically don't use any kinds of loops in FP, but instead write your programs recursively or as combinations of higher order functions like map, filter, fold, zip and join among others.

    • @neartheend666
      @neartheend666 2 месяца назад

      @@thewhitefalcon8539 unless you're using Pascal

  • @simonbaxter8001
    @simonbaxter8001 2 месяца назад +21

    t0 and t1 are never actually used !

    • @twujstary1129
      @twujstary1129 2 месяца назад +9

      yea xd as the code is one can just return discriminant >= 0; but probably the author left it unfinished and t0/t1 were meant to be used

    • @n00blamer
      @n00blamer Месяц назад

      @@twujstary1129 yeah those are usually intersection points, when ray intersects sphere there can be 0, 1 or 2.

  • @mike200017
    @mike200017 2 месяца назад +11

    Code quality is very scale dependent. At a small enough scale, no code that works can really be "bad".

    • @Capewearer
      @Capewearer 2 месяца назад +3

      On higher scale, any code that works, isn't definitely bad.

  • @MaxRenke
    @MaxRenke Месяц назад

    bro i watched your gaming programming video 12 years ago... glad to see you're still going strong!

  • @moose-3379
    @moose-3379 2 месяца назад +4

    "class Cat : public Animal" 🤣

  • @master138
    @master138 2 месяца назад +21

    Hello, Cherno. Could you please make videos about modern CPP features such as modules, constinit, reflection (?), std::println(), views, etc...

    • @mazazaza11
      @mazazaza11 Месяц назад +1

      just watch the jason turner cpp weekly daily vids

  • @Rosen2221
    @Rosen2221 Месяц назад

    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.

  • @harowana
    @harowana 2 месяца назад +1

    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.

  • @axelBr1
    @axelBr1 2 месяца назад +3

    "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.

  • @LoulouNoLegend
    @LoulouNoLegend Месяц назад +1

    I did a game last year with a friend using SFML, a function has 56 arguments. Most functions have over 6 arguments. We were trying to finish everything fast. Help.

  • @aliyavarguluzada6123
    @aliyavarguluzada6123 2 месяца назад

    That transition to the sponsor was very smooth

  • @dct4890
    @dct4890 2 месяца назад +1

    lol, I've been trying to teach myself C++/C#, on and off, for about 30 years. I'm sure I've written the worst code you've ever seen hundreds of times. Thanks for the channel.

  • @eheh5748
    @eheh5748 2 месяца назад

    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...

  • @yoavmor9002
    @yoavmor9002 2 месяца назад +15

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

  • @LiveType
    @LiveType 2 месяца назад +4

    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.

  • @collynchristopherbrenner3245
    @collynchristopherbrenner3245 3 дня назад

    The functions are doing the work, not the classes. The classes are organizing the code and making it more readable. Classes are not needed, but they can help. Classes can also get in the way of what you want to do.
    Deconstructing classes (moving functions out of classes) should be more commonplace.

  • @davefb
    @davefb 2 месяца назад +2

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

  • @theevilcottonball
    @theevilcottonball 2 месяца назад +3

    I actually used the same GetDC trick for an image cat tool to view images in cmd. I no longer use it because I use the new windows terminal and it didn't work there.

    • @user-sl6gn1ss8p
      @user-sl6gn1ss8p 2 месяца назад

      I never knew you could do this, sounds fun

    • @theevilcottonball
      @theevilcottonball 2 месяца назад +1

      @@user-sl6gn1ss8p I kinda wish that the new pseudoconsole subsystem would not eat arbitrary escape codes, so I could install a terminal that supports sixel, iterm2 or the kitty image protocol or some cool graphics like tektronix or regis. In linux you can just invent an escape code and implement support for it in a thirdparty terminal. You want audio escape codes, sure?, You want escape codes for app specific drag n drop, why not? you want escape code for tooltips/multiple fonts/popups/vsync/custom chraracters and icpns/...? I would have many bad ideas...

    • @user-sl6gn1ss8p
      @user-sl6gn1ss8p 2 месяца назад

      @@theevilcottonball Yeah, it feels like that's what they should be for

  • @m4rt_
    @m4rt_ 2 месяца назад +7

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

  • @collynchristopherbrenner3245
    @collynchristopherbrenner3245 3 дня назад

    It seems like the best way to go is to start with just functions, then group them in classes as they make sense to you and which show to be useful. Another premature optimization improvement

  • @GenericInternetter
    @GenericInternetter 2 месяца назад

    If that's the worst code you've ever seen, then my code would literally melt you into your chair.

  • @samus33529
    @samus33529 2 месяца назад +1

    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.

  • @PetrosTotskas
    @PetrosTotskas 2 месяца назад +17

    y = y + 1 was crazy.

    • @seankayll9017
      @seankayll9017 2 месяца назад +6

      Not if you are as old as I am and learned the fundamentals of programming on a Sinclair Spectrum.

  • @JeronimoStilton14
    @JeronimoStilton14 Месяц назад

    16:06 I am not a programmer. Is there a reason that he writes b^2 as b*b? Is it a 'better' way to hand exponents? more performant? Easier to read? Easier to troubleshoot?

    • @theseventhdman
      @theseventhdman 29 дней назад

      ^ is not used for exponents. It is the bitwise exclusive or operator.

  • @Anubis1101
    @Anubis1101 Месяц назад

    Any code you write becomes the worst code ever written when you come back tonit later

  • @coxsj
    @coxsj 2 месяца назад

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

  • @anon_y_mousse
    @anon_y_mousse 2 месяца назад

    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.

  • @nexovec
    @nexovec Месяц назад

    This has so much instant fired energy in it you gotta love it. How common is it these days for people to do `using namespace Everything`?

  • @LiveseyMD
    @LiveseyMD Месяц назад

    Regarding classes in C++: almost the entire STL is built of them, so I guess people in the standardization committee know what they are doing as well as STL implementers.

  • @WutsTheBigIdea
    @WutsTheBigIdea Месяц назад

    I just wanna say, I've been learning C++ more productively. Watching these videos are seriously amazing, especially the tutorials. I don't wanna sound like those idiotic bot comments, but seriously, thank you.

  • @adamrushford
    @adamrushford 2 месяца назад +6

    It's funny how you've done like 20 of these code reviews or whatever but you never seem to get much past their entrypoints lol... why not do a code review of AlmondCore?

  • @nyolind
    @nyolind Месяц назад

    6:08 I felt this :D
    I'm a university student and I started learning code from C. Then I studied OOP and now I literally cannot think about code without classes and objects. I am now learning C++ and I have some problems in using other paradigms (maybe because even outside of coding, my mind often structure concepts in a OOP way, don't know if it makes sense).
    Does someone have any tips or resources (preferably videos) to learn other ways to code, especially in C++?

  • @simon5143
    @simon5143 Месяц назад

    My nightmare is seeing a code review video about my code.

  • @vengirgirem
    @vengirgirem 2 месяца назад

    Oh, I could send the worst calculator ever that I wrote. I'd probably win this competition for the worst code

    • @vibaj16
      @vibaj16 2 месяца назад

      my minesweeper implementation would win that competition

  • @kiarashsalehi2315
    @kiarashsalehi2315 2 месяца назад +1

    how I can run metrix calculations on gpu ?

  • @urugulu1656
    @urugulu1656 2 месяца назад +1

    he couldve also just implemented a vector multiplication function that takes to vectors to offload part of the math going on here. and if your really bothered with performance make it constexpr, static inline, or even a define do while 0 construct...
    one thing i dont think you did pick on is that the person has done all that math to calculate the points of intersection and then not do anything with them?!

  • @taureanwooley
    @taureanwooley Месяц назад

    Looks like a hacker rank challenge

  • @mrcrackerist
    @mrcrackerist 2 месяца назад +11

    C can use classes...
    just put function pointers in the struct and pass the struct with a pointer named this :P

    • @simonmaracine4721
      @simonmaracine4721 2 месяца назад +9

      Function pointers in a struct for no reason are bad for performance.
      Just use plain functions that take a pointer to the instance struct.

    • @HarshilPandey-wz4vz
      @HarshilPandey-wz4vz 2 месяца назад

      ​@@simonmaracine4721+1

    • @doodocina
      @doodocina 2 месяца назад +3

      classes aren't just function pointer containers. they have headers, vtable for inheritance...

    • @Giftless
      @Giftless 2 месяца назад

      @@doodocina u can kinda implement VTables in C, but i agree it's a pain. If you are going to do reimplement OOP, just use C++

    • @arjix8738
      @arjix8738 2 месяца назад +1

      ​@@doodocinainheritance is not a fundamental part of object oriented programming, it is an addition
      So C is an OOP language

  • @gabrax4022
    @gabrax4022 2 месяца назад +1

    please make video like OOP vs Data oriented in c++

  • @kittech_
    @kittech_ 2 месяца назад

    hey i have question, do you check other languages than c++? like c, rust, java etc

    • @cydeYT
      @cydeYT 2 месяца назад

      It is zoomit

  • @cokecamilo
    @cokecamilo 2 месяца назад

    I was pretty sure my code made it out in the wild when I read the title

  • @roberthoople
    @roberthoople 2 месяца назад +1

    @6:50 I only learned OOP about 3.500000001 years ago, but once I finally wrapped my head around it, I went absolutely balls-to-the-wall with it, and yeah, for at least 2 of those years: "everything had to be a class."
    Since then, I think I've begun to find a good balance with it. Many things I create are still classes and objects, because it just makes organizational sense in the right places, but I have gone back to a more "functional" form with other things. Usually, I find, that once I've started writing some convoluted inheritance nonsense to solve a problem, I have to take a beat and ask myself if this problem is best solved with OOP. Lots of times OOP really is the best option, but plenty of times, it's really is not.

  • @xxlordxx6862
    @xxlordxx6862 Месяц назад

    The worst code he's seen? He apparently never heard of Yanderedev before.

  • @aurinator
    @aurinator 2 месяца назад

    Pre-Increment vs. Post-Increment Operators in For loops preference??

  • @z1qqurat
    @z1qqurat Месяц назад

    It is not the topic but a few about premake:
    it looks like comfortable but it can't link static libs((( I tried it to build SFML-project with static libraries, and it returned me mistakes with wrong runtime between project and libs, while CMake linked this project successfully, and I couldn't find the solution (but the dynamic libs were linked and worked). Premake needs revision

  • @EvanPilb
    @EvanPilb 2 месяца назад

    If that's the worst code you've ever seen. You haven't looked hard enough

  • @RasCavv
    @RasCavv 2 месяца назад

    Can someone remind me of the name of the application he's using for drawing stuff/taking notes on the screen?

  • @Teankim-q2l
    @Teankim-q2l 2 месяца назад +3

    6:50 оливка jumpscare

  • @SomeoneOnlyWeKnow.
    @SomeoneOnlyWeKnow. 2 месяца назад +4

    0:09 This would've been the funniest segue into a sponsorship from that anti-balding company that everyone was sponsored by a while ago

  • @probitj.kalita6459
    @probitj.kalita6459 2 месяца назад

    Not the worst C++ code i have seen by any stretch, i see my own code daily

  • @foppel
    @foppel 2 месяца назад

    Actually it would be an interesting video, at least for me, to see on how to make this multiplatform

  • @mmilerngruppe
    @mmilerngruppe 2 месяца назад

    16:16 he doesn't use intersection points anywhere else

  • @emreaka3965
    @emreaka3965 2 месяца назад

    when everything is a class, its awesome. love classes

  • @MoZaHo
    @MoZaHo Месяц назад

    hahaha - he clearly hasn't seen my code yet

  • @RakimMiddya
    @RakimMiddya 2 месяца назад

    How do you navigate so quickly?!

  • @stevendeans4211
    @stevendeans4211 Месяц назад

    No where close to the worst code I have ever seen. I've written worse code than that. Granted, it was almost 50 years ago when I was in high school.

  • @d1metron702
    @d1metron702 2 месяца назад

    quite interesting video, liked it

  • @FreakinfreakInfreaki
    @FreakinfreakInfreaki 2 месяца назад

    16:05 You underestimate the failure of the American education system

  • @vorpal22
    @vorpal22 Месяц назад

    How did you miss the fact that he calculates t0 and t1 in sphereIntersection and then never uses them at all?
    float t0 = ...
    float t1 = ...
    return true;
    He could have just calculated the discriminant of the quadratic equation and returned whether it was >= 0.

  • @mjthebest7294
    @mjthebest7294 2 месяца назад

    Where is the RayTracing series... :c

  • @MerrickKing
    @MerrickKing 2 месяца назад

    What happened to the raytracing tutorial series? D:

  • @TayFerret
    @TayFerret 2 месяца назад

    Putting the opening brace on the same line and then a completely blank line after it is so cringe.

  • @boing534
    @boing534 Месяц назад

    somehow thought he looked at my code, or this is a sign from youtube

  • @Saturate0806
    @Saturate0806 Месяц назад

    isn't dx dy and dz a derivative?

  • @TankTekGamesStudio
    @TankTekGamesStudio 2 месяца назад +1

    12:05 y = y + 1 is wild... Time to do y -= -1 for my next project.

    • @vibaj16
      @vibaj16 2 месяца назад

      y = y % 2 ? (y + 2) & -2 : y | 1;

  • @mohamadmansoor3933
    @mohamadmansoor3933 2 месяца назад

    Well, I am a systems engineer so I really do have the worst code full of typos and no comments and duplicates and unused variables or obsolete functions... Unnecessary design patterns and non useful logs.
    I have them all. 😅

  • @Akrob55555
    @Akrob55555 Месяц назад

    Imagine thinking this is the worst code you've ever seen. My code is at least 1 billion times worse than this.

  • @TampaCEO
    @TampaCEO 2 месяца назад

    End(); // "I don't think this even gets called 🙂🙂🙂🙂🙂
    I give him credit... he does have a hell of a good sense of humor!!!

  • @drstrangelove09
    @drstrangelove09 Месяц назад

    That was fun. I agree that that was not too bad. I have seen some HORRIBLE code!! I have asp code that I have to work with from time to time that is absolutely terrible!!!

  • @davidmcbride5357
    @davidmcbride5357 2 месяца назад +3

    At least he made something, better than me 😅

  • @NotMarkKnopfler
    @NotMarkKnopfler 2 месяца назад

    Worst code you've ever seen? Hold my 🍺 😅

  • @Kawa-oneechan
    @Kawa-oneechan 2 месяца назад

    Did you really not notice that this person is using a *console window* for *graphics output*, as a cheap way to not have to make an actual window?!

    • @vibaj16
      @vibaj16 2 месяца назад

      he did notice. It's just not _that_ bad

  • @wasteman3717
    @wasteman3717 Месяц назад

    Finally I can tell my maths teacher i used the discriminate in real life 🎉

  • @karankavatra7759
    @karankavatra7759 2 месяца назад

    Does anyone the theme cherno is using?

  • @afterthesmash
    @afterthesmash 2 месяца назад

    The code is too boring to bother with. I wrote more complex programs on a TRS-80 with 4 KiB RAM in 1977, within days of using BASIC for the first time, when I was fifteen years old.

  • @torphedo6286
    @torphedo6286 2 месяца назад

    I appreciate that you don't get hung up on minor style things and focus on functionality. It's something that always bothers me way too much and I'm trying to stop 😂

  • @solarblitzX
    @solarblitzX 2 месяца назад

    Not the worst code ever. Not enough code to even qualify for the worst code.
    All the worst code I have seen is proprietary. X_X

  • @liudasaugustinas4401
    @liudasaugustinas4401 2 месяца назад

    Not working on windows 11 :/

  • @phutureproof
    @phutureproof 2 месяца назад +9

    I don't know if its the worst code you've ever seen and I'm not about to stick around for 20 mins to find out, I prefer less bait titles

  • @medialaptop4585
    @medialaptop4585 2 месяца назад

    Is anyone going to mention the fact this that isn't ray tracing?????????? this is just normal rendering......

    • @vibaj16
      @vibaj16 2 месяца назад

      it is ray tracing. It traces rays to render the image. Normal rendering would be rasterizing triangles.

  • @steffenbendel6031
    @steffenbendel6031 2 месяца назад +1

    He did not get the point, that there is not point calculating intersection points, if you do not use the points.

    • @vorpal22
      @vorpal22 Месяц назад

      THANK YOU. I had to scroll this far down the comment section to see that I was not the only one that noticed that. How could everyone miss it?!? This is the biggest flaw of all, IMO. People obsessed with y = y + 1 and then not noticing this unnecessary computation with unused variables. He would need these to determine the closest point of intersection if this was an actual ray tracer.

  • @CompSciMathguy
    @CompSciMathguy 2 месяца назад +1

    Please continue the ray tracing series

  • @DanielLiljeberg
    @DanielLiljeberg 2 месяца назад

    y++?!?!?! Wait, your telling me that modern compilers don't waste temporary doing that anymore and I can stop writing ++y? :)

    • @-_James_-
      @-_James_- 2 месяца назад

      Technically they never really did create a temporary, even though they should have. But using the pre-increment/decrement operators is always preferable just to ensure that you're not relying on the optimiser to do its job. (And also you don't have to switch operators when using a more complex type where construction/destruction might have side effects that break optimisation.)

  • @h2w..
    @h2w.. Месяц назад

    It is not as bad if you compare it with source code of Unity or any google project.

  • @garciajero
    @garciajero Месяц назад

    can you not tell that he pushed up the code to github just for you to see , git commit messages and timestamps are irrelevant.

  • @vasiliigulevich9202
    @vasiliigulevich9202 2 месяца назад +2

    The reason to define variables outside of main is to have effectively immutable global state.

  • @eyzake
    @eyzake 2 месяца назад

    ammm quick question, i leaned (or am learning) how to code when i got 18 -19 before that it was just maths and science. now those who had done coding since they were without beards. and i had seen this pattern that after 2 decades since they started everyone becomes a greek dev (now i am 21 and hasn't beeen that much in this ape territory. i did know a bunch of languages but nothing to the degree to call myself a good one (i don't personally think i am a good programmer, other apes differ) anyway so well now i ma think of finally getting on and creating a project (give me tips like how do i actually start it- i might think of this feature and that , no i want to know how its done thanks)
    edit :
    > gawd dammmmmit, since when did youtube start to support markdown

    • @vibaj16
      @vibaj16 2 месяца назад

      *since* _forever,_ as far as I know. But it's a very limited markdown.

  • @РусланЗаурбеков-з6е
    @РусланЗаурбеков-з6е 2 месяца назад

    Is it possible to send you some code for auditing?? )))

  • @tobiazsh
    @tobiazsh 2 месяца назад

    No matter how bad your code is, mine's worse 😅