top | item 43835800

(no title)

danieloj | 10 months ago

As a fullstack web engineer I've never had to implement a tree structure at work. I'd love to hear examples of what kinds of companies/platforms people are writing these structures regularly. If anyone is willing to share where they use them I'd appreciate it

discuss

order

rcxdude|10 months ago

I've used them (though more generally a directed acyclic graph) when doing certain kinds of analysis of code execution paths (working in embedded software). They do tend to show up in UI work as well (in an ad-hoc, implicit fashion), in my experience, though generally when you're looking at something across the whole UI as opposed to implementing a specific element of it. I've also used them in a somewhat ad-hoc build-system like utility as well.

(And to be clear, none of these involve sitting down and writing some generic Tree<T> structure, they're all cases of "Well, there's some tree-like datastructure that already exists or is a natural fit for this system and I'm going to be traversing it depth-first or breadth-first to do something to the elements of it or calculate something based on what nodes I pass through on a given traversal")

mvc|10 months ago

You might not implement them but as a web engineer you're using them all the time. So all these tools that you use will have tree implementations in them.

- Every html document is a tree structure. And css documents have special syntax to address nodes within those trees

- If it's any good, you're routing framework probably uses some kind of tree to quickly match the request to it's handler

- The database you write to uses a tree to quickly find the location it needs to write to

chuckadams|10 months ago

I think that’s kind of the GP’s point, that there’s no “implementing a tree” so much as just using the tree that’s naturally there. When I make nested objects, I don’t think of trees or some boxes-and-arrows diagram, I just think “product type”. It’s good to know your graph algorithms, sure, but thinking about the data representation isn’t something one needs to have in the front of their mind in any decently abstracted language.

Philpax|10 months ago

The (V)DOM is a tree. Knowing that is useful for manipulating and composing it.

ozten|10 months ago

Folder UI components are a common case.