You are viewing archived messages.
Go here to search the history.

Federico Pereiro 2025-01-09 16:51:34

My first time reading a classic: Naur on programming as theory building.

Loved the article and disagreed with almost everything. Sharing my private thoughts without polish or much justification, in case someone's interested in a dissenting opinion 😅

  • I think Naur is not quite right. It's not theory building. It's the building of a representation of reality, that in itself can be a part of reality.

  • My take: if programs are much more readable, and we have a set of universal constructs for thinking programs, then reading and modifying a program doesn't require an external entity. There needn't be a private theory of the program except for the program itself (and any documentation in natural language). The theory should be readable from the constraints and the words/calls used in the system.

  • Simplicity can be evaluated as relative length of two solutions that do the same thing.

  • "Theory" can be rediscovered by studying both the problem domain and the solution.

  • Naur's concept of the theory of a program is downright animist. The theory is an entity living in the programmers that created the program, and can only be communicated by them while they are working in the program. When the program stops being worked up, the theory quickly fades and dies. No amount of program or documentation reading is going to revive it.

  • I think a more accurate and constructive view of programming considers it akin to an intellectual or scientific discipline, where a thread can be maintained over time through language, even if the chain is not transmitted orally.

Mariano Guerra 2025-01-09 16:59:13

have you heard this podcast episode? futureofcoding.org/episodes/061

Kartik Agaram 2025-01-09 18:42:51

We had this discussion about it in Aug '22, which perhaps led to this paper being chosen for the podcast episode above in Jan '23. Or perhaps it was recorded earlier and the thread was coincidental.

I still tend to be closer to @Federico Pereiro than Jimmy Miller here: I don't think there's any essential reason it's impossible to communicate a theory of a codebase. Yes, it won't be identical to the original author's theory, but it'll be close enough that others can make the same decisions as the original author. Yes, not always the exact same decisions, but close enough that if y'all talked you may not care too much about the differences.

Jimmy Miller 2025-01-09 18:56:24

There's a lot here, so let me just tackle the communication bit. You can't communicate a theory because it isn't linguistic at all. A theory is knowing-how, not knowing-that. Imagine I can juggle. I might be able to juggle without explaining how. Just like I know how to identify people by their faces, but if you asked me how I do it, I have no idea. If I can teach you how to juggle, what I gave you was not my know-how of juggling. I gave you facts about how to juggle and you built up your know how.

So it isn't that theories can't taught. It's that theories can't be written down because they aren't the kinds of things to be written down (or talked about or drawn etc). In order to write things down about a codebase one has to have a theory. Writing is just one way of presenting ones theory.

Kartik Agaram 2025-01-09 19:01:36

Yeah, I agree with that narrow definition of communication. You can't describe it directly in prose and recreate what about knowing it makes you effective at using it.

I also want to add that I disagree with the point above about Naur being animist, to the extent the term seems to have a negative connotation for you, @Federico Pereiro. Programs are complex, and they require special tacit knowledge to navigate, that is impossible to write down directly and a lot of work to write down indirectly (using exercises and so on to help build "muscle memory" in others). While you can view this phenomenon as a spirit animating the body, there are equivalent ways to view it that carry a more positive connotation for us moderns.

Jimmy Miller 2025-01-09 19:14:50

Yeah the whole motivation for the theory is actually to be a thorough going materialist. Ryle didn’t think we had anything in our head. We just had dispositions and behavior. So he reduced theory to dispositions.

David Alan Hjelle 2025-01-09 19:36:08
  • "Theory" can be rediscovered by studying both the problem domain and the solution.

I would also add the history of each. As an extremely simple example, I just had a discussion this morning about why do we (at my work) use <input type="button"> instead of <button> . I actually don't know — and it doesn't matter at all in this instance — but I suspect it has to do when the <button> HTML tag was added. (Our code base started early in the life cycle of the web.) It's a technical decision that might not have any rationale now, but once did. Without knowing the history, that couldn't be rediscovered.

Federico Pereiro 2025-01-09 19:52:13

First of all, I'm really happy to be having this discussion with you all! Normally, I'd keep these thoughts to myself and move on. But now you're making me consider your viewpoints!

Jimmy Miller, if I may quote what to me is your main point:

You can't communicate a theory because it isn't linguistic at all.

