框架 vs. 工具包 vs. 库 [英] Framework vs. Toolkit vs. Library

查看:31
本文介绍了框架 vs. 工具包 vs. 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

框架、工具包和库之间有什么区别?

What is the difference between a Framework, a Toolkit and a Library?

推荐答案

最重要的区别,实际上定义库和框架之间的区别是控制反转.

The most important difference, and in fact the defining difference between a library and a framework is Inversion of Control.

这是什么意思?嗯,这意味着当你调用一个库时,处于控制之中.但是有了框架,控制就倒过来了:框架会调用您.(这被称为好莱坞原则:不要打电话给我们,我们会打电话给你.)这几乎是一个框架的定义.如果它没有控制反转,它就不是一个框架.(我在看着你,.NET!)

What does this mean? Well, it means that when you call a library, you are in control. But with a framework, the control is inverted: the framework calls you. (This is called the Hollywood Principle: Don't call Us, We'll call You.) This is pretty much the definition of a framework. If it doesn't have Inversion of Control, it's not a framework. (I'm looking at you, .NET!)

基本上,所有控制流都已经在框架中了,只有一堆预定义的白点可以用代码填充.

Basically, all the control flow is already in the framework, and there's just a bunch of predefined white spots that you can fill out with your code.

另一方面,库是可以调用的功能集合.

A library on the other hand is a collection of functionality that you can call.

我不知道工具包这个术语是否真的很好定义.只是套件"这个词似乎暗示了某种模块化,即您可以从中挑选的一组独立库.那么,是什么使工具包与一堆独立的库不同呢?集成:如果你只有一堆独立的库,就不能保证它们能很好地协同工作,而工具包中的库被设计成可以很好地协同工作——你只是不必使用所有.

I don't know if the term toolkit is really well defined. Just the word "kit" seems to suggest some kind of modularity, i.e. a set of independent libraries that you can pick and choose from. What, then, makes a toolkit different from just a bunch of independent libraries? Integration: if you just have a bunch of independent libraries, there is no guarantee that they will work well together, whereas the libraries in a toolkit have been designed to work well together – you just don't have to use all of them.

但这实际上只是我对这个术语的解释.与定义良好的库和框​​架不同,我认为工具包没有被广泛接受的定义.

But that's really just my interpretation of the term. Unlike library and framework, which are well-defined, I don't think that there is a widely accepted definition of toolkit.

这篇关于框架 vs. 工具包 vs. 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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