[英]What is the difference between a framework and a library in any programming language like javascript?
I am getting lots of confusion over Library and Framework. 我对库和框架感到困惑。 Like EXTJS is a framework which is derived from JavaScript then how it is different from library.
像EXTJS一样,它是一个从JavaScript派生的框架,它与库有何不同。
I will be appreciate if any one clear my doubt. 如有任何疑问,我将不胜感激。
A library is essentially a set of functions that you can call, these days usually organized into classes. 库本质上是您可以调用的一组函数,这些天通常组织成类。 Each call does some work and returns control to the client.
每个调用都会执行一些工作,并将控制权返回给客户端。 Eg .
例如 。 jQuery.
jQuery的。
A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. 框架体现了一些抽象设计,并内置了更多的行为。要使用它,您需要通过子类化或插入自己的类将行为插入框架中的不同位置。 The framework's code then calls your code at these points.
然后,框架的代码在这些位置调用您的代码。 Eg .
例如 。 Angular JS
角JS
KeyDifference : The key difference between a library and a framework is “Inversion of Control”. KeyDifference :库和框架之间的主要区别是“控制反转”。 When you call a method from a library, you are in control.
当您从库中调用方法时,就可以控制。 But with a framework, the control is inverted: the framework calls you.
但是,有了框架,控件就会被颠倒:框架会调用您。
Relation : Both of them defined API, which is used for programmers to use. 关系 :两者都定义了API,供程序员使用。 To put those together, we can think of a library as a certain function of an application, a framework as the skeleton of the application, and an API is connector to put those together.
为了将它们组合在一起,我们可以将库视为应用程序的特定功能,将框架视为应用程序的框架,而API是将它们组合在一起的连接器。 A typical development process normally starts with a framework, and fill out functions defined in libraries through API.
典型的开发过程通常从框架开始,然后通过API填写库中定义的功能。
In very simple words - 简单来说-
Framework provides the complete skeleton of your app. Framework提供了您应用程序的完整框架。 Eg Express.js
例如Express.js
Library is a set of functions, what you can use as utilities in your app. 库是一组函数,您可以在应用程序中将其用作实用程序。 Eg JQuery
例如JQuery
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.