框架、工具包和库之间的区别是什么?
当前回答
图
如果你是一个视觉学习者,下面的图表会让你更清楚:
(学分:http://tom.lokhorst.eu/2010/09/why-libraries-are-better-than-frameworks)
其他回答
非常非常相似,框架通常比库更完善和完整,而工具包可以简单地是类似库和框架的集合。
这是一个非常好的问题,在本质上可能有一点点主观,但我相信这是我能给出的最好的答案。
我认为这有点主观。工具箱是最简单的。它只是一堆可以使用的方法和类。 库和框架的区别在于如何使用它们。很久以前,我在某个地方读到一个完美的答案。框架调用您的代码,但另一方面,您的代码调用库。
Others have noted that .net may be both a framework and a library and a toolkit depending on which part you use but perhaps an example helps. Entity Framework for dealing with databases is a part of .net that does use the inversion of control pattern. You let it know your models it figures out what to do with them. As a programmer it requires you to understand "the mind of the framework", or more realistically the mind of the designer and what they are going to do with your inputs. datareader and related calls, on the other hand, are simply a tool to go get or put data to and from table/view and make it available to you. It would never understand how to take a parent child relationship and translate it from object to relational, you'd use multiple tools to do that. But you would have much more control on how that data was stored, when, transactions, etc.
框架:安装在你的机器上,允许你与它交互。没有这个框架,你就不能向你的机器发送编程命令
库:旨在解决某一问题(或同一类别的若干问题)
工具包:许多代码片段的集合,可以在多个问题上解决多个问题(就像工具箱一样)
库只是将方法/函数打包到一个包中的集合,可以导入到代码项目中并重用。
A framework is a robust library or collection of libraries that provides a "foundation" for your code. A framework follows the Inversion of Control pattern. For example, the .NET framework is a large collection of cohesive libraries in which you build your application on top of. You can argue there isn't a big difference between a framework and a library, but when people say "framework" it typically implies a larger, more robust suite of libraries which will play an integral part of an application.
我认为工具包和SDK是一样的。它附带文档、示例、库、包装器等。同样,您可以说这与框架是相同的,您可能这样做是正确的。
它们几乎都可以互换使用。