JavaScript before jQuery [duplicate] - javascript

This question already has answers here:
Closed 13 years ago.
Duplicate:
What are some of the pros and cons of using jQuery?
Should I avoid using a JavaScript library while learning how to write AJAX client code?
I've read it so many times... "I'd learn JavaScript before learning something like jQuery" - but is this really necessary for every situation? Sure, some people like to know what's going on under the hood, but are there any serious negative side effect of heading straight for jQuery tutorials/books? I want to learn something in my spare time and I've decided on jQuery (or JavaScript if anyone can convince me strongly enough).

jQuery is a library, not a language. You've essentially said, "I am thinking of learning how to write English songs. Some people say that you should learn English first, but I'm not convinced that it's worthwhile, I just want to rock."
You can probably still pick up jQuery without learning JavaScript first, but you ultimately will understand nothing of how jQuery is actually working and likely just come to accept that it's magic. Good luck when jQuery breaks or doesn't work how you expected it and can't figure out why your code is broken.
JavaScript is a beautiful language, and worth learning in its own right. Start here: Eloquent Javascript.

The reason of the typical recommendation "learn JS before jQuery" is because you'll find yourself too many times asking yourself how some jQuery snippet works, when it's not a problem of jQuery but JS syntax / etc (e.g. closures).
Go for JS, you won't be disappointed.

That's like asking if it's worth learning learning Objective-C before using Cocoa. It's kind of a weird question, because Cocoa is in Objective-C, much the same way as jQuery is written in JavaScript. When you learn jQuery, you learn some JavaScript whether you like it or not.
I think what you're wondering is more along the lines of "should I learn the underlying JavaScript that jQuery bypasses with its core library and plugins?" It depends on the circumstance, of course; if you need code in a hurry, you're much better off learning jQuery alone. But since your goal seems to be to learn something in your spare time, I personally think it's a good idea to learn basic JavaScript before diving into jQuery:
If you ever need to figure out how the internals of jQuery works, you'll need to know core JavaScript. This is especially important given how many jQuery plugins are out there.
If you ever need to extend jQuery or plugin functionality, you may have to know more detailed JavaScript.
If all you know is jQuery, you'll find it harder to work with other frameworks and/or vanilla JavaScript if you ever find yourself in that situation.

There is no question about it. jQuery is JavaScript. You'll be handicapping yourself severely if you jump straight into jQuery. Your code will be slow and unmaintainable. jQuery is an API, it's not a language.
In fact, you could try jumping into jQuery but I doubt you'll get very far without being frustrated with hurdles that would be otherwise trivial. At the very least, you should understand the concepts in Re-introduction to JavaScript.

It's very good advice actually.
The problem is this. Javascript doesn't work the same way most of the other popular languages work. If you dive into Javascript with the idea that it is similar to Java, C#, Perl, PHP, etc, then you'll end up thinking Javascript is a bizarre, inconsistent mutant language that makes no effing sense whatsoever. This isn't because Javascript makes no sense, it's because Javascript is different at its foundations. Javascript is an object oriented language, but it isn't class based, it's prototype based. The syntax is similar enough to where you could work just fine thinking Javascript was class based up until the point where everything goes horribly wrong.
Learn Javascript first, at least the fundamentals. It's not that difficult, you don't even need a special IDE or compiler since you can just use a browser or WSH. Learning the fundamentals of Javascript will definitely pay off if you're using jQuery.

A lot of learning and using jQuery comes for free to begin with and can be motivating as it provides an immediate sense of productivity. There does come a point however, where you need to understand JavaScript in order to use jQuery effectively or any other JavaScript framework for that matter. This is particularly pertinent for example, when writing plugins and utility functions.

For the same reason VB6 programmers needed to understand the Windows API to get anything done, and VB.NET and C# programmers need to at least know what MSIL looks like, you should be familiar enough with JavaScript to understand what jQuery is doing. There's a lot of far-out stuff built into JavaScript that most people never need to use, but if you don't know it exists, you'll always overlook good solutions to your problems.

