[英]What to learn before using a JavaScript library / framework?
It seems that many of the JavaScript questions are answered by the simple use of pushing a library, without taking into account the person asking the question. 似乎许多JavaScript问题都可以通过简单地使用推送库来解决,而无需考虑提问者。 I think libraries are great myself, but sometimes I think that we're too quick to throw a library down someone's throat. 我认为图书馆本身就是很棒的,但是有时候我认为我们太快了,无法将图书馆扔掉。
Imagine a person asks a question and it's apparent that they barely know JavaScript. 想象一个人问一个问题,很明显他们几乎不懂JavaScript。 They're just using code they found and piecing it together with other code, and really have no firm foundation to work on. 他们只是使用找到的代码并将其与其他代码拼凑在一起,实际上并没有扎实的基础。 To add a library on top of that flimsy foundation seems like a disaster waiting to happen. 在脆弱的基础之上添加一个库似乎是一场灾难,等待发生。
With that in mind, what JavaScript / programming / web browser concepts do you think are necessary to understand before a library/framework is introduced to a person? 考虑到这一点,您认为在将库/框架引入人之前,您需要了解哪些JavaScript /编程/ Web浏览器概念? Should a framework / library be part of the learning process? 框架/库是否应该成为学习过程的一部分?
I don't think someone has to grasp absolutely everything to use a library, I just think some people would be better served with a "Library X might help solve your problems, but before you do that, you might want to read up on the following concepts", rather than just a "use library x" answer. 我认为没有人必须掌握使用图书馆的所有知识,我只是认为有些人可以更好地使用“图书馆X可能有助于解决您的问题,但是在您这样做之前,您可能需要阅读一下遵循概念”,而不仅仅是“使用库x”答案。
What you should learn are some fundamental programming techniques: 您应该学习的是一些基本的编程技术:
With that in mind, today its practically impossible to develop without a library. 考虑到这一点,今天没有图书馆几乎是不可能开发的。 I recommend Dojo but others use jQuery, YUI, etc... 我推荐Dojo,但其他人则使用jQuery,YUI等。
When choosing a library, you need to have a firm understanding of what problem you are trying to solve. 选择图书馆时,您需要对要解决的问题有深刻的了解。 Is it browser abstraction? 是浏览器抽象吗? dealing with communication? 处理沟通? charting? 图表? animations? 动画? graphics? 图形? UI toolkits? UI工具包?
Each library has its "niche", so you need to really know what you're specific problem domain is and in turn choose a library accordingly. 每个库都有其“利基”,因此您需要真正了解特定问题领域,然后相应地选择一个库。
I think that one reflex reaction to a "how do implement X" is "don't reinvent then wheel", and this is generally good advice. 我认为,对“如何实现X”的一种反射反应是“不要重塑然后再动”,这通常是个好建议。 I think that if you have to ask how to do something reasonably complex, and it's already in a library then you're going to waste massive time trying to piece together something from a few answers on SO. 我认为,如果您必须询问如何做相当复杂的事情,并且已经存在于库中,那么您将浪费大量时间来尝试从SO的一些答案中整理出一些东西。
So barring the obvious: learn the syntax of the language, learn how to debug etc., by and large a library is the right answer. 因此,显而易见的是:正确地答案是:学习语言的语法,学习如何调试等。 And that's not just to say "Use the library, disengage brain" it also means "Study the library, look at the issues it's solving - you didn't realise your problem was so complex? Well the folks who put hours and days into the library studied the problem in some detail and probably developed the library by using it extendsively. Study the implementation and learen how." 这不仅意味着“使用图书馆,放松大脑”,还意味着“研究图书馆,看看它正在解决的问题-您没有意识到自己的问题是如此复杂?库对问题进行了详细研究,并可能通过扩展使用库来进行开发。研究实现并学习方法。”
I think that studying good code is a very good way to learn. 我认为,学习好的代码是学习的很好的办法。
Libraries bring similarities to browsers where so much is different from browser to browser. 图书馆给浏览器带来了相似之处,浏览器之间的差异很大。 This is why, I'd suspect, people suggest their usage in various answers. 我怀疑这就是为什么人们在各种答案中建议使用它们的原因。 Nothing is stoping anyone from reading a good js book if they want to actually understand what is going on, but we surely cannot shove books and tutorials down anyone's throat. 如果他们想真正了解正在发生的事情,那么什么都不会阻止任何人阅读一本优秀的js书籍,但是我们当然不能推销任何人的书籍和教程。 You need to want to learn before that would be worth anything. 你需要想了解之前,这将是值得任何东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.