Realized that the hierarchical folder system directly drives all programming structure. And then each file is just like a list of snippets of code. There could be a better way to organize code, and we've never tried bc file systems in all operating systems are driven by folders.
How we even think of programming is entirely hierarchical. For a component there is a "parent controller" that controls that component and possibly others. This parent controller coordinates the actions of each of it's child components.
August 11, 2020
We normally discourage programming practice where the child component directly communicates with either its sibling components or parent components far up in the chain since it "makes code hard to reason about". To avoid this, any time we realize we added state to the child that communicates with a sibling, we have to "lift state up" i.e. move that state to the parent to control it:
Taken from React Tic Tac Toe tutorial
This can actually be pretty annoying because a lot of the time, a child state can truly belong to the state; it's just that it needs to communicate with the sibling for this "one thing".
The file system is our best visualization of the structure of the code. A directory named "styles" tells you that directory contains css styles. A .js
file in that folder will cause some confusion, unless the name explains it.
It drives even the UI! Most websites nowadays are just boxes containing boxes.
So maybe a different system that organizes files different will allow different coding practices. I talked a bit here about how making "relations" between files can approach that as well as a context-based approach to looking at pieces of our code.
Smart filtering to provide context
Frankly, the way the world and physics works is not hierarchical. My parents do not "own me" or "control my actions". To talk to my brother, I don't have to go through them. Objects just exist, and I decide to interact with them. There's no sense of permanent hierarchy; there are just objects and there are relations, possibly temporary.
Maybe this whole idea of hierarchy is us trying to force structure on a world that can be confusing and overwhelming otherwise. Which is not so bad, but design has come very far since Unix was released (1971) with it's folder system. We can show relations to a user between objects that don't have to be in a strict hierarchy. We should also be able to program in ways that aren't just folders containing folders and files.
August 11, 2020 10:51 AM (EDT)
One great example of how programming and structures can work without a hierarchical file system: the Internet!
The Internet is a successful non-hierarchical structure
August 19, 2020
I called this idea networked thoughts since that's how we think; our thoughts are a network of atomic ideas, with relationships to other ideas.