简体   繁体   English

在任何编程语言(例如javascript)中,框架和库之间有什么区别?

[英]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.

相关问题 Javascript 框架和 Javascript 库之间的区别 - difference between Javascript framework and Javascript library javascript中的断言库、测试框架、测试环境有什么区别? - What's the difference between assertion library, testing framework and testing environment in javascript? Javascript“Promises”和函数式编程的“任务”之间有什么区别? - What's the Difference Between Javascript “Promises” and functional Programming's “Task”? javascript中的({})和{}之间有什么区别吗? - Is there any difference between ({}) and {} in javascript? Javascript Testing Framework是关于测试javascript代码还是使用javascript测试以某种其他编程语言编写的任何应用程序? - Is Javascript Testing Framework about testing javascript code or using javascript to test any application written in some other programming language? JavaScript 对象中的不同函数声明之间有什么区别(如果有)? - What is the difference (if any) between the different function declarations within JavaScript objects? JavaScript中a +1和a-1 +2有什么区别 - What is the difference between a + 1 and a - 1 +2 in javascript JavaScript中“ >>>”和“ >>”有什么区别? - What is the difference between “>>>” and “>>” in JavaScript? JavaScript 中的 ' 和 " 有什么区别? - What is the difference between ' and " in JavaScript? JavaScript中“和”有什么区别? - What is the difference between ' and " in JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM