79833682

Date: 2025-11-30 04:49:33
Score: 0.5
Natty:
Report link

I agree with Richard's approach. You can build a type hierarchy using DUs in F# or inheritance in C# to model the diagram, but what's the point? How will this benefit the logic you want to implement?

If you look at the tree of life, that's an example of something you might be tempted to model as an OO hierarchy. Or with a DU in F#. Then you'd have insects with their six legs in one branch.

It depends on the purpose, but the chance of success in modeling it like that is very slim. You'd be hardcoding the structure when it's likely that this structure should be built at runtime, and legs and wings and eyes should be attached dynamically at runtime.

Let's say somebody discovers something new in the tree of life. A new species, or some new fact about an existing species. If an application for maintaining information about the tree of life were to cope with this situation, and it was hardcoded like that, it would be impossible to modify information without releasing a new version of the application.

Ok, reality isn't always that simple, so maybe what you're trying has a purpose. Still, do you need a hardcoded tree structure? Maybe a list based on the diagram would be enough, hard or soft. And again, what's it for within the logic?

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: Bent Tranberg