by preseinger · 4y ago · 0 comments
I don't think so. In fact, I think this perspective is actively harmful.
A program is whatever the human beings who maintain that program operate against. I mean there are many possible representations of a program, and there are different ways to evaluate those models, but the model that most precisely expresses the AST of the logic of the program, or the call sequence of the von Neumann execution of the program, or whatever else? These models are incidental. The thing that matters is whatever humans read and interpret and mentally model. And for the moment that's source code.
foreach item in list_A
do_something(item)
This text is the native code in the programmer's mind, and we should allow programmer to just do so. Then, in a second layer, the programmer should code up the transformer and translate that to the actual programming language, adding incidental complexity such as specific syntax and internal language representations, so that the lower level compiler can verify and consume and feedback.The transformer part is super hard if we rely on automatic tools, which is just another version of a compiler. It is super tedious if we rely on human manual work, which is just how today programmers do. But if we view the transformer part as part of programming, where programmer employs tools to mold their program, then it makes sense. The programmer will be able to program the tools to avoid the tedious part but still with full flexibility to mold anyway they desire. It is still programming, but in a meta frame where text is the target.
I believe the same is true of programming. A solution in C is fundamentally distinct from a solution in ladder logic, or Haskell; even if they solve the same problem.
You don't buy a drill, you buy a way to get a hole in, say, wood. That's the core product.
The core product of 'programming' is a software solution. So far, the best way to approach it is text.
But... text is an incredibly poor model! It's almost literally an accounting system of "Jake spent fifty dollars." It's text which is "actively harmful," and we see it all around us in the absence of maintainable systems. Yes, currently, it's the best way we've found; just as horse and buggy was the best current form of travel 150 years ago. But it takes very little imagination to expect we'll find better.
I said exactly that. I added that it's horrific and it's not hard to imagine that we will find a better way.
IDE takes plain old text as input, and lets the coder to interact with the model of the program.
1. Various graphical hints in text (highlighting keywords, selections, …)
2. Visualisation tools (draw database and class diagrams)
3. Navigation capabilities (go to implementation, definition etc)
4. Refactoring capabilities (“rename, “extract variable”, …)
In my view, IDE is already “book with diagrams”. (“Diagrams” can still be improved, but concept is really there)
Consider that if text had an advantage, it would be that you could cut some string in half as some sort of manipulation that saves time. What do I cut in half? Change >= to = ? There's basically no advantage of text. I don't want half of an if statement, that's what text allows me to do, it's a pointless feature that makes inputting programs harder. The basic element on the screen should be the if statement itself.
There is no advantage to a 1D language. Text is a 1D language. If you have
if (x) {
if (y) {
}
}
You are just reading it as a 2D language, but it's not. It could be if (x) {
if (y) {
}}
}
and mean something else. (Yes I'm sure you can catch this one, but not all in general). The only way to be sure is read it from start until end, which nobody does. This is a security issue too, which I discovered when I was 12 years old reading perl scripts from milworm. By formatting text you are already conceding that 2D is better.Blueprints (army of interconnected squids) works best on parallel code like GPU shaders. For general branching logic, it becomes a nightmare quickly.
Image blocks, code icons or blueprints do save you from syntax errors and highlight relationships between code blocks, but they crush customizability and lose the ability to absorb and abstract complexity.
Your answer would be to not do it because it doesn't fit nicely in a 2d page. My answer would be to put it in a 1d line and not bake semantics into presentation.
But you can't pretend that the space of programs isn't infinite dimensional when the space we work in is only 3d. Regardless of how clever you are using a medium with a dimensionality higher than 1 for semantics will always result in expressions you can't express.
This is why we've stuck with text.
It's 1d, but we can make it 2d to help understand what is going on visually in the simple cases humans can understand intuitively. Yet it is complex enough to represent any possible object.
> A program is whatever the human beings who maintain that program operate against
This does neither invalidate the statement that "Program is not a text", nor that "[it is] a model".
> And for the moment that's source code.
How is wanting to change that harmful? Source code can have flaws like ambiguity (see C++'s need for typename). Deeming a call for improvement on the existing representation of a program harmful is a fine way to stop any progress at all. We would still be putting in raw numbers into memory with that attitude.
On another note: I think what matters is what the computer actually does. Whatever I, as a human, read and interpret has no meaning at all if the computer decides to "read and interpret" it differently. And the only limit with representing what the computer actually does should be your imagination.
Well, I understand this perspective, but I judge it to be backwards. The computer should be understood as secondary to the human. Mechanical sympathy is necessary for useful software but the goal of software must not be mechanical.
Mostly, you don't hit a compiler bug. When you think you've hit a compiler bug, it's not a compiler bug.
There's an easy workaround: write a compiler. It will have bugs.
There are other non-trivial ways that a program isn't its source, but in fact, systems which treat the source code as the ground truth are an important foundation. Many Smalltalk users would paint themselves into a corner by modifying an image to the point where there was no way to restart it, because its important properties were no longer captured in source code.
?!
Most Smalltalk users were transitioning enterprise systems from green screen terminals to guis.
> … no way to restart it…
It's important properties were captured in the .changes log file — so workable modifications can be made again in a new image.
https://eng.libretexts.org/Bookshelves/Computer_Science/Prog...