ssh框架概念_库和框架之间最简单的概念

ssh框架概念

What is the difference between a library and a framework?

库和框架有什么区别?

If you have experienced in Software Development Industry, you may have wondered or heard this question at least once. It’s also commonly asked on the programming job interview and I find many people struggling with this question. So I want to share how to answer the question in the easiest possible way.

如果您具有软件开发行业的经验,您可能至少想知道或听到过这个问题一次。 在编程工作面试中也经常问到这个问题,我发现很多人都在为这个问题而苦苦挣扎。 因此,我想分享如何以最简单的方式回答问题。

0.定义 (0. Definition)

什么是图书馆? (What is a Library?)

It’s a set of code that was previously written, that can be called upon when building your own code.

这是一组先前编写的代码,可以在构建自己的代码时调用。

什么是框架? (What is a Framework?)

It’s a supporting structure where your own code defines the “meat” of the operations by filling out the structure.

这是一个支持结构,您自己的代码通过填写结构来定义操作的“实质”。

1.第一类比 (1. The 1st Analogy)

It is still hard to clearly understand the differences with these definition if you are a beginner. Then let’s take a look at an analogy to approach them closer. You have now become a construction worker and you’re assigned to build a house.

如果您是初学者,仍然很难清楚地理解这些定义的区别。 然后,让我们看一个比它们更接近的类比。 您现在已成为建筑工人,并被分配建造房屋。

工具(锤子,射钉枪等)是您的“库” (Tools (a hammer, a nail gun, etc) are your “Library”)

You could build the house without any tools but if you want to make your work easier, you would use ‘the set of tools’. It can be used anywhere as much as you want when needed.

您可以在没有任何工具的情况下盖房子,但是如果您想使工作更轻松,则可以使用“工具集”。 可以在需要时在任意位置使用它。

房子的基础是您的“框架” (The foundation of the house is your “Framework”)

If there is a given foundation of the house, you must follow the regulations. Otherwise, the house cannot be built in proper way. The foundation dictates how your project will be structured.

如果房屋有给定的基础,则必须遵守相关规定。 否则,房屋将无法以正确的方式建造。 基础决定了项目的结构。

2.第二类比 (2. The 2nd Analogy)

Here is another analogy that would help you to understand more clearly.

这是另一个比喻,可以帮助您更清楚地理解。

您的家就是您的“图书馆” (Your home is your “Library”)

There are a less number of rules. You can just throw your T-shirt and place your bag anywhere. You may have to follow some rules but most of them are built by you. You can do it whatever you feel like.

规则较少。 您可以将T恤扔到任何地方。 您可能必须遵循一些规则,但是大多数规则是由您建立的。 您可以随心所欲地做。

您的学校是您的“框架”: (Your school is your “Framework” :)

There are a large number of rules . You have your own uniform and your seat is fixed that you cannot place your stuff randomly. You are only allowed to do certain things.

有很多规则。 您有自己的制服,座位固定,不能随意放置东西。 您只能做某些事情。

3.关系 (3. The Relation)

Now you have an idea of what a library and a framework is. However, there is one more significant difference between two terms. It’s called ‘Inversion of Control’

现在,您已经了解了什么是库和框架。 但是,两个术语之间还有一个更大的区别。 这就是所谓的“控制反转”

Image for post

谁在控制谁? (Who is controlling whom?)

Our code flows a little bit different on a library and a framework. When we use a library, we are in charge of the flow of the application. We are the ones choosing when and where to call the library. On the other hand, when we use a framework, the framework is in charge of the flow. The framework itself is making calls toward our code.

我们的代码在库和框架上的流程略有不同。 使用库时,我们负责应用程序的流程。 我们是选择何时何地调用库的人。 另一方面,当我们使用框架时,框架负责流程。 框架本身正在对我们的代码进行调用。

4.例子 (4. Examples)

Last but not least, let’s check out the major libraries and frameworks below.

最后但并非最不重要的一点,让我们看看下面的主要库和框架。

热门图书馆 (Popular Libraries)

jQuery, Lodash, React, Redux

jQuery,Lodash,React,Redux

流行框架 (Popular Frameworks)

Rails, Angular, Django, Express

Rails,Angular,Django,Express

5.结论 (5. Conclusion)

Finally, we are able to describe the difference in one sentence.

最后,我们能够用一个句子描述差异。

Q : What is the difference between a library and a framework?

问:库和框架有什么区别?

A : You call a library as it’s a simple tool whereas a framework calls you as it’s a restrictive foundation.

答:您称它为库是一个简单的工具,而一个框架却称其为限制性基础。

Reference ::: Nomad Coder. Difference between Library and Framework. Youtube Jun 17, 2020__ Codecademy. What are Libraries and Frameworks?. Youtube. Jun 5, 2019. __ Hitesh Choudhary. What is the difference between a Library and a Framework. Youtube. Mar 13, 2018

翻译自: https://medium.com/@joyAct/the-easiest-concept-between-library-and-framework-f7c6134dcc6c

ssh框架概念

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值