序列化对象而不是使用xml的好处 [英] Benefits of serializing an object instead of using xml

查看:76
本文介绍了序列化对象而不是使用xml的好处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正确,我的应用程序将其对象另存为xml.我考虑序列化对象的原因是为了提高速度.序列化还有其他好处吗?

Right my my application saves its objects as xml. The reason why I am considering serializing the objects is for a speed gain. Are there any other benefits of serializing?

推荐答案

有一个与性能无关的缺点:如果更改基础对象,则无法检索序列化的数据.如果数据是长期存在的,那么您可以设置自己的刚性对象模型.

There's one downside that has nothing to do with performance: You can't retrieve the serialized data if you ever change the underlying objects. If the data is long-lived, you could be setting yourself up for a rigid object model.

XML的优势在于保留了鸭子键入"的可能性; JSON也是如此,它比XML轻.

XML the advantage of leaving open the possibility of "duck typing"; so does JSON, and it's lighter than XML.

这篇关于序列化对象而不是使用xml的好处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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