简体   繁体   English

在学习Javascript时,软件开发人员使用jQuery是否有意义?

[英]Does it make sense for software developer to use jQuery when learning Javascript?

It's often claimed that learning a lower-level language is a good foundation for any new developer. 人们常说,学习低级语言是任何新开发人员的良好基础。 What about an experienced developer (say a C++ or Java guy) learning Javascript? 学习Javascript的经验丰富的开发人员(比如C ++或Java人)怎么样? in the same way should he learn using the raw language so he understands what's going on, and learn JQuery later, or use JQuery from the start as 'part of' Javascript? 以同样的方式,他应该学习使用原始语言,以便他了解正在发生的事情,并在以后学习JQuery,或者从一开始就使用JQuery作为'Javascript的一部分?

I think it's worth spending a bit of time working on JavaScript without jQuery so you can appreciate just what jQuery brings you. 我认为花一点时间在没有jQuery的JavaScript上工作​​是值得的,所以你可以欣赏jQuery带给你的东西。 But most of what you'll be learning in JavaScript ( getElementById etc.) will be replaced by better jQuery functions, so don't spend too long in pure JavaScript. 但是你在JavaScript getElementById大部分内容( getElementById等)将被更好的jQuery函数所取代,所以不要在纯JavaScript中花太多时间。

I guess the important thing to realise is that a lot of what you do in JavaScript is actually just working with the DOM API. 我想重要的是要认识到,你在JavaScript中做的很多事实上只是在使用DOM API。 The JavaScript language is great, but the DOM API is RUBBISH. JavaScript语言很棒,但DOM API是RUBBISH。 jQuery doesn't really abstract the language, just the API. jQuery并没有真正抽象语言,只是API。 So the distinction isn't between using JavaScript or using jQuery, it's more about using the DOM API vs using jQuery. 所以区别不在于使用JavaScript或使用jQuery,而是使用DOM API和使用jQuery。

It's always good to understand the basics of 'raw' JavaScript. 理解“原始”JavaScript的基础知识总是很好的。 I would recommend learning basic JacvaScript first, then jQuery. 我建议先学习基本的JacvaScript,然后再学习jQuery。 It'll make jQuery easier once you know the basics of the language, and there are still quite a few scenarios where it's preferable to do parts of a code in regular JavaScript than the jQuery way. 一旦你了解了语言的基础知识,它将使jQuery变得更容易,并且仍然有很多场景,在常规JavaScript中比jQuery方式更好地执行部分代码。

You could still try to learn about both in parallel, but either way it is still important to understand JavaScript to really understand appreciate jQuery. 您仍然可以尝试并行学习两者,但无论哪种方式,理解JavaScript以真正理解jQuery仍然很重要。

I am pretty new to JavaScript myself, and I had a few months to learn raw JavaScript before finding out about jQuery. 我自己对JavaScript很陌生,在找到jQuery之前我有几个月的时间学习原始JavaScript。 I agree with GSto that learning raw is good, but don't spend to much time in it before looking at a framework. 我同意GSto认为学习原始是好的,但在查看框架之前不要花费太多时间。

Apart from that, I strongly recommend anyone building in Javascript to pick up a copy of Douglas Crockford's JavaScript: The Good Parts. 除此之外,我强烈建议任何使用Javascript构建的人都可以获取Douglas Crockford的JavaScript:The Good Parts。 Read it back to back and then keep it close to your computer! 请背靠背阅读,然后将其靠近计算机!

JavaScript differs from C-like languages quite dramatically at some points... JavaScript在某些方面与C语言的区别非常显着......

EDIT: Crockford held a great talk at Øredev 2009. They have the whole talk in video on their site . 编辑:Crockford在Øredev2009举行了一场精彩的演讲。 他们在他们的网站上进行了整个视频讲座

Learn Javascript first and about DOM, object literals, closures and currying . 首先学习Javascript,关于DOM,对象文字,闭包和currying When you master these things you are ready to use a library. 掌握这些东西后,您就可以使用库了。

