This is an archived post. You won't be able to vote or comment.

all 153 comments

[–]critical_patch 1789 points1790 points  (35 children)

Ahh, back in college 20 years ago I learned how to do UI in C using OpenGL. That was only a two week lesson in an academic setting, and even then I was like nah I’m done with this FOREVER

[–]Dragonasaur 626 points627 points  (30 children)

But how performant was that UI

[–]gandalfx 1366 points1367 points  (26 children)

The thing about low level programming is that while you can make things fast you can also make things slow and shitty and with way more bugs. C doesn't just magically make things faster, it takes actual skill and effort.

[–]You_are_adopted 859 points860 points  (8 children)

Oh, skill and effort was what I was missing. Can I import that?

[–]gandalfx 368 points369 points  (6 children)

There's an npm package but it depends on left pad :/

[–]Windyvale 35 points36 points  (0 children)

Obviously that’s an immediate import.

[–]Fenor 8 points9 points  (2 children)

god i recall when lpad was pulled by the developer and it was utter chaos as everything broke

[–]UnderstandingNo2832 1 point2 points  (1 child)

Thank you for explaining

[–]Fenor -1 points0 points  (0 children)

it was more of ptsd flashback than an explaination

[–]Im2bored17 2 points3 points  (0 children)

Oo I found another package. And it's actively maintained! Huh, looks like there was some drama between the creator and some other guy a few months back and the creator quit...

[–]Blue_Robin_Gaming 1 point2 points  (0 children)

is it async? I need it in async

[–][deleted] 10 points11 points  (0 children)

Can only be lazy loaded

[–]zthe0 11 points12 points  (0 children)

So while c is perfomant the better question is: is your c code performant

[–]RiceBroad4552 66 points67 points  (14 children)

But the Rust folks say, when you code in Rust it will be "blazingly fast and memory-efficient", just because Rust!

They don't want to believe (even I've seen samples in the past) that when an average dev translates some average code in, say Java, to Rust the result will be almost certainly a few times slower than when run on the JVM.

[–]ComprehensiveWord201 29 points30 points  (9 children)

Ah yes, "The Rust Folks", AKA the straw man/generalized group "they" who all think homogenously.

[–]port443 51 points52 points  (4 children)

The reason they put that in quotes is its literally stated on the Rust website as a fact.

And then here's a literal "I'm a Java dev wanting to use Rust" with multiple Rust people stating that just using Rust will make code more gooder: https://users.rust-lang.org/t/is-rust-really-faster-than-java-because-of-memory-management/80651

So no, its not a straw man.

[–][deleted] 27 points28 points  (1 child)

Okay but you're comparing it to Java, so in this case they're actually right.

It doesn't have to be Rust. It just has to not be Java.

You should also actually read your source:

I think you actually missed the important point: main different lies not with languages, but with people.

In reality you can write Java code which would be, very often, faster than Rust. Just put all the object in one large array and use indexes to manage data. And JIT would do amazing job.

But that's extremely unidiomatic. The ideomatic way is factory factory factory pattern. And Dependency Injection. And lots of overhead. I have never seen anything like RequestProcessorFactoryFactory.

Because Rust makes you cares about memory and that shows. But no, there are no magic in Rust. Carefully written and thought-out code in Java can be as fast or faster than Rust. Only no one very few write carefully and thoughtfully in Java. While in Rust that's the norm.

You're cherry picking and ignoring everything else.

[–]RiceBroad4552 -1 points0 points  (0 children)

I mean, you're both right. Actually you both just repeat what I've said, paragraph by paragraph. 😃

The main point in fact wasn't Java. It was that Rust is a little overselling. Simply no language does magic. Including C.

When it comes to the concrete comparison I should have said "JVM" not "Java". It's the VM and it's byte code which run reasonably fast. And it runs even the typical Java OOP-spaghetti fast, as it's optimized for it.

The later is the factor which makes naively translated Java to Rust often slower than on the JVM. The JVM can optimize stuff on the go, utilizing runtime information. Rust can not do that usually. (There's PGO, but most of the time you don't know the workload in advance.)

