by ericHosick · 12y ago · 0 comments
This is the function-calling train issue and what happens if you try to make a sort of quasi homoiconic language ("Hierarchical organisation of data complects the data itself with the common access paths.") and attempt a push-pull approach to programming (you push the data down into the hierarchy) with traditional data scoping through parameters.
The bad is not the hierarchical organization of data. That is the correct direction.
The bad is trying to use a traditional scoping approach to what is effectively a homoiconic type language. Homoiconic type systems need a different scoping approach.
But we can implement our own scoping mechanisms based on the domain we are developing a program in.
For example, Eve mentioned that they were looking at a sort of "Excel" spreadsheet type visual language.
The scoping mechanism of spreadsheets are a sheet with row/column. So, I would create objects that are able to quickly pull from a row/column and push into a row/column. For example, somewhere in their hierarchy they had an algorithm that required access to a cursor.
Since it is a spreadsheet we can have our global active spreadsheet which, somewhere, contains the cursor. We know it is there because we put it there.
Somewhere deep in the bowels of the data hierarchy we have this line of code to get a cursor:
var cursorCurrent = global.curSpread[34,65];
because our scoping mechanism is based on an excel spreadsheet and not the one "forced" on us by the programming language: usually a stack.There is no need to push that current cursor down the function calling train and, in the end, it is probably faster because we are doing a simple cell lookup.
Another reason we weren't really satisfied with any of the hierarchical models because they required making lots of choices about ordering in the hierarchy that weren't really relevant to the actual problem being solved.
Now that we've moved to relational datalog-like language we just don't have scoping at all. Every table has a unique id and ambiguity between names is resolved at edit-time (eg by choosing from an autocomplete or by dragging a reference directly). We don't have a solid plan for handling reuse but we haven't actually felt the pain yet because doing things collection-at-a-time removes a good chunk of the use cases for reuse.
Exactly. So, just write your functions so they don't use parameters (expect for persistence of the program). In fact, you can bypass functions all together. It also makes it a lot easier define and visually represent behavior.
> Another reason we weren't really satisfied with any of the hierarchical models because they required making lots of choices about ordering in the hierarchy that weren't really relevant to the actual problem being solved.
Hmm. Interesting. Could you give some examples? I would think that the hierarchy would be built out organically as you build out your program. Unless the hierarchy is actually just data that the program manipulates. Then, I could see it as an issue. But if the hierarchy is your program it should just grow organically.
> We don't have a solid plan for handling reuse but we haven't actually felt the pain yet
From a hierarchical standpoint, re-use (I'm guessing code re-use) is really about being able to change context by moving or executing part of your hierarchy (since a program is just a hierarchical composition of objects) in another part of your hierarchy. This is a little more difficult but can be done implementing another scoping mechanism.
A concrete example is a function that writes something to stdout. If you want to output to a file instead, parameterise the function call by setting current-output-port to the handle of your file.
This is just a repeat of the xml database vs relational database debate. This fight has been fought so many times before - http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.113....
Xml database, key-value-store, relational databases, csv files, etc. are all ways of persisting.
These are very different disciplines with very different problems being solved.
The question in both cases is how should we model, query and update our data. The original tradeoff was that hierarchical databases and network databases were faster but relational databases were more flexible and maintainable (due to the separation of logical and physical data representation). Better implementations (eg http://en.wikipedia.org/wiki/IBM_System_R) narrowed the divide and made relational databases more attractive. Systems like Bloom (http://boom.cs.berkeley.edu/) and LogicBlox (http://www.infoq.com/presentations/wavefront) show that the same tipping point could be reached for programming languages.
So, ya, the question is "How do you pass information between sub-routines". Databases aren't expected to do much data manipulation between sub-routines. Programs are just wow so many ways to do it.
Thank you for taking the time to have this discussion.
Trying to map source-code that stores a lot of it's context on the stack is really hard to visually represent. Trying to represent the stack in a visual way makes for a icky looking visual language.
However, if you can keep all of the context/state of your program in one area and it is hierarchal... Then, you can build great visual representations of your program because, really, you are displaying a data-structure (your program becomes a data-structure). So, all the cool things you can do visually representing data-structures, you can do with your actual program.
'Visual language' is a very overloaded term and we are in no way set on any particular ideology. Textual languages and visual layout have different strengths and weaknesses and there are lots of cases where it makes sense to mix both. There is plenty of evidence that both are useful (eg http://www.amazon.com/Small-Matter-Programming-Perspectives-...). My only aversion to text is as an unstructured storage and communication format - it makes much more sense to allow tools to communicate using a shared, versioned and structured database rather than watching for changes in text files.
> visual languages are inherently hierarchal
Excel - https://www.google.com/search?q=excel&client=ubuntu&hs=fRx&c...
Access - https://www.google.com/search?q=access&client=ubuntu&hs=Jnc&...
Labview - https://www.google.com/search?q=labview&client=ubuntu&hs=v5H...
Blender - https://www.google.com/search?q=blender+node+editor&client=u...
PureData - https://www.google.com/search?q=puredata&client=ubuntu&hs=4S...
TouchDevelop - https://www.google.com/search?q=touchdevelop&client=ubuntu&h...
Kodu - https://www.google.com/search?q=kodu&client=ubuntu&hs=N9H&ch...
Pretty much the only hierarchical example that comes to mind is Scratch.
> Trying to map source-code that stores a lot of it's context on the stack is really hard to visually represent.
Yes. But non-local scope and control flow are also pretty hard to represent and understand. That's why we ended up avoiding both.
> However, if you can keep all of the context/state of your program in one area and it is hierarchal...
It doesn't have to be hierarchical. Excel and Access both have amazing (by programming tool standards) visual representations of your program and your data.
> So, all the cool things you can do visually representing data-structures, you can do with your actual program.
Data and code are different though. Eve is homoiconic-ish (code is stored in tables) but the actual visualisations and manipulations applied in 99% of the use cases are very different. We don't spend nearly as much time manipulating code as data compared to reading, writing and understanding code so it makes sense to default to visualisations that optimise for the latter.
All great points and I agree with them.
> Pretty much the only hierarchical example that comes to mind is Scratch.
I tend to lean towards Sean's post: https://news.ycombinator.com/item?id=8468838.
> non-local scope and control flow
I read you are going for an "Excel" type approach. I thought you were doing this to deal with non-local scope. I hope so because I think it is a good idea.
> are also pretty hard to represent and understand
Control flow is also really hard to represent but I don't think it is because of any aspect of the visual representation or core technology. You can remove coding from programming but you can't remove critical thinking and problem solving from programming: which is basically what programming is.
Control flow is critical thinking and problem solving. That is why when you "presented our prototype to a small number of non-programmers and sat back to watch the magic. To our horror, not a single one of them could figure out what the simple example program did or how it worked."
It is because there are inherent mental models that we use as tools to solve problems and think critically. People need to be given a visual representation of control flow in a way they are familiar with. I'm guessing you guys have done an amazing job (I've seen light table).
Frankly, I have a lot of experience in this space. I've spent ~5 to 6 years studying it and building out tools. I recognize a lot of the pains you are going through because I've been there. I would be more than happy to chat with you about it. I am totally stoked about Eve and would like to help.
> understanding code so it makes sense to default to visualisations that optimise for the latter.
I may be totally reading this wrong but you should not default visualisations to represent a given program. In my opinion, this is a mistake that all VPLish type things have made (as you said, it is a totally overloaded word). You can easily represent a given small part of a program in any domain you like: using the same underlying program. It could look like a mathematical equation to a mathematician, textual code to a programmer or process flow abstractions to someone in logistics.
This is one of the great strengths of hierarchical type programming languages: the same code can be represented using multiple visual abstractions tailored to the user.
This is why I totally agree with this statement "The environment should be optimised for the way that people use it, not the way that we think it should be used."
but think you should reconsider this "We should observe users and collect data to discover common actions and workflows." There are no common actions or assumptions you can make when going visual because there are so many different ways people approach solving a problem.
Programmers are only kind of aligned because we all go through this grinder that requires us to fight with compilers and figure out error messages and deal with syntax and so on. So, we all kinda mentally solve problems in the same way (and by kinda, it isn't like close but a lot closer than say an accountant and a painter solve their problems).
I hope this isn't too long winded but I really do have a lot of knowledge in this space.
Excel is your first example (and the one that the Eve dev blog keeps referring to while showing examples that aren't very Excel-like visually except insofar as anything which uses a grid as one of its visual elements is "Excel-like"), and Excel's objects are accessed through heirarchical identifiers where the parts of the heirarchy that are local to where the reference is used can be omitted. (Well, sort of; for external files, rather than locality, the path can be omitted if the file is currently open in Excel -- and certain references, notably tables, only work in the same circumstances that allow omitting the path.)
The heirarchy is path -> filename -> defined-name for defined names, and path -> filename -> sheetname -> range for unnamed cells or ranges; each of the steps of this heirarchy are also directly represented in the visual UI you interact with when doing references by point/click/drag rather than textually, as well. So, both in the names and the visual metaphor, Excel is heirarchical.
[1] http://research.microsoft.com/pubs/179364/p61-mcdirmid.pdf