Live data from Hacker News

Programming as Theory Building (1985)

gist.github.com

1–10 of 39 posts

Re: Programming as Theory Building (1985)

#2
I think this could be applied to all spheres of human knowledge.

We have books written in languages we don't understand. There has to be shared context beneath all forms of communication and communication itself can be seen as CRUD operations of the layered cake of shared contexts/stories/narratives/ideas that have dependencies between them.

Study of CRUD operations and interactions between the layers and what the various types are and what common dependencies occur and when would be a very fruitful field of psychology, if not perhaps some AI modelling - I don't know if there already is a psychological model along these lines.

For example when you haven't seen a friend for a long time and you reconnect, if your life experiences haven't updated or deleted large parts of your shared context, you'll fall right back into the groove.

It does make me wonder if there needs to be an update of the shared context country or even world-wide to make people feel a sense of community again. We've done away with religion and the many community bonding experiences that it offered. We've tried the 'get rich or die tryin' context and I don't think it has been fulfilling for the majority of the beta testers :)

Time to try something else, perhaps with a little more thought and rigor put into it?

Re: Programming as Theory Building (1985)

#3
I only read the abstract (first paragraph), so maybe I'm way off base here. I'm about to go to bed and want to bang this out:

I think it's three pieces that need to come together. The source, the system it's running on, and the user. You don't necessarily need all 3

1. If you only have the user and the source but not the system then you're screwed. I could print out the entire FreeBSD source and docs, go back in time to 1820 and it would be pretty much useless since I need a C compiler and a million transistors, power supply and a bunch of other stuff. Obviously this is an extreme example, since most of the time you'd just have a slightly incomplete system (e.g. crappy build scripts but you know they built it on a unix system 2 years ago) so it's usually workable

2. If it's the user and the system then that's basically proprietary software. You can reverse engineer the source. Tedious but doable

3. If it's the source and the system, then you might be able to get a new user study both and understand everything again. Depends on the complexity of the source/system and the docs.

I think of it as an organism, like it can be damaged and heal itself. There is redundancy between these 3 axes. Depending the circumstances, you can heal it or it might be permanently damaged

Re: Programming as Theory Building (1985)

#4
The topic of how we as developers implement solutions in code has been on my mind for years.

The one insightful idea I found in this essay is that coding is a lossy one-way operation, from which you cannot fully derive the original idea or the 'theory'. That seems similar to losing information when compiling source code, making it impossible to restore the exact source code from its machine code representation.

So if we work backwards, it's: machine code (bits) -> source code (text) -> idea/solution (human thought?)

Despite losing some information, machine and source code have interesting properties, such as being able to copy them easily, transpile to different format, etc.

What I'd like to ask the HN brain is if anyone can think of another way to express a higher level thought other than language? In his essay, Naur implies that there is no such thing. I wonder if we had made any progress on that front in the 35 years that have elapsed since this essay was written.

The only thing I can think of is something like UML, which has tons of diagram types for structural and behavioral properties of a system, but I've always found it hard to 'see' the real idea they're trying to describe, in the same way how I find it hard to imagine a 4D object by looking at its 3D projections. With enough effort its certainly doable, but I wouldn't say the process is intuitive or easy, so to me, diagrams are like projections of an idea from different points of view, but how do we encode the idea/thought/theory itself?

What is it about language and apprenticeship that makes conveying ideas or theories possible? I view this process as an inefficient way of serializing an idea and transmitting it over voice to another person, who has to unserialize the sounds, convert them to words, then they have to create the associations in their brain based on the meaning of those words, and then probe into the correctness of the associations by asking clarifying questions.

Is this really the best we can do in 2020? How are other fields conveying complex abstract notions and ideas?

Re: Programming as Theory Building (1985)

#6
OP here, much of this paper resonates around the knowledge we need to build a system, lot of this is like the understanding of business rules, is the context we need to build a working software in the first place.

The problem is that knowledge is mostly "tacit", and tends to grow as the software evolves. For example, several development tasks are normally completed not only based on the documented user stories, but they also carry the context from meetings or discussions that aren't documented.