If you want to be a good web-developer who knows javascript, then do not touch jquery for at least year. 如果你想成为一个了解javascript的优秀网络开发人员,那么至少每年都不要触摸jquery。 It will corrupt you. 它会腐蚀你。 Seriously, I've seen too many people who claim that they know javascript but are unable to iterate through an array without using jquery. 说真的,我见过太多人声称他们知道javascript但是在不使用jquery的情况下无法遍历数组。

I think you should learn raw language before jquery or another framework. 我认为你应该在jquery或其他框架之前学习原始语言。 If you do, cou can learn jQuery basis wery quickly. 如果你这样做,cou可以快速学习jQuery基础。

I learned JavaScript before I did anything with jQuery and I would recommend the same to any one thinking to learn JavaScript, as this would allow you to move to another library or use raw JavaScript if you found that jQuery wasn't really suited to what you need or if you simply didn't like jQuery. 我在使用jQuery做任何事之前学过JavaScript,我会向任何一个想学习JavaScript的人推荐相同的内容,因为如果你发现jQuery不适合你,你可以转移到另一个库或使用原始JavaScript需要或者如果你只是不喜欢jQuery。

There may be some cases in which using raw JavaScript is better suited to what you want to do. 在某些情况下,使用原始JavaScript更适合您想要做的事情。

It's very important to learn the language itself, and somewhat important to become familiar with the issues faced by things like jQuery in making the programming environment more uniform across different browsers. 学习语言本身非常重要,并且熟悉jQuery之类的问题,使编程环境在不同浏览器中更加统一,这一点非常重要。 However, except as exercises for people who have the time, attempting to re-implement the facilities that modern frameworks provide is a pretty bad idea. 然而,除了作为有时间的人的练习,试图重新实现现代框架提供的设施是一个非常糟糕的主意。

A benefit of learning a modern framework is that they generally encourage the exploitation of the native power of Javascript, and avoid trying to make the language look and act like something it isn't. 学习现代框架的一个好处是,它们通常鼓励利用Javascript的本机能力,并避免尝试使语言看起来像行为不是。 You have to develop a good feeling for what anonymous functions are and how they work, for example, in order to really use Prototype or jQuery or just about any other framework effectively. 你必须对匿名函数及其工作原理产生良好的感觉,例如,为了真正有效地使用Prototype或jQuery或任何其他框架。

Finally, reading the source code of a good modern framework is wonderfully enlightening. 最后, 阅读一个好的现代框架的源代码是非常有启发性的。

Think of JQuery as being an abstraction that just happens to be built using Javascript. 可以把JQuery想象成一个恰好使用Javascript构建的抽象。

Most things that you need to do can be done elegantly with JQuery. 您需要做的大多数事情都可以通过JQuery优雅地完成。

To use JQuery effectively it is more important to understand the DOM, Events and CSS. 要有效地使用JQuery,了解DOM,事件和CSS更为重要。

It helps me to think of JQuery and Javascript as being different paradigms even though we all know that JQuery is written in JS. 它帮助我将JQuery和Javascript视为不同的范例,即使我们都知道JQuery是用JS编写的。

I came to Javascript from a C/C++ background and it took me a while to really get to grips with the object model first-class functions, inner functions and closures and prototypes. 我从C / C ++背景来到Javascript,我花了一些时间才真正掌握了对象模型的第一类函数,内部函数和闭包以及原型。

JQuery is much clearer, easier to follow, and more powerful once you understand what it is that you are manipulation (ie DOM, Events, CSS). 一旦你理解了你正在操作的东西(即DOM,事件,CSS),JQuery就会更清晰,更容易理解并且更强大。

So I'd learn JQuery first and fill in the Javascript gaps as they appear. 所以我先学习JQuery并填写Javascript缺口。

Don't forget that document.getElementById is still the fastest way of getting elements. 不要忘记document.getElementById仍然是获取元素的最快方法。 So if you do simple stuff and that's sufficient so why use a library? 所以,如果你做简单的东西,这就足够了,为什么要使用一个库?

Read what Joel Spolsky says about abstractions. 阅读Joel Spolsky关于抽象的内容。 What happens when your abstraction layer leaks ? 抽象层泄漏时会发生什么? Do you know why the problem happened, or what you can do to fix it? 你知道为什么会出现这个问题,或者你能做些什么来解决它?

我会先开始学习javascript语法和用法,但不要过多关注不同的函数,因为很多函数会有更好的jQuery替代品。