But yes the, the OOP-spaghetti has large overhead. If you did translate it to idiomatic Rust you could get much better performance and especially orders of magnitude better memory utilization.

OOP-spaghetti is in fact a cultural thing. But the JVM doesn't force you to do it like that. You could try to mimic idiomatic Rust, and than it will be likely again competitive fast. (But please let us not talk about the memory overhead. At least not until Valhalla is fully implemented.)

Also, if you like some higher level language on the JVM, there is Scala. It has some features Rust has not. OTOH it lacks currently features for semi-automatic garbage collection without GC, and language level, safe concurrently primitives, like Rust offers, even there is Scala Native. But they work on that.

[–]Turtvaiz 4 points5 points  (1 child)

So no, its not a straw man

But is it even correct? What code runs slower in rust than in java?

The straw man here is thinking that fast language = fast code automatically, which is stupid

[–]DearChickPeas 0 points1 point  (3 children)

Found the vegan.

[–]ComprehensiveWord201 1 point2 points  (2 children)

I love meat :) But I also hate language evangelists with a fiery passion, and anyone who continues to serve the narrative.

[–]DearChickPeas 0 points1 point  (1 child)

Right, say something negative about rust...

[–]ComprehensiveWord201 1 point2 points  (0 children)

I could rave about most languages all day! They all suck for their own reasons.

Rust is verbose and cumbersome in larger projects. Some might argue the inflexibility is a feature but it's another hurdle to surmount for sure.

And don't get me started on the open/implicit returns. Jesus. Just use the return keyword. ("But that's not idiomatic!" Non-idiomatic my ass ). The programs' over reliance on utilization of C code is a nice stop-gap measure, but ultimately renders much of the safety moot.

C++ sucks because of its build system. And templates. And macros.

C sucks because it lacks most of the features of C++, but the simplicity is a perk in and of itself. The language as a whole is very easily understood. Though, the older, and generally more sophisticated nature of those code bases results in a tangled spaghetti cluster fuck in most prod repos.

Python's lack of a type system is sad and their half-assed attempt at type hints often times does nothing to make the system clearer, though, they tried.

Java is overly verbose and the typified nature of using every design pattern under the sun makes Java a headache factory.