When you lose the original authors of the program, it becomes very difficult to rebuild the necessary context to understand how the system works - tasks like adding new features or modifying existing behavior becomes very hard. Also in the "The Metaphor as a Theory" part, much of the work is a shared knowledge between the developers, when you have several programmers working in parallel as fast as they can, the design of the program can become highly incoherent.

Nowdays we have practices like testing which could be a really helpful companion when it comes to understanding how the system works and the expected behavior of it's parts, which can be treated as a documentation, also we have code reviews that can guarantee that any addition to the system is consistent according to the system's design if is done right.

But still, this dependency of the context it's a very hard problem to resolve.

Re: Programming as Theory Building (1985)

#7

The topic of how we as developers implement solutions in code has been on my mind for years. The one insightful idea I found in this essay is that coding is a lossy one-way operation, from which you cannot fully derive the original idea or the 'theory'. That seems similar to losing information when compiling source code, making it impossible to restore the exact source code from its machine code representation. So if…

Ryle’s use of the term “theory,” which Naur adopts here, is a bit counter-intuitive; it’s really referring to a kind of operational knowledge.

One of Ryle’s central points is that there’s a categorical difference between being able to perform a skill yourself and knowing facts about how that skill is performed. Books, language, and observing other practitioners can only provide the latter kind of knowledge, but the former is what’s actually valuable.

Learning how to do something can only be achieved through practice. This practice can be guided and improved by rote learning, but cannot be replaced by it. Also, no two practitioners approach a skill in exactly the same way: As only rote knowledge can be transferred between people, each person builds their own structure of operational knowledge based on their particular experiences.

Naur’s argument here, then, is that this operational knowledge is dominated not by knowledge of building software in general, but instead by the understanding of how a particular piece of software functions internally and interacts with external factors. These external factors are both concrete, like protocol specifications, and abstract, like the competitive landscape the company is operating in.

Further, Naur argues that the primary value in developing a piece of software isn’t the software itself, but the expertise that the programming team had to develop in order to produce it. In this view, dismissing the programmers and keeping the software is a grave mistake that will surface when one of the external factors changes and there is noone qualified to update the software.

Re: Programming as Theory Building (1985)

#8

The topic of how we as developers implement solutions in code has been on my mind for years. The one insightful idea I found in this essay is that coding is a lossy one-way operation, from which you cannot fully derive the original idea or the 'theory'. That seems similar to losing information when compiling source code, making it impossible to restore the exact source code from its machine code representation. So if…

You're butting your head against the fundamental paradox of communication: in order to communicate an idea that's in your head to somebody else, you have to encode it in a way that the other person will recognise and decode; that is, you need to already have some shared context. However, if you have a new idea then by definition it can't be part of the shared context, so it can't be communicated.

We get around this by invoking combinations of existing ideas and hoping that the recipient puts them together in more or less the right way: we might say "a leopard sits in the tree to your left", invoking the existing ideas "leopard", "tree", "to your left" and "sits", which can be combined in the obvious way. UML, musical notation, mathematics... all these are variations on "language" in the sense that they have a vocabulary of existing ideas, and a grammar of natural ways to combine them, and so you can bootstrap ideas in another person's brain by giving them pieces they already know and hoping they can assemble the idea correctly.

Language is messy and non-portable and unreliable, and it is exactly those properties which allow it to convey novel ideas from one person to another.

Re: Programming as Theory Building (1985)

#9

The topic of how we as developers implement solutions in code has been on my mind for years. The one insightful idea I found in this essay is that coding is a lossy one-way operation, from which you cannot fully derive the original idea or the 'theory'. That seems similar to losing information when compiling source code, making it impossible to restore the exact source code from its machine code representation. So if…

> What I'd like to ask the HN brain is if anyone can think of another way to express a higher level thought other than language? In his essay, Naur implies that there is no such thing. I wonder if we had made any progress on that front in the 35 years that have elapsed since this essay was written.

I think it could be argued that category theory, and categorical thinking more generally are basically in this spirit. There’s a reason why a lot of folks think it’s the best thing since sliced bread.

The basic idea is that it has a sharply crystallized notion of what it means to have an analogy, which can piggy back on top of a bunch of essential structures from math to provide a language that is very effective for communication. Of course it’s only effective in communicating with people who share enough of that context.