The answer - both. 答案 - 两者兼而有之。

If you are working on something professionally and have a deadline... JQuery. 如果你正在从事一些专业的工作,并有一个截止日期...... JQuery。 Then go home and learn the internals. 然后回家学习内部。 JQuery is very powerful and there is no need to reinvent the wheel. JQuery非常强大,没有必要重新发明轮子。 Sometimes the best code you write... is no code at all. 有时你写的最好的代码......根本就没有代码。

Now that being said, its always a good idea to understand your code and the "black majic" that happens under the hood. 现在要说的是,了解你的代码以及在幕后发生的“黑色majic”总是一个好主意。 This helps to decide which JQuery method or selector to use for the best job... measure the pros vs cons. 这有助于决定使用哪种JQuery方法或选择器来获得最佳工作...衡量优缺点。

You should do both at the same time. 你应该同时做两件事。 Learn javascript loops, types, prototypes and just forget the DOM methods because jQuery is more elegant for that. 学习javascript循环,类型,原型并忘记DOM方法,因为jQuery更优雅。

You should learn basic js first, variables, loops, functions, closures, inheritance, and js design patterns. 您应该首先学习基本的js,变量,循环,函数,闭包,继承和js设计模式。 If you're already a programmer, you can skip a lot of stuff. 如果你已经是程序员,你可以跳过很多东西。 jQuery is not a language. jQuery不是一种语言。 Once you know that, then jquery is a tool, that mostly helps you abstract differences between browsers (and provides another dialect of js). 一旦你知道了,那么jquery就是一个工具,它主要帮助你抽象浏览器之间的差异(并提供另一种js方言)。 I don't use jquery, I use ext-js (another tool, another dialect), so I would caution strongly against learning jquery as if it were a language. 我不使用jquery,我使用ext-js(另一种工具,另一种方言),所以我会强烈反对学习jquery,就像它是一种语言一样。

If you're going to work with the DOM (as admittedly most do, since most Javascript is used for client-side web development), then JQuery will be helpful. 如果您打算使用DOM(尽管大多数人都这样做,因为大多数Javascript用于客户端Web开发),那么JQuery将会很有帮助。
However, don't confuse it with the language Javascript - JQuery is just another library for DOM access, albeit a very ubiquitous and imho great one. 但是,不要将它与Javascript语言混淆 - JQuery只是另一个用于DOM访问的库,尽管它非常普遍且非常棒。 I'd say it's somewhat analogous to asking if it's wrong to use Win32 or some other platform API while learning C++. 我会说这有点类似于在学习C ++时询问使用Win32或其他平台API是否错误。

jQuery is just one of several libraries out there. jQuery只是其中几个库之一。 What are you going to do if you don't use jQuery or the company you work for doesn't? 如果你不使用jQuery或你工作的公司不打算怎么办? Using this library does carry some weight, too. 使用这个库也确实带来了一些重量。 Are you going to always use it even if you only needed one minor feature? 即使您只需要一个小功能,您是否会一直使用它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 什么时候在 Javascript 中使用双重相等(松散相等)有意义? - When does it make sense to use double equality (loose equality) in Javascript? 在JavaScript中使用===进行字符串比较是否有意义? - Does it make sense to use === for string comparison in JavaScript? 在前端 javascript 应用程序中使用 DI 容器是否有意义 - Does it make sense to use DI container in front end javascript app 在JavaScript块上使用HTML注释仍然有意义吗? - Does it still make sense to use HTML comments on blocks of JavaScript? 我的JQuery存在功能:有意义吗? - My JQuery exist function: does it make sense or not? 将Web Workers用于游戏是否有意义? - Does it make sense to use Web Workers for a game? 在$ watch回调中使用$ scope是否有意义? - Does it make sense to use $scope into a a $watch callback? 学习Javascript / Jquery promise&deferred,多次使用时出现$。 - Learning Javascript/Jquery promise&deferred, issue with $.when multiple use 什么时候JavaScript ==比===更有意义? - When would JavaScript == make more sense than ===? 尝试协助JavaScript垃圾收集器是否有意义? - Does it make sense to attempt to assist the JavaScript Garbage Collector?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM