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

前端 未结 6 466
不知归路
不知归路 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条回答
  •  萌比男神i
    2021-01-31 16:19

    "Everything should be made as simple as possible, but not simpler." Flat is simpler than nested. If you're dealing with data with relevant nesting, then flattening it probably violates the "but not simpler" part. I took the Zen of Python instead to be encouraging you not to complicate your life with nesting you don't really need, like an XML config file where a simpler flat format might suffice.

提交回复
热议问题