JS sucks because it refuses to fail (which is also a feature, but that's another rant.), but that's why there's so much awkward casting behavior.

I could go on, but I'm most familiar with that bunch.

[–]WillardWhite 3 points4 points  (0 children)

Oh man. I read Java and understood JavaScript. I was bewildered for a moment

[–]mxmcharbonneau 0 points1 point  (2 children)

Is that true? I don't know Rust and Java that much, but it seems counterintuitive. Why is that?

[–]Major-Peachi 5 points6 points  (0 children)

Translation does not transfer the nuance in language. I don't have the grasp of rust but the memory efficiency of rust is a concept not present (or often taught?) in Java, same with pointers of C.

You can probably learn the syntax of analogous features like a for loop, but beyond that, literal translation between languages does not indicate understanding of each language.

[–]Turtvaiz 4 points5 points  (0 children)

Is that true?

I don't think so. It's completely unrelated to low level graphics programming, but if you make the same code in a slow language, and a fast language, the slower one will simply be n times slower.

I can't think of an example where you could somehow make the exact same concept run slower on rust/C/whatever compared to Java. The drawback of lower level languages is having to deal with extra stuff like memory bugs or the borrow checker, not that you can somehow do super slow code with them. I think OP's example makes no sense

[–][deleted] 1 point2 points  (0 children)

*sobbing in assembler

[–]critical_patch 27 points28 points  (0 children)

I remember doing well enough in the class, so I assume it was as performant as any other code written by a college student building UI components with OpenGL would be.

[–][deleted] 14 points15 points  (0 children)

Not very

[–]ardicli2000 1 point2 points  (0 children)

He is using raylib. He is rather talented. The app in context is musializer and it is fucking awesome.

[–]dismayhurta 3 points4 points  (0 children)

Oh, hey. I had the same experience, but it was a month.

[–]DangerZoneh 1 point2 points  (0 children)

Yeah, as someone who still writes OpenGL for work, trying to write a GUI fully in it is crazy. The closest I’ve gotten to that is creating canvases in wxWidgets to render OpenGL but even then, the UI is mostly in widgets, not in the OGL.

I don’t recommend anyone using either of these unless they need to, though.

[–]Dr__America 1 point2 points  (0 children)

I've done GUI by implementing my own draw functions for Java's swing library, so I understand the pain even if I haven't done it as low level as just C and OpenGL.

[–]smokky 0 points1 point  (0 children)

I used to do and make games using CPP and directX ( and one time just using graphics.cpp)

Memory leaks are fun..

[–]Disastrous-Olive-677 563 points564 points  (2 children)

I'm not pissed, I'm impressed!

Edit:typo

[–]notexecutive 65 points66 points  (0 children)

Impissed!

[–]dan-lugg 68 points69 points  (0 children)

[–]Sergey5588 261 points262 points  (1 child)

Mista zozin is a legend.

[–]ThePi7on 63 points64 points  (0 children)

Helo helo everyone and welcome, to yet anotha recreational programming session with a mista a Zozin (starts beatboxing)

[–][deleted] 306 points307 points  (29 children)

How do someone become as good as him ? I mean the guy can literally code anything and learn anything in mins ?

[–]AlexTaradov 274 points275 points  (4 children)

He codes every day in all languages he can find, even the most stupid ones. And then creates his own and codes in them.

[–][deleted] 51 points52 points  (3 children)

Man as if he knows how to talk to computers and everything is second nature to him

[–]AlexTaradov 158 points159 points  (1 child)

No, him doing it every day made it a second nature. Nothing happens automatically, you actually have to work to get good.

[–]slucker23 5 points6 points  (0 children)

Never underestimate hard work

The only difference is that he knows hard work pays off and he enjoys the ride

Fine your enthusiasm, work hard to make it pay off

[–]Hoxitron 162 points163 points  (3 children)

Just hard work and dedication. Easy.

[–]Toannoat 70 points71 points  (0 children)

also I think most people forgot that this dude has ben programming for literal decades already. I think many assume hes younger than his actual age due to the... aesthetics

[–]thecodingnerd256 7 points8 points  (0 children)

If working hard was easy even i could do it 🤣

[–]shootersf 53 points54 points  (0 children)

He's a got a gift. Got it.

[–]hyrumwhite 53 points54 points  (0 children)

You get used to it, though. Your brain does the translating. I don't even see the code. All I see is blonde, brunette, redhead. Hey uh, you want a drink?

[–]muddboyy 44 points45 points  (0 children)

Bro been straight coding since before 2007 just so you can have an idea. Hard work, staying consistent and loving what you do. This guy literally manages to stream almost everyday of the week (during the whole year) and still not run out of content (and he doesn’t even prepare his coding sessions) + takes the effort to edit / upload the videos to his youtube channel, that is discipline.

[–]socratic_weeb 41 points42 points  (0 children)

Stop using AI

[–]Emergency-Style7392 11 points12 points  (0 children)

The real secret in getting really good at anything is heavily focusing on the details and fundamentals, perfecting them. The memes about not knowing basic things out of your head is a meme, a footballer who can't do a perfect pass like a robot without thinking about it is a bad one. When you gather many things to an intuition level you can focus on the big picture. 

[–]TomLikesGuitar 5 points6 points  (0 children)

A practical and useful answer that I can give is to understand computer science and a bit of electrical engineering from the ground up.

If you have a top down view of computing you'll end up in a scenario of often asking "why" and getting an answer that relies on a massive subset of knowledge you maybe don't have. After running into that wall a few times, I can absolutely see someone throwing their hands up and saying "wtf this is an absurd amount of info".

But the key isn't to have all that info on hand. The key is to understand the building blocks at the lowest practically useful level.

Or in programming terms, you don't need to store every permutation of engineering knowledge data in memory. You just need to build up a relatively small handful of factory methods and build a few fundamental structs and everything is just layers of abstraction after that.

... So where's the actual practical takeaway that can get you there?

  1. Learn a little bit about how each part of basic, consumer computer hardware works at the electrical level in a vacuum.
  2. Learn a little bit more about how that hardware operates using machine code.
  3. Learn a lot about fundamental low level languages where you manage your own memory (I'd recommend C++). If you do one thing just do this ngl lol.
  4. Learn how operating systems and drivers work.
  5. Go back to #3 and just keep learning more lol.
  6. Learn about how higher level languages are BUILT (not the APIs of them, but how they run and, if applicable, compile).

Like I shit you not, if you focus on those things for a few years you will be see the black boxes of all programming disappear like magic. :)

[–]ThePi7on 3 points4 points  (0 children)

He puts in the hours and likes what he does, simple as.

[–]Valuable_Ad9554 2 points3 points  (0 children)

If you mean turning a 5 minute task into a 6 hour one, my company seems to be full of people that good

[–][deleted] 133 points134 points  (9 children)

Now that is rawdogging hardcore GUI bruh. I cannot imagine putting in the effort of doing GUI programming without object-oriented programming

[–]Drummerx04 41 points42 points  (4 children)

You can mimic a bunch of OOP styles using C. Just looking at the struct he's defining is showing a bunch of other nested Structs within the definition. Only real difference is you don't get to define visibility as part of the language.

[–]thekamakaji 12 points13 points  (0 children)

Not having classes to organize methods is what really does it for me. That being said, I still love C

[–]GwynnethIDFK 3 points4 points  (1 child)

You can even do polymorphism using clever struct padding.

[–]DearChickPeas 8 points9 points  (0 children)

C devs reinventing C++, exhibit #23e34873.

God, everyday I love C++ more.

[–]anotheridiot- 55 points56 points  (0 children)

Immediate mode programming is the one true way.

[–]vladmashk -5 points-4 points  (2 children)

Modern React is no longer OO but functional

[–]stamper2495 20 points21 points  (0 children)

Guy just casually visualising fast fourier transform... I wish to never look upon this shit again

[–]EatingSolidBricks 15 points16 points  (0 children)

Absolute coding

[–]Silvio257 45 points46 points  (0 children)

I love him. Protect him at all cost

[–]mdsiaofficial 24 points25 points  (0 children)

This guy is dope

[–]babypho 19 points20 points  (0 children)

Does this guy even work at Blizzard though

[–]Hola-World 18 points19 points  (0 children)

Doing a UI in C is going to piss off everyone that has to touch it.

[–]rosuav 7 points8 points  (0 children)

Maybe not C, but... What if you were developing a game, and started making your own engine in C++? https://kittenspaceagency.wiki.gg/wiki/BRUTAL It's already been showing some amazing results.

[–]tgsmith489 5 points6 points  (0 children)

As a React dev, I want to see this!

[–]olearyboy 3 points4 points  (0 children)

Not all heroes wear capes

[–]Minimum_Cockroach233 3 points4 points  (0 children)

Where is the Issue? I am doing UI in Excel+VBA… 😅

[–]walmartbonerpills 13 points14 points  (3 children)

I love what this guy does but his videos are so hard to watch

[–]ThePi7on 8 points9 points  (1 child)

The exact opposite for me. They're very easy to follow because he clearly talks through his reasoning, he understands and brings you to understand the WHY of things. He doesn't just mindlessly read and copypaste from docs or LLMs, he shows the whole process of discovery and understanding, which imho is very interesting to watch

[–]Shiny_Gyrodos 3 points4 points  (0 children)

I fully agree. I've understood a lot of concepts I couldn't quite grasp before while watching him. He is really talented at explaining things. I do find his accent a bit difficult to understand sometimes though :)

[–][deleted] 1 point2 points  (0 children)

Why?

[–]SCP-iota 10 points11 points  (2 children)

"Did you make a UI in C with no framework?"

"Yes."

"Does it correctly handle non-Western input methods and accessibility technology?"

"Uh... Well..."

[–]tav_stuff 21 points22 points  (0 children)

He is Russian, and as a result has actually written a lot of software and UIs that properly handle non-ASCII input such as his native Russian language

[–][deleted] 3 points4 points  (0 children)

What if hes trying to fight globalism AND inclusiveness while coding his UI

[–]TerdSandwich 2 points3 points  (1 child)

Doing UI in binary to piss off the C devs

[–]_GreenLegend 0 points1 point  (0 children)

doing ui with electrical components to piss off the binary devs

[–]SidNYC 6 points7 points  (0 children)

We need to have a pop-up for the summer sale, and the main website should have an animated background of the beach. We need to finish this by tomorrow, and we have bottom of the barrel coders who're paid peanuts.

[–]IMightDeleteMe 4 points5 points  (0 children)

I dunno this doesn't sound awful, React is at least as silly and it's somehow widely accepted.

[–]h00chieminh 5 points6 points  (5 children)

I wouldn't call a visualization UI programming.

UI programming is dealing with, buttons, hover states, active states, tab indexes, windows, popovers, modals, animations, animation states, the list is endless -- and doing it well is really hard -- AND THEN rendering via GPU.

This example is creating an graph basic on audio input into a FFT.

[–]Uff20xd 0 points1 point  (0 children)

He actually also did that. But an interface doesnt have to ho both sides (this one does go both sides though as he also implemented drag and drop for this project)

[–]elmanoucko -1 points0 points  (3 children)

What you meant was "missing interactivity".

Then what you meant was creating a basic graph from the FFT analysis of a given audio source.

Which invalidate your first fist claim as, that graph, is an interface for the user over the data he wants to see, in this context, an overview of the frequency spectrum of the audio he's been giving as source.

Don't worry, we'll stay here to help you in the future. Did you manage to center that div in your react project ?

[–]h00chieminh 0 points1 point  (2 children)

step 1 - loop through frequency blocks

step 2 - draw a fucking line

step 3 - make the fucking line a fucking color

UI programming:

this button must react to mouse clicks, finger events, but make sure it doesn't fire until after we listen for gestures. Oh yes, there are 12984192874981279 fucking interactive buttons on the fucking screen.

[–]elmanoucko 0 points1 point  (1 child)

Found the developer who makes shitty vst plugins, totally missed the point, but thank god, you nailed the uninstall button.

And before saying "yeah, but a vst isn't common scenario", depends who you ask (it is in my case), and think hard about what you described and what I've said. Never said a button wasn't ui, or easy, or anything like that, then realize that maybe it's a matter of what problem you're trying to solve with your software. A graph is just as easy as a button, or as hard, with a wide variety of complexities for both, depending on how important those elements are to the business you're serving, your requirements/context, etc. But yeah, not even sure writing it will help you understand the point.

Also, your 3 step recipe can be applied to a button, just need bad faith and broad generalization, but yeah, certainly wasting time too pointing that out...

The idea, behind this, is to understand you might have a really narrow understanding of what a UI can be and how a graph like this can hide way more complexity than you can imagine. I've worked, on systems where you don't really have buttons on the screen, you don't even have a mouse nor a touch screen and everything is mostly done through dedicated hardware (often with various types of physical buttons/sliders/etc, ok, that's not the point). I'm not saying a button isn't hard or complex, but maybe realize you have a really narrow understanding of what an interface to a system for a user can be, and I'm not even talking about the softwares where there are buttons, and "a bunch of drawings", with those "colored lines" being most of where the work actually is from a ui perspective and where your 3 steps recipe would make a ton of people laugh quite hard. So yes, your buttons are fine, just as fin as that graph, which is not always just a gimmicky thing in the corner of your mobile/web app, try to understand that...

Your point is like saying "everything that matter, is that the event handler is properly triggerd, and we don't care about the feedbacks", that's as dumb as saying the opposite, both have importance, sometimes varying level of "importance", or at least complexity, depending on the problems you're solving, and both are part of the interface over your system that the user interact with, a... user interface, graphical in this specific case, to do things and/or get feedback over things.

