包装器、绑定和端口之间有什么区别?
在软件可移植性背景下,这三个概念之间有什么区别?
比如我想使用ncurses库,原来的ncurses库是用C写的,但是我的应用程序是用 C++ 编写的,然后我找到了“ncurses 包装器”、“ncurses 的绑定”和“ncurses 端口”。我应该使用哪一个?
每一种的优点和缺点是什么?
In a software portability context, what is the difference between these three concepts?
For example, I want to use the ncurses library, the original ncurses library is written in C, but my application is being written in C++, and then I found "ncurses wrapper", "bindings to ncurses", and "ncurses port". Which one should I use?
What are the pros and cons of each one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
wrapper 是一段位于其他代码之上的代码,用于回收其功能,但具有不同的界面。这通常意味着用相同语言编写的界面。还应该注意的是,有时人们会说包装器,而他们在技术上的意思是绑定(包括我自己)。
优点:
缺点:
绑定 是位于顶部的另一段代码其他代码来回收它的功能,除了这次绑定是用与它们绑定的东西不同的语言编写的。一个值得注意的例子是 PyQt,它是 QT 的 python 绑定。
优点:
缺点:
Port 是指您将某些代码翻译为在不同的环境中工作。常见的类比包括针对 Xbox 推出的游戏,后来又针对 PS3 发布。
优点:
缺点:
A wrapper is a bit of code that sits on top of other code to recycle it's functionality but with a different interface. This usually implies an interface written in the same language. It should also be noted that sometimes people will say wrapper when what they technically mean is a binding (myself included).
Pros:
Cons:
A binding is another bit of code that sits on top of other code to recycle it's functionality except this time bindings are written in a language different than the thing they bind. A notable example is PyQt which is the python binding for QT.
Pros:
Cons:
A Port is when you translate some code to work in a different environment. Common analogies include games that come out for say... XBox and are later released for PS3.
Pros:
Cons:
我应该使用哪一个?
您应该使用
ncurses 绑定
。绑定是应用程序、库等的特定版本,它与原始版本的不同之处仅在于您可以将其与其他语言一起使用。常见的例子包括窗口管理器(gtk+ = C、gtkmm = C++;Qt = C++、PyQt = Python;ecc)。然而,人们经常使用包装器或端口等其他词来指代绑定,因此很容易让自己感到困惑。Which one should I use?
You should use
bindings to ncurses
. A binding is a particular verion of an application, library, etc. that differs from the original only beacuse you can use it with another language. Frequent examples include windows managers (gtk+ = C, gtkmm = C++; Qt = C++, PyQt = Python; ecc.). However, people often use other words like wrapper or port to refer to bindings, so it's easy to get yourself confused.