Jonathan Blow on C++ and JavaScript

Поділитися
Вставка
  • Опубліковано 30 вер 2024
  • Support me on Ko-fi: ko-fi.com/jona...
    Jonathan Blow C++ and JavaScript
    Clip from Jonathan Blow
    Twitch: / j_blow
    UA-cam: / @jblow888
    #jonathanblow #gamedev #webdevelopment #programming #cpp #javascript

КОМЕНТАРІ • 132

  • @Dr.UldenWascht
    @Dr.UldenWascht 6 місяців тому +39

    A 1 minute opinion piece by JB that has a clear beginning, body and a conclusion. I'm ready to pass on to the great beyond. I've seen everything.

  • @anispinner
    @anispinner 6 місяців тому +20

    Now imagine how much people don't understand when GPT is writing their code.

    • @mjthebest7294
      @mjthebest7294 2 місяці тому +5

      The best of the best... GPT itself doesn't understand its code neither.

  • @awesomegamer31
    @awesomegamer31 6 місяців тому +60

    this guy has a an opinion on everything and keeps popping up in my recommendeds to let me know about it...

    • @captainfordo1
      @captainfordo1 6 місяців тому +14

      And somehow you keep watching.

    • @UnidayStudio
      @UnidayStudio 6 місяців тому +2

      Fun fact: him itself don't know about any of those videos. Random blow fans just record him talk on his streams and uploads it. I love it!

  • @bruterasta
    @bruterasta 6 місяців тому +65

    But in C++ you're not forced to rely on magical stuff that is doing mysterious stuff with memory. You can take control without hacks by builtin mechanisms dedicated for that purpose.

    • @miikavihersaari3104
      @miikavihersaari3104 6 місяців тому +8

      True, but writing idiomatic C++ still means you need to adhere to at least RAII, which will make it harder to manage memory efficiently. Adding any additional rule to follow means having an extra constraint, which always has a cost that needs to be considered.

    • @pretro6136
      @pretro6136 6 місяців тому +5

      you still do, it's not at the same level as javascript, but with the way OOP works and how the std library works, it could be considered awful compared to a large c program

    • @Mallchad
      @Mallchad 6 місяців тому +5

      Yes but then you're forced to rely on awkward and weird compiler magical stuff instead :)

    • @bruterasta
      @bruterasta 6 місяців тому +12

      @@miikavihersaari3104 True. But you're not forced to use idiomatic C++ either. Also RAII does not mean "delete memory" at the end of the scope, it can easly be used as "I don't need this scratch memory anymore" signal to whatever memory management system you need underneath. Without hacks. All features are optional and you can always defer to C if you need.
      I know C++ is missed opportunity in native languages evolution but I feel like sometimes our disappointment clouds our judgement. Like, I can easly point to objectively bad design decisions that actually make it extra hard to do the right thing (ex. signed types overflow UB), but memory management is not that bad.

    • @miikavihersaari3104
      @miikavihersaari3104 6 місяців тому +2

      @@bruterasta True again, and well said 🙂

  • @yapdog
    @yapdog 3 місяці тому +2

    I don't always agree with JB, but on this we are absolutely congruent. For nearly the past 2 decades, I've been developing an OS or Creators. It's nearly 10 megabytes of code. All in C.

  • @FoxFavinger
    @FoxFavinger 6 місяців тому +13

    I’m learning C and JS at the same time. I’m probably gonna wind up making money with JS, but C is more fun and transparent.

    • @yapdog
      @yapdog 3 місяці тому +2

      But if you *master* C, you could make many times what you'd make with JS.

    • @sadiulhakim7814
      @sadiulhakim7814 2 місяці тому +2

      I am a Java developer and already making money. But i want to learn some low level stuff. But a bit confused aming c, rust, go etc.

    • @FoxFavinger
      @FoxFavinger 2 місяці тому +2

      @@yapdog I’m not mastering C lol. I’m learning to code at 34 🤣 But I agree with you. I’m also in sales and SEO, so hopefully I’ll still make more than a JS developer.

    • @yapdog
      @yapdog 2 місяці тому +1

      @@FoxFavinger You're still a baby--I'm damn near twice your age😞 Enjoy your youth😁!

    • @mrhotpockets23
      @mrhotpockets23 Місяць тому

      @@yapdog How about me. I'm 19.

  • @SL3DApps
    @SL3DApps 6 місяців тому +8

    I sort of agree and disagree with Jonathan on this statement. What makes a complicated system unmanageable is more of the lack of code safety features than fancy automatic memory management. You can always refactor code that causes memory problems but if you do that in a language that lacks code safety you will just introduce more and more bugs to the point of losing control over your program.

    • @FilipCordas
      @FilipCordas 5 місяців тому

      It's just a bad point not the maintenance but relaying on 'magical' things. C++ has a ton of stuff you don't control so does c if you wanted to control everything you would right machine binary and that's impossible.

  • @CEOofGameDev
    @CEOofGameDev 6 місяців тому +3

    BASED. never agreed with a Jon blow opinion more in my life!

  • @LyubomyrSemkiv
    @LyubomyrSemkiv 5 місяців тому +2

    In C++ I can rely on rule of 5. I can just check that class properly manages resources and use this fact for reasoning. C I cannot do this and need to track everything. So I would say that this is quite an opposite in regards to big C codebase vs big C++ one. JS is a disaster, I agree.

    • @llothar68
      @llothar68 5 місяців тому

      To do, this you have e to use smart pointers everywhere

    • @LyubomyrSemkiv
      @LyubomyrSemkiv 5 місяців тому

      @@llothar68 you clearly don’t understand what I’m talking about.

  • @llamasarus1
    @llamasarus1 2 місяці тому

    He's going for the strawman, assuming that developers who used managed languages are barred from access of knowing how their GC and development environment handle memory, or that it's too arcane to understand to be able to work with optimally. Probably true for some, but not as a generalization. I guess the keyword is "complicated", but there's flexibility in defining that.

  • @jaron_yankey
    @jaron_yankey 6 місяців тому +2

    Dude making a 58 second video feel like 5 minutes.

  • @drtransistor
    @drtransistor 6 місяців тому +10

    The golden middle is to use C++ with templates, consteval and destructors, but without RTTI, exceptions, STL and all the "modern" garbage.

    • @sporefergieboy10
      @sporefergieboy10 6 місяців тому +3

      The only feature C++ has that I’m jealous of is platform atomics tbh.

    • @kordanot
      @kordanot 6 місяців тому +1

      So pretty much JAI

    • @bruterasta
      @bruterasta 6 місяців тому +2

      Non memory allocating parts of STL are usually useful. std::array is also fine even though it allocates memory. However I totally get it why people wouldn't want to deal with STL's template centric complexity.

    • @u9vata
      @u9vata 6 місяців тому +1

      @@kordanot except that RAII is actually useful and I think JAI will not get it. However I would really love to play with JAI a bit ;-)

    • @desertdude540
      @desertdude540 6 місяців тому

      ​@@u9vata RAII is bad because it makes resource acquisition look like a normal local variable declaration. Normally, if you have a variable declared within a loop, and you need to refer to its last value outside that loop, you can just move the declaration outside the loop. RAII breaks this, because now a local variable declaration might lock and unlock a mutex or open an close a file, and moving the declaration to a broader scope can result in deadlock or running out of available file descriptors. I think C++ should abandon RAII and adopt something like Python's context managers, adding an abstract class that looks something like this:
      template
      class std::resource {
      public virtual ~resource() = 0;
      public virtual T acquire() = 0;
      public virtual release(bool exited_by_exception) = 0;
      };
      And then adding a new resource acquisition control construct like Python's with statement. I haven't kept up with the latest standards, but I think using currently can't have an open parenthesis immediately following it, so the syntax could be something like this:
      using (Lock(mutex)) { /* ... */ }
      using (auto r : SomeResource()) { /* ... */ }

  • @limarchenko96
    @limarchenko96 6 місяців тому +12

    Pascal is the best programming language

    • @enis7x
      @enis7x 6 місяців тому

      *Turbo Pascal

    • @ar_xiv
      @ar_xiv 6 місяців тому +2

      Odin and jai both have some pascality to them

    • @vitalyl1327
      @vitalyl1327 6 місяців тому +2

      Not since it was superseded by Oberon.

    • @delibellus
      @delibellus 6 місяців тому

      ​@@vitalyl1327 I'm very interested in Oberon, Wirth's reaction against C++

  • @pretro6136
    @pretro6136 6 місяців тому +21

    absolutely true. when someone calls js a toy language, this is what they mean. i'm using js rn in one of my projects, and i could never imagine writing backend code using it. not because it would be complicated to start, but because it would be far too complicated to create a full on system for every action. for example, if i wanted to create a static JSON server for the backend, on rust (the current backend language), it took 30 minutes, and it can now handle async requests and handle most situations i would come across, and i can also change it if needed. in javascript, it would take 1-10 minutes to create the same thing, but if i ever needed to change anything, i would be unable to change it since i would be relying on js's json for everything

    • @nou4605
      @nou4605 6 місяців тому +11

      Nah you just don't know how to use JS. I have worked on multiple large scale backends built on node. They work fine.

    • @pretro6136
      @pretro6136 6 місяців тому +1

      @@nou4605 maybe, but what i'm saying is not that it's impossible to write backend js code, but that code will be way more difficult to write compared to another language

    • @turolretar
      @turolretar 6 місяців тому +3

      Node is perfectly fine and typescript can be really good as a type system. I think we should look at JS ecosystem as a stepping stone towards better programming experience.

    • @PRIMARYATIAS
      @PRIMARYATIAS 6 місяців тому +2

      Golang is actually a good middle ground for server side applications.

    • @youtubeenjoyer1743
      @youtubeenjoyer1743 6 місяців тому +9

      @@turolretar Typescript is the funniest and most tragic pice of software i've ever seen. Imagine spending billions of full-time corporate man-hours in an attempt to make a very bad programming language slightly less bad, and then fail hard. Sad!

  • @zombi1034
    @zombi1034 6 місяців тому +1

    That’s why I only code in Java

  • @seifzeghichi
    @seifzeghichi 3 місяці тому

    Prove it

  • @southgonholditdown
    @southgonholditdown 6 місяців тому +4

    Displaying hello world with electron is NOT easy, what is he talking about?

    • @Salantor
      @Salantor 6 місяців тому +7

      Man, imagine being able to just build desktop app with JS in less than 5 minutes, instead of fighting with electron api...

  • @isuckatthisgame
    @isuckatthisgame 6 місяців тому +1

    What's harder, game development or system programming?

    • @Dystisis
      @Dystisis 3 місяці тому +1

      Isn't game development(programming) a form of systems programming?

    • @yapdog
      @yapdog 3 місяці тому +1

      @@Dystisis Depends on the chosen architecture. If you're building on top of an existing (robust) game engine, the system part of the work is mostly done for you.

    • @charlieking7600
      @charlieking7600 Місяць тому +1

      System programming. Gamedev is mainstream and has ready solutions for everyone (Unity, Unreal with their asset stores).
      In system programming you always reinvent the wheel to make it more safe and effective. You can't "cheat" like in gamedev.

  • @maxwellwellman
    @maxwellwellman 5 місяців тому

    if it's harder then i guess you should respect people who write JS more so than berate them

  • @Leonhart_93
    @Leonhart_93 6 місяців тому

    The mistake he is making here is equivalating JS the language with the JS frameworks that come out like mushrooms after the rain. Those frameworkds are as simple or as complicated as the creators want them to be. But JS alone is quite versatile, you can create basically anything with it.

    • @Theonewhowantsaname
      @Theonewhowantsaname 6 місяців тому +4

      The ability to create anything with a language just means it’s Turing complete, which tons of things are. That says nothing about how good of a choice that language is for a large project.

  • @Kknewkles
    @Kknewkles 6 місяців тому +5

    Are there ANY sizable, complicated JS programs out there? Ever?...

    • @empireempire3545
      @empireempire3545 6 місяців тому +18

      unfortunately there are...

    • @lekretka
      @lekretka 6 місяців тому +1

      For example, variety of front-end frameworks...

    • @gruntaxeman3740
      @gruntaxeman3740 6 місяців тому +1

      Sure.

    • @h.hristov
      @h.hristov 6 місяців тому +7

      Google Maps / Google Earth?

    • @remsee1608
      @remsee1608 6 місяців тому +3

      lots of JS games out there

  • @gracjanchudziak4755
    @gracjanchudziak4755 5 місяців тому +1

    So why he used to use a C++ instead of C?

    • @llothar68
      @llothar68 5 місяців тому

      Because APIs are

  • @RedionXhepa
    @RedionXhepa 6 місяців тому +2

    Why arent you programming in bits ? You are not understanding what individual bits are doing.That can make you confused ...
    Javascript is bad, C++ might not be the best but I dont see how C is better 😮

    • @nates9778
      @nates9778 6 місяців тому +1

      C is simple... Remember what Thomas the Tank Engine says: "Simple is better".

    • @the_original_dude
      @the_original_dude 5 місяців тому +3

      "what individual bits are doing"
      do you even know what you're saying?

    • @RedionXhepa
      @RedionXhepa 5 місяців тому

      I hope you got the irony 😃 (apparently you did not) . I am qualified enough to know what I am saying ( both academically and professionally).

    • @the_original_dude
      @the_original_dude 5 місяців тому +1

      @@RedionXhepa yeah, I'm sure you are

  • @PRIMARYATIAS
    @PRIMARYATIAS 6 місяців тому

    Odin and Zig are the new shiny players in this field….

  • @KimTiger777
    @KimTiger777 6 місяців тому +2

    One thing I don't understand is why people think coding with HTML/CSS/JavaScript is the way to go, when I would rather build a server in C with SSL library and then just generate output HTML/CSS/JavaScript to the user. This would making the backend more stream lined, slim and fast. In my opinion this is where the future lies using this technique.

    • @ar_xiv
      @ar_xiv 6 місяців тому +5

      Web stuff requires a lot of loose string manipulation that’s just how it is. Perl and PHP were better than where we are now imo and using C would be like going back to that but without all of the nice features those languages offered for the tasks they were designed for

    • @turolretar
      @turolretar 6 місяців тому +8

      Code a web server in c. Preferably a modern one that can do asynchronous stuff. I think you will quickly understand why

    • @KimTiger777
      @KimTiger777 6 місяців тому +2

      @@ar_xiv Well I would argue in the same manner as J.B. did with why ever bother with scripting in games, it is the same matter with having a Web code generator based on whatever objects you have in memory (strictly no need for DB like SQL etc.) and have those objects treated in the same manner as how games use ECS for game objects to do whatever they are supposed to do. Everything should be _Data Driven_ so why bother with scripting at all?

    • @KimTiger777
      @KimTiger777 6 місяців тому +2

      @@turolretarIt is basically just like making a multiplayer game server but instead handles incoming TCP packages, compute and then create a web response, finally just ship it to the client. Anyone calling themself a professional C developer can do this. Making a basic HTTPS server can easily be done in under 15 minutes, then just iterate with whatever requirement the company needs for its web service. Building your own libraries in C is a multiplier here, essential for making stuff faster.

    • @ar_xiv
      @ar_xiv 6 місяців тому +1

      @@KimTiger777 a traditional database is a lot closer to an ECS than you might think. Definitely a lot closer than however js devs store data

  • @LeChuck.x17
    @LeChuck.x17 6 місяців тому +1

    Love TypeScript and Golang, I don't need anything else 🤑 :)

  • @remsee1608
    @remsee1608 6 місяців тому

    In HTML/js/css a hello world is literally writing the words Hello World

    • @Leonhart_93
      @Leonhart_93 6 місяців тому

      In just HTML it's the most straight-forward, but if you actually want to write the words on the page using JS and not a console log, a few concepts knowing how to get and modify DOM elements are required. Which probably makes it the hardest approach of them all.

  • @lekretka
    @lekretka 6 місяців тому +6

    This is of course an exaggeration. High level languages will always be more productive.
    They are not as productive when you have big performance problems and it would be easier to write with C/C++ from the beginning, but that's not common case.

    • @An7Hoang
      @An7Hoang 6 місяців тому +24

      You just said "always".

    • @pretro6136
      @pretro6136 6 місяців тому +6

      the issue is that moment when you do have a performance problem. the entire reason the tech industry follows the frontend/backend system (instead of having 1 large codebase with everything combined) is that those moment when you do have performance issues or need to do a low level action are so important

    • @guilhermecampos8313
      @guilhermecampos8313 6 місяців тому +7

      Can be more productive on the beginning of a project, but it makes you lose productivity on the long run.

    • @lekretka
      @lekretka 6 місяців тому +2

      @@An7Hoang Well, I meant that they are more productive from features point of view, you can type and get stuff done faster. I do understand that there are a lot of fields when using high-level languages isn't an option, in domain of low-level systems JS, Java or Python will have productivity of 0.

    • @BoardGameMaker4108
      @BoardGameMaker4108 6 місяців тому +6

      I'm not sure if I agree. High level languages are easier to learn though. For example, Python can be very readable even to a non-programmer. That doesn't mean python is a "productive" language. You can spend a very short amount of time making something in Python but the lack of compilation and static typing inevitably leads to bugs. These bugs take time to solve. Languages like C++ are not only more performant, but the compiler can catch a lot of bugs for you before you encounter them at run-time. The productivity hit from managing your own memory is also optional, languages like Rust and C++ support smart pointers and RAII which is essentially opt-in garbage collection.
      The real issue with C++ is that it is complicated, and sometimes you just don't need the complexity. But when the complexity is useful it can be very useful.
      C is incredibly simple, you would be surprised how simple it is to program in C. Sometimes it feels limiting, and the memory errors can be annoying. But the memory errors you get in C are much like the type-based errors of the scripting languages.

  • @maximus1172
    @maximus1172 6 місяців тому +1

    For big projects Rust is the best at this point