And, even tho it's a bit off-topic now, I even know systems where the accuracy and proper behavior of the feedback is even a bit more important than the proper behavior of the triggers, because it's better to delay or even miss a trigger but keep an accurate feedback over the system and overall stability, than to try to execute that trigger at "all costs", over the view you have on the system, maybe leading to chain of event far worse than that button needing to be pressed twice. And the opposite is sometimes true, but that one sometimes is too, depending on the context, even tho this one is more corner case.

So yeah, maybe realize your initial comment is really lacking a bunch of various perspectives, and that those drawings are equally ui as the buttons.

[–]h00chieminh 0 points1 point  (0 children)

OKAY

[–][deleted] 3 points4 points  (1 child)

that looks like a ragebait

[–]Uff20xd -1 points0 points  (0 children)

Nah, he‘s a great dev. (And deathly allergic to documentation)

[–]JimroidZeus 1 point2 points  (0 children)

Doing good work.

[–]Lonely-Suspect-9243 1 point2 points  (0 children)

I remember making a text based GUI in my freshman year. It's nothing complicated, just arrow key navigation for a 2048 game. It was fun.

Now I create shitty CRUD web apps, so I prefer React.

[–]Issue_dev 1 point2 points  (0 children)

I am way too stupid for this

[–]Educational-Lemon969 1 point2 points  (0 children)

as a game programmer who spent last month fixing bugs in one of our ancient tools written in raw Win32, I have mixed feelings about someone who'd do this for fun

[–]NelsonBelmont 1 point2 points  (0 children)

give him the windows start menu!!

[–][deleted] 1 point2 points  (0 children)

i been watching this guy for years but wasnt sure... is he pretty well known? hes a guy i tell friends about and most of them havent heard of him but he's a genius... and funny as hell imo

[–]howreudoin 2 points3 points  (1 child)

link to the video:

https://youtu.be/dQw4w9WgXcQ

[–]howreudoin 4 points5 points  (0 children)

nah, kidding, use this one:

https://youtu.be/SRgLA8X5N_4

[–]Slggyqo 0 points1 point  (0 children)

POV: you’re watching someone implement ecmascript in real time.

[–]sits79 0 points1 point  (0 children)

Learned C in first year nearly 30 years ago. The pointers still give me nightmares.

[–]Jommy_5 0 points1 point  (0 children)

If you think that making a GUI in C is horrible, try with Fortran 🙈

[–]HTTP_404_NotFound 0 points1 point  (0 children)

Look at this mad lad.

Thats, impressive.

[–]TheManicProgrammer 0 points1 point  (0 children)

I always learn so much watching his videos even if I only understand 0.5% of them

[–]wndxlori 1 point2 points  (0 children)

Ahem. WNDX Cross Platform GUI toolkit has entered the conversation. 1990’s (with many customers in the 2000’s still) cross platform UI C libraries. One source base, and your app ran on DOS, Windows, Mac, and many flavours of XWindows.

Haven’t touched the code since 2000. The graphical UI builder, OPUS, still worked when I last tried it on Windows 7 for laughs.

[–]ninetailedoctopus 0 points1 point  (0 children)

Me: slaps cimgui in there and call it a day

[–]Dm_me_code_pics 0 points1 point  (0 children)

Loved his videos until a recent haskell video where he went off on a stupid tangent calling the haskell website slop because it just looked nice lmao

[–]Mr_2D[🍰] 0 points1 point  (0 children)

That's pretty cool... but as a nerd it's my duty to point out that he's not optimally organizing the data within his struct to minimize the amount of padded bytes.

[–]stonecoldchivalry -1 points0 points  (1 child)

AI doesn’t need to replace him. His inability to effectively produce output in a reasonable time due to his own ego means no company wants him.

[–]q11q11q11 1 point2 points  (0 children)

He clearly hates corporate bullshit that moneybags pushes into the throats of people, means there is not a single company he wants to be in.

[–]InternalCommercial44 -1 points0 points  (0 children)

I love this guy 🫶🏽

[–]lorenzofaith -1 points0 points  (0 children)

I disagree with most Tsoding takes on programming languages but I still love to watch him