I strongly feel it does, because even if the theory itself is not language, it can be represented/conveyed by language. Moreover, by written language . Rather than try to convince you of this point (and honestly I don't think I have enough data for even trying), I'm going to keep this hypothesis in mind as an open question.

The other idea I posted above that I still consider interesting is that programming can be seen as an exercise in representing reality. Our program, rather than the theory itself, can be the representation of reality.

As for animism, I think I went too far 😂 I'd actually even side with an animist theory of programming that allows for its conveyance through the written word, separated by space and time. I chose that adjective as a way to highlight the lack of preservability of the theory in Naur's view, like meat that won't last long in time or space, not even if you have a freezer handy.

To me, the most beautiful example of resurrecting the theory behind a program is Petzold's Annotated Turing, where he revives the code of Turing's 1936 paper, including a full reconstruction of the Turing Machine. I always assumed that he did this through texts (directly from Turing's paper and from other papers written about it), rather than by an unbroken chain of human-to-human communication.

Hopefully I didn't go to hard on the idea, apologies if I raised any hackles!

PS: I didn't know about the podcast episode, I just had found the link earlier today while reviewing Kartik Agaram’s Mu :D

Jimmy Miller 2025-01-09 19:58:34

I strongly feel it does, because even if the theory itself is not language, it can be represented/conveyed by language. Moreover, by written language. Rather than try to convince you of this point (and honestly I don't think I have enough data for even trying), I'm going to keep this hypothesis in mind as an open question.

Ryle (and I assume Naur along with him) would say this is a category error.

Ryle: To have a theory or a plan is not itself to be doing or saying anything, any more than to have a pen is to be writing with it. To have a pen is to be in a position to write with it, if occasion arises to do so; and to have a theory or plan is to be prepared either to tell it or to apply it, if occasion arises to do so. The work of building a theory or plan is the work of getting oneself so prepared.

Also Ryle: Having a theory or plan is not merely being able to tell what one’s theory or plan is. Being able to tell a theory is, in fact, being able to make just one, namely the didactic exploitation of it. Mastery of Euclid’s theorems is not merely ability to cite them; it is also ability to solve riders to them, meet objections to them and find out the dimensions of fields with their aid.

The theory is our ability. We can use our abilities to write things down. But that isn't a theory. So yes, we can explain our theory. We can help others build a theory. But they don't thereby get our abilities. They learn their own abilities.

Federico Pereiro 2025-01-09 20:17:27

Thanks for the counterpoint! It's indeed likely I'm confusing the categories.

Maybe then, my objection to Naur is that, while recognizing that theory of a program/system is something that one must build for oneself, certain textual representations of the program (both code & natural language) can effectively let someone construct a theory of the program/system with relative ease, and that that theory converges (even if it's never equal to) the original theory of the program. The entire power of the objection lies in the possibility of doing this 1) in writing separated by time/space; 2) effectively in terms of time spent by the "resurrecting agent"; 3) in a way that can be considered (by whom? Perhaps by the original holders of the theory?) that the reconstructed theory has a level of convergence to the original similar to that that would have been experienced by the shared theory of a team building a system in a single point in time/space.

I just re-read that paragraph and I feel that my positivism might have gone a bit too far.

Jimmy Miller 2025-01-09 20:22:25

Awesome! Now we have the real disagreement. And you are in good company with that one. Knuth thought that using literate programming you could write a program in such a way that others gain the theory.

I think along the lines of what @David Alan Hjelle If you want the theory you need to also know the history. But not just the actual history. You need to know the counter-factual history. Why X and not Y? If I wanted to make this program do Z from the beginning, how would I have written it differently?

I personally buy the claim that you can’t resurrect. But I definitely think that is more debatable for sure.

Federico Pereiro 2025-01-09 20:28:07

Ah, beautiful! Now we have it, indeed. Whether resurrection of the theory of the program is possible or not. I'm not that sure either!

My first "serious" hobby programming project was to build a literate programming tool. I didn't know about parsers so I figured I could just do it with regexes. Incredibly, it kinda worked, but because I used triple angle brackets to delimit parts of the code.

I wonder if programmers should have a right to put a Do Not Resuscitate command in their own software 😅

William Taysom 2025-01-10 09:36:04

If theory is the disposition to behave and program is a description that produces behavior...

Jimmy Miller 2025-01-10 13:06:19

Yeah I think Ryle was very wrong that theory is just a disposition. He wanted to reduce all of thought feelings beliefs and desires to dispositions. But in my opinion that is a failed research project.

But even if it weren’t, the programs dispositions and our dispositions are two different things. So the program wouldn’t be its own theory. And since the brain isn’t a computer, our mind isn’t a program

📝 Is the Brain a Computer?

Is there a problem with thinking about the brain as a computer? Yes.