JQUERY is just a library, not a substitue for language like JAVASCRIPT. You wont be going ahead in the field of the softare developement by just learning the LIBRARY. Basic understanding of the core langauge is always the better way to go. And of course, once you have that grasp, then you can and should definitley use libary like JQUERY.

I feel rather strongly that JavaScript is a more important concept than jQuery or any of it's siblings. These libraries are wonderful, and I can hardly imagine doing anything in the client without their help, but by themselves they only provide some tools and a bit of flashy polish. To actually accomplish any real logic, you will need a good understanding of JavaScript and the objects that are available in the browser.

Short answer to your question is yes if you ever have written anything in any normal language.
If you want to know why, watch JavaScript the good parts by Douglas Crockford (JS guru).

Related

resource for javascript without jQuery

Is there any repository of code snippets, tutorials, whatever, that concentrates on pure JS, without the use of frameworks?
I first approached javascript through scriptalicious then jumped to jQuery. I am now a seasoned jQuery developer, and I've done quite a lot in jQuery throughout the years.
My problem is, I've almost never coded in pure JS. By the time I got advanced in coding in general (I mean, cross-language), my JS coding style relied already heavily on jQuery.
Plus, each time I research a solution for a problem, the first results (or pages of results) in google involve jQuery, or, more rarely, another Js framework. Which leads me to this problem: since I have developed a lot of custom plugins, some fairly complex, for jQuery, I am quite sure I do know a lot of JS. But I can't tell the difference!
So I decided that from now on, and as long as I feel the need, I am going to try to use pure JS, at least at the beginning of each project (leaving myself enough time to revert to good old jQueryScript if I get stuck). My problem is I am way too advanced to follow beginner's tutorials. I would like to know if any of you guys has a suggestion for a place to begin my training. Some website where I could learn advanced JS, without frameworks.
I actually think Resig's book, Pro Javascript Techniques would be a great fit. I read it a while ago and my memory of it was that he walked through a lot of the kinds of cross browser issues one can experience with Javascript and talks about how one could create code to help remediate those issues.
Ultimately that thinking is what jQuery is all about, but this book is not a jQuery book at all, more focused on JavaScript, approaching the same kinds of problems jQuery makes you not have to think about.
Might be a great fit for where you are, and it is by no means a beginner book.
http://www.amazon.com/Pro-JavaScript-Techniques-John-Resig/dp/1590597273/ref=sr_1_1?ie=UTF8&s=books&qid=1310240944&sr=8-1
If you want learn more about JavaScript in general and really master it, there are two books that I would recommend:
JavaScript: The Definitive Guide
JavaScript: The Good Parts
Both are excellent resources with great depth and cover fairly advanced topics.
If you would like to explore the possiblities of JS outside the browser and explore some cutting edge JS then take a look at the Node.js and CommonJS projects.
I recommend using this Google group:
http://groups.google.com/group/jsmentors

