*nix 系统上是否有等效于 COM 的东西?如果不是,*nix 的可重用性方法是什么? [英] Is there an equivalent to COM on *nix systems ? If not, what was the *nix approach to re-usability?

查看:14
本文介绍了*nix 系统上是否有等效于 COM 的东西?如果不是,*nix 的可重用性方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解 Windows COM 及其背后的想法.我试图了解 *nix 系统是否甚至有等价物,或者为什么没有?

I have an understanding of windows COM and the ideas behind it. I am trying to understand if *nix systems even have an equivalent or why they don't?

推荐答案

Unix 模型建立在轻量级进程的思想之上,这些进程通过套接字、管道、信号和命令行相互通信.从历史上看,Unix 没有线程(POSIX 线程模型只有大约 10 年前的 IIRC),但是 Unix 上的进程总是比 Windows 上的进程便宜得多,因此将功能分解为单独的可执行文件比允许一个单个程序变得庞大而庞大.

The Unix model is built around the idea of lightweight processes that communicate with each other, through sockets, pipes, signals, and command lines. Historically, Unix didn't have threads (the POSIX thread model is only about 10 years old IIRC), but processes on Unix have always been much cheaper than on Windows, so it was more performant to factor functionality into separate executables than to allow a single program to grow large and monolithic.

在 COM 中,您定义允许共享内存通信的二进制接口.COM 与面向对象 范例相关联.在经典的 Unix 模型中,您定义面向流的接口,允许通过管道进行通信,而无需共享内存.从概念上讲,这更接近于函数式编程范式.

In COM, you define binary interfaces that allow shared-memory communication. COM is tied to an object-oriented paradigm. In the classic Unix model, you define stream-oriented interfaces that allow communication over pipes, without shared memory. Conceptually, this is much closer to a functional programming paradigm.

Unix 模型鼓励制作可以通过轻量级外壳"轻松耦合在一起的小程序,而 COM 模型鼓励制作公开组件"的大型程序,这些组件"可以被其他大型程序重用.这确实是一个苹果和橙子的比较,因为这两种模型在不同的情况下都有优点和缺点.

The Unix model encourages making small programs that can be easily coupled together by a lightweight "shell", while the COM model encourages making large programs that expose "components" that can be reused by other large programs. It's really an apples-and-oranges comparison, since both models provide benefits and drawbacks for different scenarios.

当然,现代 Unix 系统可以有类似 COM 的设施.Mozilla 拥有 XPCOM,这是一个基于与 COM 相同的原则构建的跨平台框架.GNOME 长期使用 Bonobo,它在概念上与 Microsoft OLE 非常相似,后者是 COM 的先驱.但是最近版本的 GNOME 已经从 Bonobo 转向支持 D-Bus,这更像是一种事件/消息模式.

Of course, modern Unix systems can have COM-like facilities. Mozilla has XPCOM, a cross-platform framework built on the same principles as COM. GNOME for a long time used Bonobo, which is conceptually very similar to Microsoft OLE, which was the forerunner to COM. But recent versions of GNOME have been shifting away from Bonobo in favor of D-Bus, which is more of an event/messaging pattern.

这篇关于*nix 系统上是否有等效于 COM 的东西?如果不是,*nix 的可重用性方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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