我为什么要使用jQuery? [英] Why would I want to use jQuery?

查看:73
本文介绍了我为什么要使用jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我知道其他人问了一个类似的问题,它被关闭为'议论',但我真的很有兴趣理解这个问题。)

(I understand that someone else asked a similar question and it was closed as 'argumentative', but I'm really interested in understanding the arguments around this.)

我非常了解JavaScript。我已经专业写了多年了。我已经内化了很多跨浏览器的不兼容性和粗略性,知道像我手上的DOM操作,已经与业内一些最好的Web开发人员合作。他们拾起了很多他们的魔力。

I know JavaScript really well. I've been writing it professionally for years. I've internalized a lot of the cross-browser incompatibilities and sketchiness, know DOM manipulation like the back of my hand, have worked with some of the best web developers in the industry & picked up a lot of their mojo.

我一直在查看jQuery。我理解javascript库的意义(我写了多少次动画,getElementsByClass和hide / show函数?)。但说实话,学习一种并不复杂的全新语法似乎是浪费时间。看起来我正在抨击墙壁来学习同一个旧JavaScript的全新界面。

I've been checking out jQuery. I understand the point of a javascript library (how many times have I written animation, getElementsByClass, and hide/show functions?). But to be honest, it seems like a waste of time to learn an entirely new syntax that isn't less complex. It seems like I'd be bashing my head against a wall to learn an entirely new interface to the same old JavaScript.

我在技术上不是工程师,所以也许我错过了什么。有人可以拼出jQuery的权衡吗?学习和理解jQuery语法真的比学习JavaScript要快吗?

I'm not technically an engineer, so maybe I'm missing something. Could someone spell out the tradeoffs of jQuery? Is it really faster to learn and understand jQuery syntax than to just learn JavaScript?

推荐答案

使用一个有很多好处本土/手写代码框架:

There are a few big benefits to using a framework over homegrown/handwritten code:


  • 抽象。我相信你很自豪你已经把足够多的JS用来从头开始编写动画。你应该!然而,从自己身上抽象出常见的功能实际上是非常自由的。您只需调用该方法并知道将执行内部并执行良好。即使你自己编写低级别的东西非常快,现在仍然花费时间而不是解决今天的问题。

  • Abstractions. I'm sure you're very proud of the fact that you've slung enough JS to be able to write animations from scratch. You should be! However, abstracting common functionality away from yourself is actually very liberating. You just call the method and know the innards will be executed, and executed well. Even if you're very fast at writing the low-level stuff yourself, that's still time you've spent on that instead of solving today's problems.

通用语言。使用通用框架就像说一种通用语言。您可以非常轻松地与其他开发人员协作,每个开发人员都可以在没有摩擦的情况下从其他地方开始。 (与使用本地库为jQuery可以做的事情的应用程序相比。)

Common language. Using a common framework is like speaking a common language. You can collaborate with other developers very easily, and each can pick up where others left off without friction. (Compared to stepping into an application which uses a homegrown library for the things jQuery can do.)

专家。从事jQuery工作的人是JavaScript gods 。我真的,非常擅长JavaScript,你可能也是,但正常的好和jQuery之间有很大的区别。一群精力充沛的人正在不断地研究一小部分常见功能 - 调整它,调整它,增强它以使其尽可能最好。这代表了大量的工时,无论我们有多好,像你或我这样的人根本无法复制。如果你 和jQuery伙伴一样好,你只能通过将你的才能与他们的人才结合起来并为jQuery代码库做出贡献而受益。这是一个疯狂的人才大熔炉。

Experts. The people working on jQuery are JavaScript gods. I am really, really good at JavaScript, and you probably are too, but there's a big difference between normal good and jQuery good. A team of insanely good people are constantly poring over a small set of common functionality - tuning it, tweaking it, enhancing it to make it the best it can possibly be. That represents a huge number of man-hours a single person like you or me simply cannot reproduce, no matter how good we are. And if you are as good as the jQuery guys, you can only benefit by combining your talent with theirs and contributing to the jQuery codebase. It's a melting pot of insane talent.

这篇关于我为什么要使用jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