Is it necessary to learn JavaScript before learning jQuery? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Is it a good idea to learn JavaScript before learning jQuery?
I am about to start learning JavaScript. However one friend suggested me to go in for jQuery instead since he says future is jQuery. I heard that jQuery is created from JavaScript.
In short, give me one simple reason why developers like me should invest in JavaScript. What is its future?
Part of being a good programmer is having an interest in understanding how things work. You can't understand how JQuery works without knowing JavaScript.
A good programmer has a diversity of skills. Knowing both the JQuery way to do things and the JavaScript-only way makes you more versatile.
Most employers who are looking for someone who knows JQuery are probably also looking for someone who knows ordinary JavaScript.
You can never achieve true expertise in JQuery without understanding JavaScript.
Sometimes even a fairly lightweight framework is more than you need.
If you don't ever learn to do things the hard way, you won't appreciate what's so great about doing it the easy way.
Moreover, if you start by learning to do things the easier way, you'll have that much harder a time motivating yourself to learn to do it the hard way.
Learning the language first without the fancy frameworks builds character.
Who knows, maybe you'll want to make your own framework someday. Or even work on a new version of JQuery. To do that, you'll need to know the language.
jQuery is JavaScript and yes, it makes things a lot easier for you and you can use it without much JavaScript knowledge, and yes, it will probably become even more popular in the future.
BUT: Wherever is jQuery, there will be JavaScript. jQuery is "just" a tool. You still need "plain" JavaScript to solve some problems, e.g. string manipulation.
Imho: You cannot master jQuery if you don't master JavaScript.
And there will be situations where jQuery might be not the best solution, e.g. when you really need high performance.
For me, this is similar to other questions I read here on SO about web frameworks and programming languages, like: Do I have to learn/know PHP if I want to use [Zend | symfony | CodeIgniter].
Seriously: If you don't understand the basics, you cannot use a tool efficiently.
JQuery is a library, written in Javascript, the language. It is almost always the case that learning the library without learning the language is impractical if not impossible, irrespective of the library and the language in question.
jQuery will come and go.
You are a web developer, right? Javascript is huge. Think how much time people spend using a web browser. The entire time they are interfacing directly with html dom, css, and javascript. Or, less and less, flash and "actionscript" (which is basically javascript).
Learn javascript, learn css, learn the dom. Refer to ecma-262 versions 3 and 5 and publications by w3c and whatwg. Read mozdev, cross-check msdn.
After that, take a look at jQuery if you want. You will probably find that you don't need it for 99% of the stuff people use it for.
Every browser has its own implementation of Javascript ( the language ) and the DOM ( library for manipulating elements on the page ). Because of the inconsistency of each browsers Javascript + DOM with another, jQuery ( created with Javascript ) was created as a wrapper that internally deals with these inconsistencies so you can use the easy API.
Underneath the hood, most of your problems are already solved for you so you don't have to think about issues like:
invoking functionality for the DOM ready event
a consistent way of attaching event handlers for click, mouseover and other events, attaching multiple functions to the same action
returning the proper values for elements as well as viewport ( window ).
Because jQuery is a Javascript library you won't master it without mastering Javascript. See my previous answer for recommendations for learning Javascript.
You do not need to know JavaScript in order to use jQuery.
This depends what you want of course.
If you want to put together web pages and don't consider yourself the 'programming type' or you simply don't like JavaScript, then don't bother, spend your time where it will matter most.
Your also asking this question on a site where majority of users are developers so your going to get a lot of people who say you should learn JavaScript, I say learn it if it interests you.
There are pleanty of jQuery solutions out there and support so that you don't need JavaScript.
jQuery IS JavaScript. When you are writing jQuery, you are writing in javaScript. All a library like jQuery consists of is a premade collection of functions you can use in your JavaScript programs.
So, you have to know JavaScript syntax and the core language in order to use jQuery at all. A good book for that is Douglas Crockfords the Good Parts.
What you do not need to know as much about is the DOM API, since that is mainly what jQuery smooths over for you. It helps a lot to understand the concepts of the DOM, though. You still need to know what an element is, and what attributes are.
You also need to know about CSS in order to use jQuery effectively. The key concepts here are classes, IDs, positioning, visiblity and display, among others.
Yes you CAN use jQuery without knowing JavaScript. In fact, I knew very little about JavaScript originally but by using jQuery it sparked my interest to learn it and so I did. Years later I can say I am very proficient with both.
As you progress in your programmer expertise you would find that you go from library writer to library user. This is quite natural and OK. When you are starting off, all you have is the basics. You write your code in terms of those basics and over time find that you need to bunch common code in a library for easier reuse.
Sometime later you find that someone has already done just that and created a library that's even better than yours. You then switch from being library writer to library user. jQuery is one such library and you really need to know JavaScript to be able to draw a line in your head as to where jQuery is and where JavaScript is.
My advice, in light of the above, would be to learn the underlying technology before getting started with the library (which is what jQuery is). However in this case I would make an exception - skip DOM manipulation. DOM is a stupid abstraction and will have you tear your hair out in no time flat. jQuery wraps it up quite nicely, might as well get stuck into that after you understand JavaScript basics.
you can read this
edit
However one friend suggested me to go
in for jQuery instead since he says
future is jQuery.
If you go for jQuery, of course you are still learning Javascript...
You can not understand jQuery if you can not understand how Javascript works.
Some programmers learning jQuery wihtout the knowledge of javascript thought that they are learning a new programming scripting language. But they did not know that jQuery is not. They are just using jQuery as a tool. They are still coding Javascript...
If you want your Javascript codes to be cross-browser,
with less hassle, go for jQuery... but still you need the basic (or at least) knowledge of Javascript.