As an example of this spirit of using rigorous reasoning to communicate better is the Haskell motto that the existence of “design patterns” imply a failure of the language for lack of expressiveness (more of a relative statement than absolute). If your language is any good, and your understanding of the pattern is sharp enough, then you should just be able to factorize it into a library. This lends to a programming style with highly modular, declarative and terse code.

Disclaimer: I’m not a Haskell expert by any means, so YMMV.

Re: Programming as Theory Building (1985)

#10

The topic of how we as developers implement solutions in code has been on my mind for years. The one insightful idea I found in this essay is that coding is a lossy one-way operation, from which you cannot fully derive the original idea or the 'theory'. That seems similar to losing information when compiling source code, making it impossible to restore the exact source code from its machine code representation. So if…

Personally I think the problem starts at “shared understanding” and I think the most promising solution lies within combining ontologies (such as ones based on BFO, perhaps) with Abstract Syntax Trees or Concrete Syntax Trees.

I suspect future development will occur merging tests as examples of program functionality with data models and call graphs derived and annotated based on common ontologies.

We would have, in this future, the ability to “translate” programs from one language to another the way Google Translate does, not necessarily as correctly as if one understands the language’s native idioms, but as if one had a dictionary of words and phrases and their definitions and could translate snippets to relate an unfamiliar codebase to patterns.

This would be clearer if tagging of code to an ontology were baked into the language the way the type system is baked into TypeScript’s ability to annotate types.

And TypeScript itself is an excellent example of how if we can annotate more fine-grained information useful generally only to programmers actively developing the program, it’s still very much a win-win.

I find myself frustrated now at how I can’t always rename string to other custom types if I want the string’s type to express meaning, similarly not every language supports string literal types.

Languages are more expressive about types than they used to be, and it’s possible to make types dynamically are compile time, so languages have themselves become more flexible.

The ultimate goal would be to encode the system model so concisely that you would want to re-use the model or ontology in a number of systems, yet maintain a bidirectional relationship so if your database or a third-party system adds a constraint to the model, the model reflects that automatically. Vice versa if your model incorrectly encodes the real world, you should be able to refactor your programs by changing the model.

I suppose to make this ontology-based solution a bit easier it should be broken down into two parts: an ontology of computer software and hardware terms based on ISO BFO as an example, and a separate ontology representing the program’s problem domain, often outside of computer science.

There is something of a flaw in this logic — models rarely map exactly to the real-world and thus while you can annotate or tag software, nothing can save you from a bad model or one that needs to evolve.

To that end, ASTs and CSTs with automated code formatting can help again. There are programs that can mutate tests until they pass to automatically suggest fixes. Programs you can write to rewrite programs automatically.

I actually think one part of the article aged poorly — the section where program modifications are hard to do at scale. Actually, program changes can be trivial at scale these days, assuming you can avoid PR merge conflicts of course.

The tough part is ensuring you’ve enough knowledge of what the program is currently doing, it’s current behaviours and environment, as well as what it was meant to do.

One last thing, a program may entirely be theory not code, but as a counterpoint: any behaviours undefined by the program model or spec will eventually be relied upon by somebody at scale.

Which is another way of saying that sometimes a program dies because it is adopted too widely and thus can never evolve without confusing everyone and everything that uses it.

This is perhaps an argument that programs should constantly evolve and be built for evolution, that models should also. If so, git and GitHub help tremendously but we don’t have enough similar tools for modelling and ontology yet. We don’t have a standardized git or TS for adding model annotations to source code or trees/derived program artifacts. Git commit comments help but only a bit, they aren’t descriptive enough. Can we relate a commit to a model change? Or a production incident? How interlinked yet machine interpretable are our models and corresponding representations in code, in commit history?

And finally, can we make models and ontologies easy to use and update with less training and distraction? Could a system be built to help reverse engineer models from code by illustrating possible shapes and a human then does the work of researching the correct details and aligning all possible representations into one derived model? I’m thinking of how human-computer systems generally outpace human or computer decision making alone. If so, we rely far too much on humans to understand models encoded in code today, and should shift that burden back to the machine as much as possible to instead assist us and where possible, spot mistakes in our models.

Post reply on HN