“Flat is better than nested” - for data as well as code?

前端 未结 6 388
不知归路
不知归路 2021-01-31 16:05

This question got me thinking: should we apply the principle that \"flat is better than nested\" to data as well as to code? Even when there is a \"logical tree structure\" to t

6条回答
  •  后悔当初
    2021-01-31 16:16

    Does that contradict "explicit is better than implicit"?

    Yes, particularly when being explicit prevents you from implicitly shooting yourself in the foot. The "tree" in your example can have multiple parents claiming to own the same children. It can also have multiple root nodes (and it does: 2 is a root node; 4 is a root as well as a leaf node.)

提交回复
热议问题