开发者

Starting with Javascript - framework?

I don't know much Javascript - jus开发者_如何学JAVAt little of core language, but that can be learnd - no problem. I want to get started writing simple demo animations/games with canvas.

What I'm not sure about is correct ways of embedding Javascript in pages to make resonably cross-browser (say without IE). Should I just start with vanilla JS or use some framework like JQuery from start which can help me shorter code and cross-browser?

Or will starting with framework will make me understand less details of JS itself?


Use a framework like jQuery. You don't learn anything particularly insightful by struggling with the somewhat baroque, inconsistent, and incompatible APIs that jQuery (or any other decent framework) abstracts over. You'll still be using the same language, you'll just be using nicer, more portable APIs on top of it.

As you get more experienced, you'll find situations that your framework doesn't cover, or in which you need to extend your framework. At that point you can start dealing with the actual APIs that the browsers expose, and the incompatibilities and inconsistencies that dealing with them entails.

For very simple noodling around with <canvas>, you can frequently get a way with raw JS without too much trouble, as the browsers that support canvas also tend to be more consistent with each other (though the APIs will be a lot clunkier than what jQuery provides). Of course, you could use excanvas for <canvas> emulation IE, at which point you have to deal with the incompatibilities again.


Hmm, I'm always of the opinion that it's best to try somethng yourself the first time just to understand what the framework is doing for you. It has always helped. For example, I can't imagine programming ASP.NET without knowing HTML or CSS.

Whatever a framework does for you, it does TO you. Start by scratching around in javascript on your own before busting out jQuery.


Do learn Javascript, and learn it well. the core Javascript language is somewhat clean and very powerful. Understanding the language will help you understand and use the libraries better, as they tend to make very heavy use of the power of the language.

Use a nice library. Learn the underlying APIs first if you have lots of time. If you learn the Javascript language well, you should be able to learn the APIs on demand when you really need them. As for the underlying crud that the major libraries hide (DOM support, spotty AJAX support, lack of some obvious tools), you may have to wade into the libraries someday in order to fix something.

As fas as libraries go, I haven't used jQuery, but it has definitely become popular. Given the talk about it, I would say it's a safe bet. I mostly use prototype.js. That generally includes using Scriptaculous and some of the Livepipe controls, and also Lightbox.


jQuery is like driving an automatic vs struggling with a stick shift. You still need to know how to drive but you'll get there with less stress using the current tools.


If you are doing canvas work, Raphael.js is a great choice, I highly recommend it. For a general library for accessing and manipulating DOM elements, I recommend jQuery.

I DO NOT recommend skipping learning all of JavaScript. I really like the keynotes Doug Crockford has given on the Yahoo Developer video network on JavaScript, you should watch them.


I think jQuery is a good place to start.

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

  • Leightweight Footprint

  • CSS3 Compliant

  • Cross-browser

It is well doumented and has many Tutorials available.


Should I just start with vanilla JS or use some framework like JQuery from start which can help me shorter code and cross-browser?

Yes, library likek jquery does most of the cross-browser handling itself something you have to do manually with normal javascript.

Or will starting with framework will make me understand less details of JS itself?

If you understand the core of javascript, the framework/library will be easier to understand. Starting with a framework/library, yes they have their own peculiar syntax but still standards and core of the language remains the same.


If you're just jumped into the JS-biz, try DomAssistant. It's a lightweight framework (without animation and widget stuff), with excellent documentation. Later, you can keep using it, or switch to another framework, but it's ideal as the first one.

http://www.domassistant.com/

If you have a small hobby project, you should try out bare JavaScript first, so later you could feel the difference when you start using a framework.


If your are looking for a JS library there are good number of them out there,
1. Prototype & Scriptaculous
2. JQuery & JQuery UI
3. YUI
4. DOJO
5. ExtJS

Out of which i like
1. JQuery because its unique way of writting code and selector feature which is really cool.
2. YUI has very good documentations available with examples.

Also for above two we have good community available to answer for queries. I will suggest you to learn basics of JS first as there is no alternative to basics what if framework JS is there this will help you understand frameworks. Then try on these two and selecting one of the two will be fine.


If you already know Java go with GWT. One cannot commparethe rich toolset available in java with Eclispe and so on with the medievil javascript editors that are currently available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