HNHacker News
TopNewBestAskShowJobs

GuestHNUser

264 karma · joined December 10, 2021

submissionscomments
GuestHNUser··on Advice for new software devs who've read all those other advice essays
I recommend reading this book on Data Oriented Design[0] since the underlying reason ECS has been widely adopted is because, written correctly, an ECS system can take full advantage of modern hardware. Most ECS vs OOP blogs come at it from a perspective that I personally find flawed. OOP has the tendency to have objects layed out poorly in memory which prevent programmers from utilizing SIMD instructions[1].

[0] https://www.dataorienteddesign.com/dodbook/

[1] For instance, objects in OOP are typically bundled with other data related to the object. As an example, in OOP a Door object could have float X,Y,Z coordinates, an enum for type of door it is, a bool for opened or close etc. This leads to inefficiencies in cpu cache usage when you are iterating through a list of doors and not using every field of the door object.

See this GDC talk for why this matters in the gaming world: https://www.gdcvault.com/play/1022248/SIMD-at-Insomniac-Game...

GuestHNUser··on Push ifs up and fors down
Thanks for the thoughtful reply.

> Well it's hard to argue about that tradeoff in general, but I think the existence of languages like Python, Ruby and PHP is compelling. Though I'd accept the argument that they help optimise for neither performance nor changeability!

I see the point you're making, and I don't disagree with it. But I should be a bit more clear in what I really meant in my parent comment:

Given whatever language a developer is working in, whether it is fast like C++ or a slow language like Python (or perhaps even Minecraft Redstone), I think the programmer that takes a data oriented approach (meaning they write their code thinking about the kinds of data the program can receive and the kind it will likely receive, along with what operations will be the most expensive) will have better code than a programmer that makes a nice object model following all the SOLID principles. The majority of the OOP code I've worked with spends too much time caring about abstractions and encapsulation that performance is lost and the code is no better to work with.

> Regarding the DOD/OOP wars, I really love this article, which argues that OOP doesn't have to be bad[1]. I also think that when performance is a requirement, you just have to get more particular about your use of OOP. For example, the difference between Mesh and InstancedMesh[2] in THREE.js. Both are OOP, but have very different performance implications.

Absolutely agree here. Classic gamedev.net article. ECS != DOD and I think the next parts of the article illustrate how DOD isn't necessarily in opposition with programming paradigms like OOP and FP.

With that said, I think it can be argued that common patterns within both OOP and FP circles are a hurdle at times to utilizing hardware to its fullest. Here's Casey Muratori's argument against SOLID principles[0] for instance.

---------------------

I think the point still stands: performance isn't in opposition to making a maintainable/changeable program.

[0] https://youtu.be/tD5NrevFtbU?si=sED7befZRnVnQIxQ

GuestHNUser··on Push ifs up and fors down
Yeah, data-oriented design (DOD) always seems to get people riled up. I think it largely gets this type of reaction b/c DOD implies that many aspects of the dominant object-oriented approach are wrong.

> most line-of-business software needs to optimise for changeability and correctness, not performance.

It's a shame that so many see changeability and performance in opposition with each other. I've yet to find compelling evidence that such is the case.

GuestHNUser··on Push ifs up and fors down
Correct me if I am misunderstanding, you are saying the first example would be better if it was `walrus.frobnicate()`? Isn't that a syntax preference more than an issue with the point the author is trying to make?
GuestHNUser··on KDE Plasma 6.0 Is Enabling Wayland by Default
Thanks for this! Shame it isn't built in functionality.
GuestHNUser··on KDE Plasma 6.0 Is Enabling Wayland by Default
I think it comes down to preference. I definitely don't think KDE is amateur, but it certainly lacks the fine polish Apple has the money to pay for.

That said, I find MacOS frustrating at times because basic things can feel like a pain. Switching between several windows of the same application isn't a simple Alt-Tab; the green button enters full screen mode (KDE/Windows F11 Full Screen is equivalent) instead of leaving just the menu bars and application bar on screen; tiling windows isn't as simple as ramming the application against the border you want to expand to. These are simple things I do often in other OS's that have tedious menu workflows in MacOS. I still like a lot of MacOS though.

