javascript框架库_使用JavaScript库和框架的6个理由

javascript框架库

I've seen many articles around the internet from JavaScript fundamentalists that advocate writing your own JavaScript code instead of using JavaScript frameworks like MooTools, Prototype / Scriptaculous, jQuery, MochiKit, YUI Library, and Dojo Toolkit, and I just cannot agree with their reasons for not using these spectacular frameworks.

我在Internet上看到过很多来自JavaScript原教旨主义者的文章,这些文章主张编写自己JavaScript代码,而不是使用诸如MooToolsPrototype / ScriptaculousjQueryMochiKitYUI LibraryDojo Toolkit之类JavaScript框架,我只是不同意他们的理由不使用这些壮观的框架。

Among other reasons, fundamentalists state:

在其他原因中,原教旨主义者指出:

  • You don't learn the deep-down JavaScript code because you're using shortcut functions within the framework

    您无需学习深入JavaScript代码,因为您正在框架内使用快捷方式功能
  • Javascript frameworks are bloated and contain a great amount of code you will never use

    Javascript框架are肿,包含大量您永远不会使用的代码
  • You shouldn't make users download more than what's needed

    您不应让用户下载超出所需数量的内容
  • You shouldn't trust the code of others for your purposes (if you want it done right, do it yourself mentality)

    您不应该出于自己的目的而信任他人的代码(如果您想正确地做,请自己做一下)

Ridiculous. Don't listen to elitists! You SHOULD use JavaScript frameworks for the most important reasons.

荒谬。 不要听精英人士! 出于最重要的原因,您应该使用JavaScript框架。

不要重新发明轮子 (Don't Reinvent The Wheel)

Why write code that's already been written (better)? A good programmer is a lazy programmer, so be lazy. The tools are there -- use them.

为什么要编写已经编写的代码(更好) ? 一个好的程序员就是一个懒惰的程序员,所以要变得懒惰。 工具在那里-使用它们。

用更少的代码做更多的事情 (Do More With Less Code)

Most JavaScript frameworks provide function "chaining." Chaining allows you to do more with less code. Less code means less maintenance time, less download time, and less coding time. Check out MooTools chaining.

大多数JavaScript框架都提供函数“链接”。 链接使您可以用更少的代码完成更多的工作。 更少的代码意味着更少的维护时间,更少的下载时间和更少的编码时间。 查看MooTools链接

节省时间-您不编写自己的操作系统,对吗? (Save Time -- You Don't Code Your Own OS, Do You?)

I love JavaScript as much as the next guy, but some programmers REALLY love developing JavaScript. Let the experts do the tough part, you take their work and make what you'd like of it.

我和下一个家伙一样爱JavaScript,但是有些程序员真的很喜欢开发JavaScript。 让专家们去做艰苦的工作,您可以承担他们的工作,并按自己的意愿做。

可能是,您不是专家 (Chances Are, You Aren't The Expert)

As big as any programmer's ego is, there are people out there that are smarter, more inventive than you. Most Web Developers need to be a jack of all trades and it's difficult to keep up with every language when you're needed in every facet of a website's construction and launch. The minds behind the frameworks have their eyes on JavaScript daily -- trust in them.

和任何程序员的自我一样大,那里的人比你更聪明,更有创造力。 大多数Web开发人员都需要精通所有行业,并且在网站建设和发布的各个方面都需要您时,很难跟上每种语言。 框架背后的思想每天都在关注JavaScript-信任它们。

快感 (Speed Thrills)

The creators of these JavaScript frameworks have their own private pissing contest when it comes to JavaScript speed put a lot of effort into making sure their frameworks are fast. The first job of JavaScript for mass web visitor usage is to be fast -- users expect accuracy, speed is the most important part. Who's fastest today? Check out SlickSpeed.

当涉及到JavaScript速度时 ,这些JavaScript框架的创建者 有自己的私人撒尿比赛 ,他们为确保其框架的 速度 付出了巨大的努力。 面向大量Web访问者JavaScript的第一项工作是快速-用户期望准确性,速度是最重要的部分。 今天谁最快? 查看SlickSpeed

避免使用Cryptic JavaScript基本代码 (Avoid Cryptic JavaScript Base Code)

Why use JavaScript's default functions when you can use a framework's English-named functions? For example:

当您可以使用框架的英文名称的函数时,为什么还要使用JavaScript的默认函数? 例如:

//standard JavaScript
document.getElementbyId('mydiv').style.color = '#f00'; // camel-case the style!

//mootools JavaScript
$('mydiv').setStyle('color','#foo');

These are the reasons I use JavaScript frameworks. Need I say more?

这就是我使用JavaScript框架的原因。 需要我多说?

Do you have more reasons? Please share them!

您还有更多原因吗? 请分享!

翻译自: https://davidwalsh.name/6-reasons-to-use-javascript-libraries-frameworks

javascript框架库

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值