Reddit Programming – Telegram
Reddit Programming
212 subscribers
1.22K photos
125K links
I will send you newest post from subreddit /r/programming
Download Telegram
Applying Functional Programming to a Complex Domain: A Practical Game Engine PoC
https://www.reddit.com/r/programming/comments/1n7eckc/applying_functional_programming_to_a_complex/

<!-- SC_OFF -->Hey r/programming (https://www.reddit.com/r/programming), As a front-end developer with a background in the JavaScript, React, and Redux ecosystem, I've always been intrigued by the idea of applying FP to a complex, real-world domain. Even though JavaScript is a multi-paradigm language, I've been leveraging its functional features to build a game engine as a side project, and I'm happy with the results so far so I wanted to share them with the community and gather some feedback. What I've found is that FP's core principles make it surprisingly straightforward to implement the architectural features that modern, high-performance game engines rely on. The Perks I Found I was able to naturally implement these core architectural features with FP: Data-Oriented Programming: My entire game state is a single, immutable JavaScript object. This gives me a "single source of truth," which is a perfect fit for the data-oriented design paradigm. Entity-Component-System Architecture: Each entity is a plain data object, and its behavior is defined by composing pure functions. This feels incredibly natural and avoids the boilerplate of classes. Composition Over Inheritance: My engine uses a decorator pattern to compose behaviors on the fly, which is far more flexible than relying on rigid class hierarchies. And all of this comes with the inherent benefits of functional programming: Predictability: The same input always produces the same output. Testability: Pure functions are easy to test in isolation. Debuggability: I can trace state changes frame-by-frame and even enable time-travel debugging. Networkability: Multiplayer becomes easier with simple event synchronization. Performance: Immutability with structural sharing enables efficient rendering and change detection. I've created a PoC, and I'm really enjoying the process. Here is the link to my GitHub repo: https://github.com/IngloriousCoderz/inglorious-engine. You can also find the documentation here: https://inglorious-engine.vercel.app/. So, when and where will my PoC hit a wall and tell me: "You were wrong all along, FP is not the way for game engines"? <!-- SC_ON --> submitted by /u/IngloriousCoderz (https://www.reddit.com/user/IngloriousCoderz)
[link] (https://github.com/IngloriousCoderz/inglorious-engine) [comments] (https://www.reddit.com/r/programming/comments/1n7eckc/applying_functional_programming_to_a_complex/)
Writing Code Was Never The Bottleneck
https://www.reddit.com/r/programming/comments/1n7ggac/writing_code_was_never_the_bottleneck/

<!-- SC_OFF --> The actual bottlenecks were, and still are, code reviews, knowledge transfer through mentoring and pairing, testing, debugging, and the human overhead of coordination and communication. All of this wrapped inside the labyrinth of tickets, planning meetings, and agile rituals. <!-- SC_ON --> submitted by /u/thewritingwallah (https://www.reddit.com/user/thewritingwallah)
[link] (https://ordep.dev/posts/writing-code-was-never-the-bottleneck) [comments] (https://www.reddit.com/r/programming/comments/1n7ggac/writing_code_was_never_the_bottleneck/)
Carbon Language Plans Seamless Interop with Rust, Kotlin, and Swift (To Avoid Ecosystem Duplication)
https://www.reddit.com/r/programming/comments/1n83xib/carbon_language_plans_seamless_interop_with_rust/

<!-- SC_OFF -->So ive just been reading the Carbon Safety documents as I wanted to catch up with what the Google folks have got cooking over there.. ....And what intrigued me is instead of building out their own safe STL type framework library of code they are instead going to re-use the already large collection of libraries from the Rust Cargo System through interop!! They say, and I quote: "The Carbon project will work to avoid creating duplication between the growing Rust library ecosystem and any future Carbon library ecosystem" I guess it makes sense as there is a shed load of libraries available in Cargo (apparently over 100,000) .. I guess that means you will also be able to use Cargo in Carbon! Its been a while since I looked at Rust, but I didnt think it had a stable ABI for interop! They also then talk about interop with "Swift for Apple platforms or Kotlin for Android". And of course their main focus is seamless interop with C++.. So it sounds like they want all the interops!! I just thought id post this here as I am genuinely intruiged that they have publicly acknowledged the goal for their "Safe Library Ecosystem" is to use Rusts to avoid ecosytem duplication. <!-- SC_ON --> submitted by /u/masterofmisc (https://www.reddit.com/user/masterofmisc)
[link] (https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/safety/README.md) [comments] (https://www.reddit.com/r/programming/comments/1n83xib/carbon_language_plans_seamless_interop_with_rust/)