GuestHNUser··on Ask HN: Learning new coding patterns – how to start?
> What resources do you recommend folks at my level look into?

I'd argue that your best bet for learning is starting a project that drives you, then throwing that project away and starting it over again but try to make the code simpler. This way you can hone into what abstraction is actually necessary to solve your problem.

I strongly recommend ignoring design patterns and instead honing in on what the essential data flow is in your problem space. Most design patterns will bloat your code base and, thus, slow both your program and your programming velocity down.

As far as programming design and architecture goes, the best talks I have found come out of data orientated design talks. Casey Muratori has a number of talks well worth listening to[0][1][2]. I also enjoy Andrew Kelley's talk on Data Orientated Design specifically as it demonstrates DOD's power with actual numbers to back it up[3].

Tangent: I did my time with OOP design + trying to make my code 'clean' according to popular recommendations you'll see online. All of that time, I consider wasted because I focused too much on what the 'right' abstraction to use was, instead of solving my problem in the simplest way possible. I find now that often the best solution is the one that uses the least amount of abstraction and indirection. (E.g. One big function can be a lot easier to maintain than multiple little functions, you just have to develop a taste for when a function should be split up and why).

(If you must have a pattern to study though, the strategy pattern is the only one worth it. Often times, a simple switch statement is all you need for implementing the stategy effectively.)

[0] https://youtu.be/ZQ5_u8Lgvyk?si=uiiEwxMO1PjIEdxD [1] https://youtu.be/5IUj1EZwpJY?si=HCzyynWW425huM65 [2] https://youtu.be/tD5NrevFtbU?si=Y1mZZJsW21WDRMtu [3] https://vimeo.com/649009599

GuestHNUser··on Cursorless is alien magic from the future
Not cursorless specifically, but there is a great talk and demonstration about programming by voice here[0]. It's mesmerizing to watch. The speaker does a great job talking about the current commmon issues in the area too.

[0] https://youtu.be/GM_siEPD4Ws?si=99ZhC1P4irOyu1pH

GuestHNUser··on Cursorless is alien magic from the future
You should check out this demonstration of programming by voice[0].

[0] https://youtu.be/GM_siEPD4Ws?si=f52wK3tqqJaCQPp7

GuestHNUser··on GPU advancements in M3 and A17 Pro [video]
It is an overview of what is new about their hardware and technical advice (but not overly technical) on how to maximize the GPUs performance.

I watched the full video and thought it was excellent. I wish other CPU/GPU manufacturers made technical overview videos like this. I've never programmed graphics targeting metal before, but I feel much more inclined after watching this so I guess it was good advertising.

GuestHNUser··on Writing a Compiler is Surprisingly Easy (part 1)
Could you expand on what alternatives you prefer? I'm not sure what is dated about Crafting Interpreters (but I'm also not following the latest developments in the compiler space).

Thorston Ball's Compiler and Interpreter book series is the only other book on the subject I find widely recommend and modern.

GuestHNUser··on Waze will now warn drivers about crash dangers using historical data
My two cents: weaving through dense traffic is stressful and probably puts you at a higher risk of an accident than remaining in the same lane for an extra 5 minutes. I prefer to ignore those kind of shortcuts.
GuestHNUser··on Was Rust Worth It?
I share your sentiment about Rust. Fine language for sure, I just don't enjoy programming in it. Simply put, I don't like using the abstractions that the language encourages.

For what it is worth, I found pursuing Zig to be a breath of fresh air. It's a promising alternative in the same space as C (and also Cpp and Rust). Checkout Andrew Kelley's introduction to the language.

GuestHNUser··on Was Rust Worth It?
Agreed. I feel C# is appropriately rated on HN and other programming forums. It has perfomant memory options that other GC languages lack, and great builtin packages to use. Overall, it is a good language.

My biggest issue with C# though is how badly exceptions are handled given that it is a statically typed langauge. I wish functions explicitly defined the exceptions it can throw since a minor package bump could add an exception without your compiler warning you that it isn't handled. I much prefer Rust, Go and Zig's error handling to C#'s since those kind of issues don't happen.

