术语“序列化”在哪里? 来自?
我知道序列化是什么,但对我来说,这个术语并没有描述它的含义。
为什么我们称序列化序列化? 将对象转换为原始数据(以及就此而言的膨胀/反序列化)有何适合与术语“串行”相关的任何内容? 谁创造了这个术语以及为什么?
I know what serialization is, but to me, this is one term that does not describe what it means.
Why do we call serialization serialization? What is it about converting objects to raw data (and inflating/deserializing, for that matter) lends itself towards anything that related to the term "serial"? Who coined this term and why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
它可能来自网络和通信,需要将数据转换为由 1 和 0 组成的串行流。
维基百科 说:
我还记得昨晚,我参与的第一个网络项目(1983)使用术语“序列化器”来表示将消息从 C 中的结构转换为一系列字节以写入网络传输的代码部分。 它必须采用逻辑上表示消息的结构,并将其输出到下一个字节到线路上。
这段代码的作者来自 BB&N,所以这给了你寻找历史的方向。
It's probably from networking and communications, where it is necessary to convert data into a serial stream of ones and zeros.
Wikipedia says:
I also remembered last night that the first networking project I worked on (1983) used the term "serializer" for the part of the code that translated messages from structs in C to a series of bytes to be written out to the network transport. It had to take the struct, which logically represented the message, and output it each byte following the next onto the wire.
The authors of this code came from BB&N, so that gives you a direction in which to look for history.
我认为约翰桑德斯是在正确的轨道上,数据作为“流”发送到磁盘或通过网络的事实几乎可以肯定是这个术语的起源。
然而,另一种思考方式是这样的:程序的状态分布在整个内存中,指针/链接指向各处。 您有数组、列表、树、调用堆栈、分配的内存堆等,没有特定的顺序。
当您想要保存某些状态时,您无法使用程序中的大部分信息。 例如,任何指针值或堆栈偏移量(无论是直接使用还是由语言运行时内部使用等)在下次程序运行时都可能无效,因为堆将用于分配稍微不同系列的内存块。 保存这些指针值是没有用的。
为了保存某些状态,您必须“将您的事务按顺序排列”,以便保存的信息只是稍后相关的部分。
I think John Saunders is on the right track, the fact that data is sent to disk or over a network as a "stream" is almost certainly the origin of this term.
Another way to think of it, however, is like this: The state of a program is spread all over memory, with pointers/links pointing all over the place. You have arrays, lists, trees, call stacks, heaps of allocated memory, etc., in no particular order.
When you want to save some state, you cannot use much of the information in your program. For example, any pointer values or stack offsets (whether used directly or used internally by the language runtime, etc.) will likely not be valid the next time your program runs because the heap will have been used to allocate slightly different series of memory blocks. Saving these pointer values would be useless.
To save some state, you have to "put your affairs in order" such that the information being saved is only that part that will be relevant later on.
序列化使用数据结构和指针将内存中的数据转换为一系列字节,旨在保存在顺序介质(例如硬盘)上或通过串行连接等方式传输。
Serialization transforms data in memory with data structures and pointers into a series of bytes designed to be saved on a sequential media, such as a hard disk or transferred through something like a serial connection.
Serial 的意思是一个接着一个。 因此,它变成了一长串字节流。
Serial means one right after another. Hence, that it becomes one long stream of bytes.
它基本上只是指订单中的一系列商品。 连载这个词有时也在文学中使用。
It basically just means a series of items put in an order. The word serialized is also used sometime in literature.
早期,我们将数据保存到磁带等介质上,然后保存到软盘上,这些介质一次只能读/写一位,而存储的本质是相对于读/写头以一定速率移动的磁性介质。 因此,数据的物理布局是 1 和 0,从介质上的某个点开始,到另一个点结束。 因此,数据实际上是以串行方式传输到存储的。
Back in the early days, we saved data to media like tape and then floppy disk, which could only read/write one bit a time, and the nature of the storage was a magnetic media moving at some rate relative to a read/write head. So the physical layout of the data was 1's and 0's starting from some point on the media and ending at another. So data was transferred to storage literally in a serial manner.