Does being good in jQuery imply being good in JavaScript?

I'm pretty efficient in jQuery, having implementing it in several projects for my company. However, I found myself a little lost when reading stuff like node.js.
Do I have to go back to basics and learn the JavaScript language or should I just stick with jQuery?
One more thing I would like to ask: Does coding in plain JavaScript increase performance compared to coding with jQuery? For my own experience, coding heavy, complex combination of animation in jQuery always seems to take up large amount of the computer memory.
You should understand what's going on, to a degree. It doesn't hurt to know what's underneath, but sometimes that's not optimal to know everything either, for example: is .innerHTML consistent? Not completely, e.g. <select> in IE. Does that mean you need to know every inconsistency? Not if you're letting jQuery handle it.
People say you need to understand JavaScript before jQuery, let me say I agree, however there are limits to that though, you don't necessarily need to know every quirk and inconsistency between browsers for example, that's why we use an abstraction layer.
To me, this is no different than saying you need to learn assembly before C#, should you know what's happening, how memory is referenced, what a pointer is? I think so, do you need to know every detail? Probably not. We would never progress if every new programmer goes through learning every layer beneath, this is why math theorems build upon others known to be true, same concept.
You should be able to trust your abstraction layer. Is this always true? unfortunately not, but jQuery does a pretty good job at being as consistent as possible and always improving. More importantly, the community does a good job of making the inconsistencies known.
Edit: Let me caveat everything above by saying if you can learn what's underneath do so (this applies to most any abstraction in my book, not just JavaScript), it will help you program better and more efficiently. If you know what's going on under the covers, you can more optimally take advantage of it.
It's a lot like apples and oranges, actually. jQuery is awesome library but it focuses on DOM manipulations. It does not help you much with general coding, prototype inheritance, closures, data types and other important stuff you have to deal with when programming.
node.js have nothing to do with DOM, so it is very much orthogonal to jQuery, no wonder you have trouble understanding it.
Note, however, that knowledge of JavaScript won't necessarily mean you'll be efficient with every JavaScript library out there. Each library makes kind of a superset of a language, a domain specific language to help with specific task that library was built to solve. You will always have to learn that DSL first to be efficient but it'll be easier to understand internals of any given library if you know JavaScript well.
If you are only interested in application programming (web sites and applications) then jQuery is more than adequate. If you want to develop a JavaScript framework or library, then proficient knowledge of the JavaScript language is necessary.
Does being good in jQuery imply being good in JavaScript?
No. I strongly suggest you learn the basics and then some.
jQuery is just a library. While productive, being well versed in the functionality that a library provides is not the same as being good at the language in which that library is written in.
I'm not saying that you need to know that all bitwise operations are converted to signed 32-bit integers in big-endian order, but you do need to know about core concepts like closures, how to properly attach event handlers, and the basic concepts of asynchronous/event oriented programming.
What if you were to change jobs to a company that uses ExtJs instead of jQuery? Understanding the core concepts of the language will make these sorts of transitions non-problematic.
Another thing to consider is that for every library, there is always a task that it doesn't support. Being reliant on a library to always do the heavy lifting will eventually bite you in the hind parts.
Does coding in plain JavaScript increase performance compared to coding with jQuery?
Libraries typically aim to be as generic as possible for the area of use they are targeting. Because of this, inefficiencies may occur in some scenarios that could be otherwise optimized outside of the library.
It all depends on how adept you are at JavaScript, algorithm selection/creation/analysis, and programming in general. When you start concerning yourself with being as high performing as possible, you really need to be able to get down to the finer details of a language. "Being good" at jQuery, or any library for that matter, will likely not help you with this (unless you're looking under the hood and implementing their techniques in a manner that is specific to your scenario).
jQuery is just a list of (very) useful functions, written in JavaScript.
You are just using the library without understanding what's behind it
and how things work. Most of the time you will only need jQuery for maybe 20%-40%
of your code, and the rest will be pure JavaScript, so I encourage you to learn the
basics. These are good places to start with:
http://www.w3schools.com/jsref
http://howtonode.org/what-is-this
http://net.tutsplus.com/tutorials/javascript-ajax/the-basics-of-object-oriented-javascript/
http://ejohn.org/apps/learn/
I'm a bit ambiguous on this. Knowing real deep JavaScript is a great art - I am always in awed silence when one of our resident deep JavaScript experts comes to the table. However, not everyone needs that kind of deep knowledge - if you're focused on building interfaces, knowing one of the frameworks well may be everything you ever need, with very few edge cases.
On the other hand, knowing at least the basics of how JavaScript works under the hood can only be beneficial. If you feel driven to take a look into it, I'd say do it. You don't have to become a total guru in fundamental JavaScript but having a basic idea of how data is handled internally, how events are processed by the browser, how memory is managed, etc. is a good thing.
Not necessarily, it is like saying like being good in Java is same being good in byte code since it is using the byte code.
jQuery is an abstraction layer for JavaScript, and for this reason most of the time you will be doing it all in jQuery rather than raw JavaScript. However, it is always a good idea to have some JavaScript knowledge at least for the required parts.
For this reason, if you see any jQuery book out there, most of them have a chapter or index regarding the "Basics Of JavaScript" or "JavaScript for jQuery".

How to become a good javascript coder [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm a self learner in javascript and I'm currently following the lessons in the book named "Beginning javascript 3rd edition" by Paul Wilton.
So far I've advanced myself towards chapter 4: Javascript - An object based language, and I did follow and solve the exercises provided inside the book. I tried to write a calculator myself, and by modifying and changing the code, every time I learn something new to enhance it.
How can I become good in javascript coding? Is there any special approach? Is there any concept or things I should learn first? What kind of study/career path should I follow for javascript? Anything I should be aware of?
I really have the courage to continue learning javascript, I just need some guidance.
I don't mind any expert opinion given, or pointing out any mistakes regarding this question, as I know that through my mistakes, I always learn something.
Consider JavaScript as a true
programming language
Learn the
difference between Object-Oriented
and Prototype-Oriented languages
Make sure you understand how
JavaScript (language) is related to
DOM (API) and never mix things up
Don't jump into "using jQuery to
solve all JavaScript problems" as
jQuery does not solve any problems
of JavaScript but rather those of
DOM
A very good way to learn (not restricted to JavaScript) is to have projects where you need to do something with the language (in your case JavaScript) you haven't done or haven't tried.
I have noticed that I improve a lot when I have a project and have to do something I am not really familiar with or I am not that great at. Last project required the use of web services with php, something I had rarely used, but this made be learn and study and just try to get better, which I did.
So my advice is try to have a project where you have to do something with JavaScript that you have no idea how to to.
JavaScript is unlike most other languages. While it is Object Oriented, it is weakly typed. This provides much greater flexibility, but at the same time, limits itself.
Keep a few sites in your pocket:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
http://javascript.crockford.com/
http://www.addedbytes.com/cheat-sheets/javascript-cheat-sheet/
One last thing:
Be aware of Douglas Crockford. Read his books. Read anything you can find with his name on it.
Conquer Level 1 First...The Princess can wait!
I would just do what is necessary first. Don't bother with the advanced stuff unless it's absolutely necessary. Most of the things you'll use JavaScript for are very top-level and superficial. Get the syntax, loops, types, etc all down first. Don't confuse yourself with the more difficult aspects of it until you've conquered level 1.
Then Move on to Common Solutions to Common Problems
I would even suggest learning something like jQuery before trying to learn how to extend prototypes, etc. Make yourself useful immediately by learning the stuff you'll be using frequently, and tackle the difficult stuff at a later date when you've got the time.
The same way you become a better programmer/writer:
Read a lot, write a little. Repeat ad nauseam.
Also, read this other related answer.
If you are starting on Javascript, I would recommend you going to this website.
However, if you already know bit of javascript, then it all depends on practice. This is the only way i know of that can make you a good programmer. And this apply to just about anything and any programming language.
Try to come up with your ideas and materialize them using Javascript.
How about building your own lightbox?
How about creating your own table filtering/sorting?
And how about all the cool stuff you might have in your mind?
Thanks :)
Program a lot
Read JavaScript: The Good Parts
Use JsLint!
Go to 1
I would suggest you try to go through following:
1. Book -Javascripts: the good Parts by douglas Crockford. Make sure you understand the points he raises in the book and try to implement them accordingly.
2. Do not just try to javascript functions for website validations; as static functions in javascript is the worst thing a developer can do.
3. Try to implements OOPs concepts in Javascript and see how using functions you can model your objects and their behavior.
4. I would highly recomment small design patterns problems to be solved in javascript, as that would bring out the understanding of functions and invocation patterns in javascript.
Hope it helps.
Focus is objects oriented nature of javascript and not just the syntax
It also helps also to install firebug and try out different things in the console.
Start with Javascript : Definitive
Guide . Pay special attention to the 1st
part core language features
Check crocford blog/site with the reading of this book
Now the time is for Javascript:Good parts
For More in depth knowledge check the ECMAScript3 and 5 refrence
Finally, try to learn some other prototype based language as well like self
For DOM API's check other parts of Javascript : Definitive
Guide and sites of respective browsers
I'm surpised with the comments here about learning Javascript. Let's not forget - you don't want to learn it all! While the language is quite great if used correctly, it has a tainted history and many horrid parts. Luckily, you really only have to listen to a single voice:
Douglas Crockford also wrote The Good Parts, which is a nice little Javascript book. He does a bunch of stuff at Yahoo! and has materials on their YUI Theater that explain the problem quite well:
http://developer.yahoo.com/yui/theater/
This is a really great read:
https://developer.mozilla.org/en/a_re-introduction_to_javascript
For beginners w3schools or tizag.com would be more better choice ..
Answer by Sergey is completely agreeable to me .. It is a good approach ..
All the best friend .. :-)
I think that Object-Oriented JavaScript by Stoyan Stefanov is an amazing book, but that could just be me.
I'd suggest you the definitive guide to the language of your choice!
Please ignore any kind of javascript style kind of programming that may be fashion today.
Just learn the language! Fashions may change, and if you know the language, then you know something that resists, rather then samething that is fashion for some predeterminate time....
For example, read this book! Take the time, and you will reach the next level ;-)
Like with everything else: learn and practice.
How to learn the others already wrote.
I would suggest finding a javascript framework and learning how to use it. Then you can see practical applications to how javascript works in real life. It will give you practical applications, and a much more specific (and larger) set of answers to "how to I..." type problems.
jQuery is a good framework to begin with, YUI and/or Prototype are good if you really want to dig in -- those two are meant for building your own resources, whereas jQuery is more focused on being easily usable.
Modern javascript is heavily about "prototyping" javascript to build in new functionality that's not included in its implemented specification. In other words, it moves beyond the basics of how to code in javascript found in most books and into the realm of "how to make javascript do more than it was intended to do." But the basics are a must if you intend on prototyping the language.
If you want to learn javascript purely for servicing clients and making better websites, then it really depends on how you learn. Personally, I learn more through practical application than just reading and exercises. If you're the same, then I suggest reading through (not working through) your book and meanwhile do a lot of reading up. I suggest "yui vs. prototype vs. jquery" as a starting Google search.
Think up a simple project you'd like to do, and then try and implement as many cool javascript features into that project as you can (ajax form submissions, automatically updating graphics based on form selections, image zoom, and animated fade effects some to mind as the most practically useful).
Again, it really depends on what your goals are -- do you want to become a contributor to a framework like jQuery, write plugins, or just know enough to implement functional javascript on a client website and look good on a resume. If it's the latter -- pick a framework, learn it. jQuery is the most user-friendly, Prototype is the most functional, YUI is as functional as Prototype, well supported, and a great up-and-comer.
You may want to look into major Javascript frameworks such as JQuery and MooTools. Understand the differences between them and pick your favorite.
Here are some links :
http://jqueryvsmootools.com/
http://blog.creonfx.com/javascript/mootools-vs-jquery-vs-prototype-vs-yui-vs-dojo-comparison-revised

