我见过的最愚蠢的设计 [英] The stupidest design I ever saw

查看:71
本文介绍了我见过的最愚蠢的设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是旧主题的延续,现在以xml为特色。


< tree>

< node id = 0 parent_id = null label =''A''>

< node id = 1 parent_id = 0 label =''B''>

< node id = 2 parent_id = 0 label =''C''>

...

< / tree>

This is a continuation of the old theme, now featuring xml.

<tree>
<node id=0 parent_id=null label=''A''>
<node id=1 parent_id=0 label=''B''>
<node id=2 parent_id=0 label=''C''>
...
</tree>

推荐答案

Mikito Harakiri写道:
Mikito Harakiri wrote:
< node id = 0 parent_id = null label =''A''>
<node id=0 parent_id=null label=''A''>



无论是什么,它都不是XML。必须引用XML属性值。


-

Joe Kesselman /小心病人的愤怒。 - John Dryden



Whatever that is, it isn''t XML. XML attribute values must be quoted.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden


Joseph Kesselman写道:
Joseph Kesselman wrote:
Mikito Harakiri写道:
Mikito Harakiri wrote:
< node id = 0 parent_id = null label =''A''>
<node id=0 parent_id=null label=''A''>



无论是什么,它都不是XML。必须引用XML属性值。



Whatever that is, it isn''t XML. XML attribute values must be quoted.




完全正确。一旦你在属性值周围加上引号,

设计就变得非常好了,因为基于文本的格式是灵活而且很好的。你可以放入你想要的任何东西。这是管理结构化数据的正确方法。 "传统"数据库

不好,因为表格是平的,现实世界是树状结构。有许多结构你不能表达

作为单个表格,如链表。


文本格式的另一个优点是任何人可以为他们写一个解析器

。你想要尽可能多的解析器;这样,市场可以决定格式的可接受范围。

马歇尔



Exactly. Once you put quotes around the attribute values, the
design becomes really good, because text based formats are
flexible and nice. You can just put in whatever you want. That''s
the right way to manage structured data. "Traditional" databases
are no good, because tables are flat, and the real world is tree
structured. There are lots of structures that you can''t express
as a single table, like a linked list.

Another advantage of text formats is that anyone can write a parser
for them. You want as many parsers as possible; that way the
market can decide on what variations of the format are acceptable.
Marshall


Marshall Spight写道:
Marshall Spight wrote:
Joseph Kesselman写道:
Joseph Kesselman wrote:
Mikito Harakiri写道:
Mikito Harakiri wrote:
< node id = 0 parent_id = null label =''A''>
<node id=0 parent_id=null label=''A''>



无论是什么,它都不是XML。必须引用XML属性值。



Whatever that is, it isn''t XML. XML attribute values must be quoted.



完全正确。一旦你在属性值周围加上引号,
设计就变得非常好了,因为基于文本的格式非常灵活。你可以放入你想要的任何东西。这是管理结构化数据的正确方法。 "传统"数据库
并不好,因为表格是平的,现实世界是树状结构。有许多结构你不能表达为单个表,如链表。

文本格式的另一个优点是任何人都可以编写解析器
对他们来说你想要尽可能多的解析器;这样市场可以决定格式的可接受范围。


Exactly. Once you put quotes around the attribute values, the
design becomes really good, because text based formats are
flexible and nice. You can just put in whatever you want. That''s
the right way to manage structured data. "Traditional" databases
are no good, because tables are flat, and the real world is tree
structured. There are lots of structures that you can''t express
as a single table, like a linked list.

Another advantage of text formats is that anyone can write a parser
for them. You want as many parsers as possible; that way the
market can decide on what variations of the format are acceptable.




您的评论迟到4天。



Your comment is 4 days late.


这篇关于我见过的最愚蠢的设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