Maybe the spaghetti code conjecture is false
nickdrozd.github.io
nickdrozd.github.io
Maybe spaghetti code is closer to being like entropy, and we should expect busy beavers to be more analogous to complexity. Busy beavers are kind of on the transition between terminating (low-entropy?) and non-terminating programs (high entropy?), and complexity arises between low and high entropy temporally... Not a perfect analogy I know, even if I knew how to describe it precisely.
Read more here: Is Time’s Arrow Perspectival? - Carlo Rovelli
In particular the set of low entropy states must be quite small, so even if two definitions don't agree they must still agree for quite a large part of the high entropy states.
A cold ant is simpler because the molecules don't move in complicated ways. It's more complex if you ignore the movement of molecules, but then you're changing more than just how you define entropy you're leaving out bits of physics.
So in physics the temperature view will always be correct. You can use a different basis for it, but it will always be a temperature view, since everything disintegrates into plasma if you add enough energy, so that plasma needs to have higher entropy than whatever you started with, so your "structural" interpretation of physical entropy doesn't work.
https://en.wikipedia.org/wiki/Shepard_tone
Also, I should add, a photon of the lowest possible energy we can currently detect, still generates the same fidelity of interference and quantum effects that a high energy photon does. This is immensely applicable to low energy quantum computing. Which means that you can get a wavefunction at the final gate of one's quantum computer of enormous complexity, with almost no relation to energy magnitude. This relationship, between fidelity of the double-slit interference of low energy photons vs high energy ones was used to check for a screen-door effect to see if we might be in a discretized simulation that allocated compute based on energy magnitude. We found no such pixelation/screen-door effects. Quantum computation throws a huge wrench in classical thermodynamic entropy.
However, we can prove some precise results if we assume for instance that the number of well structured n-bit programs is at most c^n for some constant c<2.
In that case no busy beaver beyond a certain fixed size can be well structured, as that would allow for compressibility.
So busy beavers, by virtue of being incompressible, cannot have much structure.
I disagree. There are two programs given in the post, each requiring just 32 bits to describe, and the first one is definitely well-structured and the second one is definitely spaghetti. You can see the difference in the control flow graphs.
B is once again a while(input == 0) loop, that exits to D. D and C together form a while(input == 1) loop, that exits to A. And A is again a switch between two routes, although in this case, rather than dispatching to one of two independent routes, it switches between a full route (go to B) and a partial route (jump straight to D).
1. How did I get here? 2. Where will I go next?
In the first program, those questions are pretty easy to answer. Node D has two entry points and node A has two exit points, and in all other cases there is only one possible answer. If you are at nodes B or C, you know exactly how you got there and exactly where you will go next. If you are at node A, you just came from D, and if you are at node D then you will go to node A next.
But in the second program, three of the four nodes have both two entry points and two exit points. If you are at node C, how did you get there? You could have gone the A-B-D-C route, or you could have come directly from A. And where will you go next? Maybe you will go to A, or maybe you will go to D, and from there...possibly back to C? Or maybe on to A.
The difficulty in answering these basic questions is what makes the second program spaghetti.
I haven't made the above into a formal conjecture. Is there any truth to the above? Have I missed something obvious? Is there a result in the literature to this effect? Cheers.
The pedants also can't figure why nothing gets done.
If it is some very big and very critical system then yes, code reviews can be beneficial compared to the alternative. But for systems that are innovative and rapidly going through iterations as it is, it's better to judge coverage of test cases (and adequate performance but not optimal)
For us we are always implementing complex new logic for not very many users, so there's not much benefit to some clever data structure that we are all too dumb to understand. If I get a ticket that involves inserting something into the logic you wrote, and I can't understand how to operate your current solution, I will be hacking up an n logn solution as long as it is adequately performant
I worked on C code where there were 8 layers of calls where each function was f() {return next_layer_f();} . The thing is sometimes layers serve a function and sometimes they don't. Then there's an always present pressure to look "professional" and so tons of layers and lots of details/checklists. The 4 lines of code that actually does everything you need doesn't cut it. And what will you do the rest of your day?
The funny/sad thing is it doesn't matter how hard you try to fight human nature it doesn't seem to work. I love how the Go developers thought `go fmt` will end the formatting nitpicks. Guess what, it doesn't. We just found other things to nitpick. Or "Agile" or whatnot. Python says "A Foolish Consistency is the Hobgoblin of Little Minds" ... Well, try that on your co-worker in your next Python code review ;) Functional programming doesn't help either. In very small teams/companies sometimes the stars align and magic happens but it's really hard.
EDIT: Also nothing to do with the article ;) though maybe we can dream up some connection to the human brain.
Along the way I transitioned to OOP-less programming (I'm calling it OOP-less because I don't want to start a fight over "functional" vs "procedural" vs "..." etc...), not with the intention to do away with OOP but just to play with it. I rewrote some earlier, simple programs and what became rapidly obvious was how easy the code was to debug. The datastructures I had written prior were way too complex with too many levels and useless wrappers to make everything fit into the OOP paradigm. I rapidly became annoyed with the complexity of OOP and realized, I was in a rabbit hole and I had dug in _deep_. Even now when I'm writing bigger programs OOP-less I still find them much easier to debug. I'm still afraid debugging sessions can get rough but as time passes by this seems like more of a PTSD effect from my 15 year long OOP stint.
By now I've mostly done away with OOP programs but it's still annoying to have to interface with OOP designed libraries. I also changed my coding style camelCase to snake_case and the latter is much more legible to me but as a lot of libraries use camelCase or PascalCase it doesn't make the code look pretty.
So yes long story short, I share your assignment of blame. Complexity just seems to be the nature of the beast.
It's not better chasing that using an interactive debugger with expression breakpoints? (pause execution when some variable/property changes?)
"Although, no difference was found between identifier styles with respect to accuracy, results indicate a significant improvement in time and lower visual effort with the underscore style. "
http://www.cs.kent.edu/~jmaletic/papers/ICPC2010-CamelCaseUn...
Personally I can't decide on what to use so there is usually a mix with snake_case and camelCase, even within the same project, depending on what it is applied on.
Procedural PHP has ofc always existed, but I wanted to experiment how a modern take with the latest PHP 8.1 features could look like. There was both plus and minuses. I will publish it to github soon.
B is once again a while(input == 0) loop, that exits to D. D and C together form a while(input == 1) loop, that exits to A. And A is again a switch between two routes, although in this case, rather than dispatching to one of two independent routes, it switches between a full route (go to B) and a partial route (jump straight to D); basically you could consider B and C to exist together in an if-block of sorts.
Does anyone have a pointer to what I could read to understand this?
I read about busy beavers a while ago but have only started digging into the subject. Its really fascinating!
Please folks, before jumping in to comment, at least make sure the article is about what you think it's about.
How wrong I have been!
https://en.m.wikipedia.org/wiki/Busy_beaver#:~:text=In%20the.... Busy beaver game is to design a Turing machine that produces the most output for a halting program. And this conjecture is about a general property of the programs that can produce the most output.
That’s how the spaghetti code conjecture got its name. It’s a conjecture about the control flow structure of busy beaver machines. In this conjecture, you’re comparing different programs with the same size (if we think of size as number of states), but where the control structure is connected in different ways.