GuestHNUser··on Was Rust Worth It?
Truly seamless because the zig compiler is also a C compiler, so the type information and calling convention works across languages at a level above any other I've encountered.
GuestHNUser··on Linear Book Scanner – Open-source automatic book scanner (2014)
I imagine lawsuits like this[0] caused them to slow down unfortunately.

[0] https://en.m.wikipedia.org/wiki/Authors_Guild,_Inc._v._Googl....

GuestHNUser··on Modernizing compiler design for Carbon's toolchain [video]
Good talk, however, I recommend people watch Andrew Kelley's talk[1] first. His talk has clearly had a major influence on Carbon's compiler design, plus I think Andrew's talk is a lot more practical for those not in the compiler space.

[1] https://vimeo.com/649009599

GuestHNUser··on Extend a C/C++ Project with Zig (2021)
Curious which projects you had issues with? I've only had positive experiences using zig build. Maybe you ran into version issues because 0.11 changed the entire build api?
GuestHNUser··on Make a low-cost Bluetooth LE packet sniffer with Wireshark
I had this exact question a while ago. Closest answer I could find was this stackexchange post: https://superuser.com/questions/1708946/why-do-bluetooth-pac...
GuestHNUser··on I'm 17 and wrote this guide on how CPUs run programs
OP, you should take a look at Casey Muratori's course at computerenhance.com

The first part of the course's homework creates a simulator of the 1978 intel 8086 (which modern x86_64 assembly still closely resembles). You will learn a lot of things about computers that are really difficult to find elsewhere.

GuestHNUser··on How the World’s Most Famous Scream Was Recovered
Maybe this is just me, but I think the Wilhelm scream works fine in the older movies where it was only supposed to be noticed by those in the industry. It just falls flat for me when it is done as a wink to the audience.
GuestHNUser··on How the World’s Most Famous Scream Was Recovered
Great video! (It's actually a minute longer than the one in the post though)
GuestHNUser··on Zig 0.11
Just to name one: compile time code execution. It eliminates the need for a separate macro language and provides Zig zero cost generic types.

Not to mention memory leak detection, crazy fast compilation times, slices and a built in C compiler so your code can seamlessly integrate with an existing C code base (seriously no wrapper needed).

Zig is really really awesome. The only thing holding it back from mass adoption right now is that it's not finished yet, and that shows in the minimal documentation. That said, if you're comfortable tinkering, it's completely capable of production uses (and is already used in production in various companies).

GuestHNUser··on The design thinking movement is absurd (2018)
Really? I thought it was pretty clear that the author thinks Design Thinking is composed of vague ideas and vapid phrases. Moreover, the author cites a significant number of noteworthy designers that make compelling arguments that Design Thinking is nonsense that produces a skewed picture of the design process.

I think your comment dismisses the article without giving a compelling reason why.

GuestHNUser··on The Fall of Stack Overflow
On Discord? Really? My experience has been that if I don't know what the popular community discord is and what channels to search, I will simply not find an answer. For me, my Discord experience really suffers from Discord not being indexed by search engines.
GuestHNUser··on Data-Oriented Design (2018)
Thanks for sharing this! Hands down the most practical talk I have seen about DOD. That made so many things click for me.
GuestHNUser··on Ask HN: Best value computer science book?
Latest edition is remarkably good. It's my recommendation for anyone wanting to start diving into algorithms.
GuestHNUser··on Apollo is dead. Long live Apollo
I joined kbin.social and have been pleasantly suprised with it. Everything I'm subscribed to there is slow moving at the moment, but frankly I find that pace refreshing. I've seen threads remain active for several days, which doesn't seem to happen anywhere else.
GuestHNUser··on AI is killing the old web
People seem to be getting hung up on the bad article title. It's a genuinely good read when you set the semantics of what the old web is aside.
GuestHNUser··on Meta announces its Quest 3 VR headset
I feel the same way as the parent. Just about everything touted in the entertainment industry fails to hold my attention or generate any desire. I haven't felt the urge to watch a movie, play a game, or really engage with much marketed media in a while. Don't mistake me for being depressed too, I am quite happy.

I get a lot of fulfillment in life from fairly mundane things: work, socializing, exercise, reading about whatever niche I am interested in the moment. I don't think it's abnormal either.

← PreviousPage 2 of 3Next →