Learning JavaScript... Should I skip straight to the good stuff (the frameworks)?

I learnt HTML/CSS a good few years back, then PHP a little later. I've recently become interesting in web development again, just started playing with frameworks like Django and RoR. I'm curious as to how much time/effort I should spend learning straight JS before looking at frameworks. I've been reading through a let of articles called Mastering AJAX by Brett McLaughlin which seems quite good, but I'm seeing a lot of stuff (such as cross browser compatibility - even for things like XMLHttpRequest) coming up which look like they would be non-issues if using a framework.
So, should I keep reading through these articles and try to build stuff using basic JS, or should I just start looking into jQuery and the like?
Also, I've been watching a few videos regarding GWT from Google I/O. I've been learning Java over the last year, built a few medium sized apps in it. I'm wondering if GWT is something that's worth going straight to, along with gQuery?
Starting with the basics of JavaScript is a good idea, IMHO.
Read JavaScript: The Good Parts, by Douglas Crockford. Very, very good book.
You should also check out Douglas Crockford's web site.
I also had to come back here and mention this in an update:
Douglas Crockford presented an illuminating talk about JavaScript - past, present, future - at the Microsoft MIX10 conference earlier this year. You'll find the full video for Crockford's talk at Microsoft MIX10 - The Tale of JavaScript. I Mean ECMAScript.
No.
Just as when you are learning to program you are taught first C/Pascal then Java/C++ and finally Python/Ruby/Smalltalk/Lisp, and when learning any language you start with simple language constructs, you should first learn ECMAScript, then learn DOM and finally frameworks.
Why? Because you'll have a deeper understanding of the language, and will be able to debug things that might seem odd unless you've got that learning experience.
If you are a seasoned developer, you can speed up each phase, but don't skip them, or you will have problems due to not fully understanding the small oddities.
Javascript is an interesting and fun language, but can act rather odd at times (Date has bitten me a couple of times in the ass).
Use frameworks to avoid repetitive tasks and to simplify your code, but not as a starting point. Simplicity is a final goal, not the starting point, and frameworks are for that, simplicity, not for learning a language. Frameworks are intended for simplifying things for experienced developers.
Learning the differences between browsers (DOM implementations) will allow you to debug your framework. That is priceless.
I've been learning Java over the last
year...
Javascript is not Java. Never was never will.
Even if you can compile to Javascript from Java, it's still a framework, don't jump into it unless you already know what you are doing.
I think "both." Mix it up. Play around with a framework. You'll get stuck when you try to do something real, so you'll pick up some JavaScript to figure it out.
A lot of the good jQuery books teach you JavaScript along the way.
This is one of the best videos for beginner javascript developers that understand how to program in other languages:
It's a talk the John Resig did last year at Northeastern, most of it is devoted to talking about core javascript, then the last quarter of the talk jumps into jQuery:
http://video.google.com/videoplay?docid=-7485992465859932389&ei=jhZUSu73OpfSrQLgyYV3&q=john+resig&hl=en
It's actually a really interesting tech talk and presentation since he does live examples and Resig is pretty good at presenting.
Like others in this question, I also highly recommend reading Javascript: The Good Parts for a better understanding.
Yes, jumping straight to framework-based programming instead of DOM is a good idea.
I started doing JS before any major frameworks like jQuery came along, and was reluctant to switch at first, but when I first started using jQuery, it felt so good to be able to write selectors and stuff and not have to worry about cross-browser compatibility.
However, there are some areas of JS where frameworks wouldn't be available. One of them is in userscripting, where you have to make your script work on a site you don't control. Another such one is the use of JavaScript in applications such as XUL.
Overall, I suggest you start with some trivial JS applications, then switch to jQuery instead of going on to the complex topic of DOM.
What makes you think that the frameworks are the good stuff and the JavaScript is not?
If you ask me, I will say that JavaScript is a real fun language and you should learn it first. JavaScript has received bad rap because it was mainly used for browser scripting and those browsers were buggy making people think that JavaScript sucks.
Crockford says that JavaScript is the world's most misunderstood language.
If your prior experience is with PHP (or any non functional language for that matter), the concept of 'first class functions' will really give you an 'aha' moment. 'Closure' will be another tool which will simplify your code and will make you wonder why all languages don't have it. Prototype inheritance will show you that there are alternatives to OOP. I would definitely suggest that you learn JavaScript first before you jump to any frameworks. I must add that you will also have to learn the concepts (first class functions/closure/prototype inheritance), to use any JS framework efficiently as all frameworks exploit the features of JavaScript.
To learn JavaScript, get Crockford's 'JavaScript, The Good Parts' book and try to learn the language using a standards compliant browser (say Firefox [with FireBug], Safari, Chrome) without focusing on DOM manipulation. This presentation by Simon Wilson is also good.
Once you have a good feel for the language, move on to the next step i.e. manipulating the DOM. I would personally suggest that you try to do some DOM manipulation using bare bone JavaScript to get better understanding of the DOM and the pain points involved. [E.g., when I attach a method to onClick of event, 'this' doesn't refer to what I think it refers to?]
After you have suffered a little bit of pain by doing DOM manipulation by hand, move on to a JavaScript framework which removes all the pain and makes JavaScript fun again. Personally, I would highly recommend jQuery over other frameworks.
And if you have any questions while on your JavaScript journey, you can always ask them on SO! :) Good luck.
I wouldn't touch any framework in any language until I have good basic understanding of underlying technology. Worth type of coder is one that uses tool without a knowledge.
JavaScript has somewhat sad history but in its latest incarnation it's surprisingly powerful and even fascinating language. I say - learn it well, then use whatever framework suits your current needs
It depends on where you want to invest your time. Ideally, we're all expert in assembly language, but that's not realistic or practical. We have to pick our battles. Then generally we attack each other for picking the wrong battle, which we call "cargo cult coding."
Personally, out of all the things I could spend a lot of time banging my head against, the intricacies of cross-platform JavaScript seemed less interesting and rewarding than other choices, so I decided to jump straight to jQuery. I'm happy with how it worked out.
I had the same background as you. After 6 months of MooTools I found out that mootools was indirectly teaching me "vanilla" javascript.
I've heard people say that mootools feels more like plain ol' javascript than jquery (after all, jquery's tagline is "jQuery is designed to change the way that you write JavaScript.").
I'd recommend starting with a framework. Plenty of the best javascript developers use frameworks. Once you're comfortable there you'll likely be able to pick up the others frameworks and plain ol' javascript quite readily.

Categories