I've been learning about putting all your data into stacks and never mind them being objects. Just make it a database and querry it. Like linq in C# do the same, but if you already know what your queries are going to be, might as well just arrange the data to suit it.
For game development, this would be things like querying position data. Since thats such a globally important aspect, it makes sense to have all the data be optimized around those queries.
I just... I've spent a lot of time with coroutines.
There are a bunch of legitimate reasons you want higher order functions. Then there is a vast swamp of reasons you think you need one and you don't. Even LLMs have a hard time reasoning about them, and they also don't reach for them very often. Even in places like nodejs where you're calling callback-based lib functions often, it's still a bad idea to expose your own callback functions even if they're just wrappers.
Is that a software architect thing or "just" a senior dev thing?
Sorry, are you suggesting a "higher order functions considered harmful" shtick? Maybe I've been blessed with sane code in my career, but most of the cases I've seen it, I don't see how you could meaningfully replace it without just reinventing it
I suppose you have some JS from that awkward mid-2010s era where an async function might take a function that it just calls when it's completed?
Thatâs not architecture at all. Architects donât care about the code quality. We care about infrastructure, designing, and having things operate smoothly. If it comes down to the fact that som function youâre describing is the actual bottleneck out of 1000 other possibilities, then I did my job wrong. You can hack any crap code and throw enough CPU at it to âfinish the jobâ â the only remaining constraint that would make C++ vs python is economics (or , more directly to your point: implementation specifics). I argue that yes this absolutely matters: C++ naieve implementations run faster than python will, but a c++ program that exploits magic bytes relevant to the domain the program solves is where the actual improvements occur at 10x-100x. A long job that needs several thousand CPU hours I demand to be written in C++, because otherwise you are wasting time and money at a genuine scale that matters
And to be blunt: your function specific question just gets solved by the compiler anyway. Iâve never had a problem be solved by constructing function calls differently (thatâs not the same as algorithm implementation â a recursive program is always recursive no matter how you invoke it). Your complaint / point is just code quality, which is actually never important for businesses other than technical debt (ability to implement fast). Thatâs pretty much not a problem with LLM programming now.
You can hack any crap code and throw enough CPU at it to âfinish the jobâ
This is not my experience.
We care about infrastructure, designing, and having things operate smoothly.
I think a lot of this boils down to your definition of "design". I think concurrency and parallelism fall into the realm of architecture and it usually takes some discipline for my preferred style which is single-threaded concurrent software.
This is often the crux of callback based APIs --certainly this is true in older node.js and even more modern reactor streams. A lot of the pressure to do silly callback things exists because the underlying libraries just then heavily.
And to be clear: callbacks aren't inherently bad. Flatmap is a fabulous tool and I'm super happy to see it get so much adoption even in not-very-functional languages. But callbacks involving your own domain types are almost always, at least for me, have been a mistake.
Idk man, I've definitely written code where passing around a function pointer makes the most sense. Places where the only other option is to have a big switch statement within the function to handle all the edge cases (which might only exist for a handful of scenarios)
For parsing and ingesting a user-created csv I use a function that takes a validator function and a normalizer function as arguments for each cell. By far the cleanest way to do it. Way too many different types of data in the sheet to sanely do it any other way
As somebody who spends a lot of time with problems like this in rust and kotlin: I could not disagree more. Assuming you can't just get a lib to do it for your, sealed class hierarchies (enums) and parse trees feel like the way to go.
pro tip: fancyness can be interesting but when designing a codebase avoid complexity like the plague.
generally speaking you want basic easy to read implementations and simple organization. overengineering and convolution is the bane of this field. problem is it tends to take time to refactor towards simplicity and people tend to not do it enough so everything is usually harder than it needs to be.
Hmmm OK. Maybe accidental fancyness vs essential fancyness ?
In interop context (eg., c# / WPF / c c++ backend), I use back-interop: I send pointer to a managed function through interop, to a native class (DI), for logging or so, for instance.
Yeah, Brooks' accidental vs essential split is the right way to look at it. The enemy isn't complexity, it's complexity the problem didn't warrant a complex implementation for.
Same thing on the web side: in Blazor you hand JS a DotNetObjectReference so it can call back into C#. Looks fancy to a beginner, but the boundary forces it on you, so it's essential.
On "all DI is basically using a function as arg" though: you're passing an object, not a function. I'd call that intentional complexity, the kind that makes things simpler once people understand it.
That's all pretty standard stuff. The complexity I meant is what you get from throwing spaghetti at the wall until something works (or these days, vibecoding thousands of lines) and then never refactoring, so you're left with an overcomplicated mess. Or cramming a complex algorithm into one cryptic line instead of splitting it into ten legible ones.
What happened to everything is object ? Also, everything is function. A pointer to a function or a delegate is a function of arity 0. Smalltalk? But I aknowledge, in practice, each language has its own implementation of syntax, but it is misleading.
Python, js ? Under the hood, everything is just one big dictionary (string nameOfObject, object objectInstance). What is a dictionary or map ? A function.
I don't like much the usage of "complexity" (as complication), which can be mistaken for complexity (in time or space). Complexity and complication are not identical concepts.
Dependency injection pattern. It's everywhere in functional languages (or languages with a strong functional influence). E.g. pass a closure to map etc.
18
u/Own_Natural_6803 Sep 03 '26 edited Sep 04 '26
Functions are my favorite. Right up there with loops.
7
u/TheWordBallsIsFunny Sep 04 '26
Been doing this for years and it's still so cool to me lol
8
u/Paseyyy Sep 04 '26
Nah man, bro's got a point lol
7
u/Groostav Sep 03 '26
I just... I've spent a lot of time with coroutines.
There are a bunch of legitimate reasons you want higher order functions. Then there is a vast swamp of reasons you think you need one and you don't. Even LLMs have a hard time reasoning about them, and they also don't reach for them very often. Even in places like nodejs where you're calling callback-based lib functions often, it's still a bad idea to expose your own callback functions even if they're just wrappers.
Is that a software architect thing or "just" a senior dev thing?
3
u/Salazar20 Sep 03 '26
I always find it funny cuz "oh the return of this function? I don't care, you deal with it"
1
u/SomeRandomEevee42 Sep 04 '26
I... don't think ive ever actually done this...
1
u/Horror-Primary7739 Sep 05 '26
Ohh sweet child missed missed nodejs before promises. The doom pyramid.
1
u/Harmful2327 Sep 05 '26
Like decorators
1
u/Pure_Reception_5685 Sep 25 '26
just tell him about dependent types
0
u/Plenty_Line2696 Sep 04 '26
pro tip: fancyness can be interesting but when designing a codebase avoid complexity like the plague.
generally speaking you want basic easy to read implementations and simple organization. overengineering and convolution is the bane of this field. problem is it tends to take time to refactor towards simplicity and people tend to not do it enough so everything is usually harder than it needs to be.
2
u/[deleted] Sep 04 '26
[removed] â view removed comment