问题描述
我对库和框架感到困惑.像EXTJS一样,它是一个从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.
如果有人消除我的怀疑,我将不胜感激.
I will be appreciate if any one clear my doubt.
推荐答案
库本质上是可以调用的一组函数,这些天通常组织成类.每个调用都会执行一些工作,并将控制权返回给客户端.例如.jQuery.
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.
一个框架体现了一些抽象设计,并内置了更多的行为.要使用它,您需要通过子类化或插入自己的类将行为插入框架中的不同位置.然后,框架的代码在这些点上调用您的代码.例如.Angular JS
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
KeyDifference :库和框架之间的主要区别是控制反转".当您从库中调用方法时,就处于控制之中.但是有了框架,控件就会被颠倒:框架会调用您.
KeyDifference: The key difference between a library and a framework is "Inversion of Control". When you call a method from a library, you are in control. But with a framework, the control is inverted: the framework calls you.
关系:两者都定义了API,供程序员使用.为了将它们组合在一起,我们可以将库视为应用程序的特定功能,将框架视为应用程序的框架,而API是将它们组合在一起的连接器.典型的开发过程通常从框架开始,然后通过API填写库中定义的功能.
Relation: Both of them defined API, which is used for programmers to use. 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. A typical development process normally starts with a framework, and fill out functions defined in libraries through API.
这篇关于在任何编程语言(例如javascript)中,框架和库之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!