Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
This is a question for general discussion. Are there any good, comprehensive resources for useful JavaScript design patterns. I am trying to avoid references that attempt to coerce JavaScript into, say, Java by imposing patterns more suited to another language. Let's let JS be JS and shape our patterns around the strengths.
Please any discussion would be valued by more than just me, I suspect.
Here's an on-line resource:
Essential JavaScript Design Patterns For Beginners
Here's a good one:
This is an awesome book by O'Reilly. It builds on their "JavaScript: The Good Parts".
It references a lot of the patterns mentioned in the "Gang of Four" book and notes a lot of the problems solved in that book are trivial to solve with JavaScript.
APress has a book called "Pro Javascript Design Patterns" that is probably just what you're looking for. While the author (Diaz Harmes) is certainly not "the gang of four", I think he does a pretty good job; I know I learned quite a bit from it (and it got 4.5 stars on Amazon).
Amazon link: http://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X
I'm not sure why no one has listed this, but Addy Osmani's JavaScript design pattern book is fantastic and freely available online. He really digs deep to show you the nuts and bolts of each pattern.
http://addyosmani.com/resources/essentialjsdesignpatterns/book/
This is one of the best design patterns resources I've found for JavaScript
http://shichuan.github.com/javascript-patterns/
It's aimed for JavaScript as we know and not necessarily trying only use concepts of other languages.
Peter Michaux has some decent articles
Also see Crockford's articles (and his book)
A new book on the subject by Stoyan Stefanov: Object-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications and libraries
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
As someone who will be working extensively with JavaScript and JQuery, I hear the community is strong so I figured I would ask what a beginner should been keen in understanding when developing mobile applications. Like any other language, I wish someone would have walked in the first day of class when programming with C and said to me, "if you don't learn everything about malloc() and free() today, you will fail!" Or when I was writing with Java and heard that private and static are essential for every function and variable too late. See what I mean about learning the most important so I don't get frustrated with the details later.
My current attempt at figuring this question out is reading a book, but like most books, they don't expect you to ask what is the high-level re-occurring concepts. I have used CSS and HTML and have not used scripts or Jquery as much when developing websites.
Read "JavaScript the Good Parts" by Douglas Crockford http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&qid=1419857713&sr=8-1&keywords=javascript+the+good+parts
This will give you what you need for JavaScript. I don't know "the best" source for jQuery, but start here: http://learn.jquery.com/
If your new to Javascript Syntax I would highly encourage you to check out the Code Academy's Javascript Track here.
If your new to programming in General I'd also encourage you to learn about functional programming which is very important in Javascript (Very useful especially when you start working with asyncrhonous code). A great resource for this is Eloquent Javascript. The book is posted 100% free on the authors website here. I'd encourage you to read chapters 1-5.
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 am trying to learn Javascript.There are some excellent books and great authors that became standard in JS world - As I can see, they all have their own way of interpretation of language. It can be sometimes confusing for the novice in Javascript.I wonder, how usefull can be to learn directly from ECMAScript language specification as it was published by the authors of the language ?
It's probably much better to learn from the tutorials, as the specification is designed for people implementing JavaScript parsers/interpreters, not for people learning JavaScript itself.
If you want to learn from a reference, the MDN is a fantastic resource. There are also plenty of tutorials out there.
The specification is optimized for defining the language from the point of view of its implementors. It is not optimized for teaching it to someone that is new to the language.
A good learning reference has also many things that are not covered in the language spec, like common APIs (like the DOM and a JS framework) and common patterns (ex.: the module pattern, namespaces, etc...). While it is true that some people might have some coding practices you don't agree with you should not immetiately dismiss what they say, unless you really want to learn everything and fall into every trap yourself. As long as you have a mental framework of what you consider to be the best practices in general you should be able to identify what you agree with or not.
JavaScript is one of the most controversial languages in existence, there is no clear author and no clear documentation.
The best project I know of is Mozilla Developer Network (or MDN), it's pretty extensive and comprehensive.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
this site has been a great help to me. I am working as a UI designer, and i am very interested in learning Javascript, but i am not able to find a right way to start from. I don't have a programming background.
I need a book for Javascript, which is totally for a Noobs, starting from the fundamentals. I tried reading Douglas Crockford's Javascript the good parts, but i wasn't able to understand much.
Please suggest me some books
Try out this new site:
http://www.codecademy.com
It really will help you get a hang of javascript. It's an interactive way for learning javascript.
If you're looking for a book, I'd recommend O'Reilly's Head First JavaScript. You can get it from their site or cheaper from Amazon.
I started recently using eloquent javascript and it is indeed a good book. Along with that Mozilla Documentation helped. But the best way to understand the language is to use it and see it in action. Ask a friend of yours to introduce you to firebug and how firebug is used to alongside with Javascript debugging. That will help you to get a grasp of how javascript is used to real world. Once you know that you will find that Javascript as a language is really simple, it's applications (and concepts such as AJAX) and it's libraries (jquery) are the ones that are making it really really powerful
Make sure you read Pro JavaScript Techniques. It is concise with a wealth of information.
Then there's the JavaScript: The Definitive Guide. Also make sure you get Secrets of the JavaScript Ninja when it gets published.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I realize that title may require explanation.
The language I first learned was C, and it shows in all my programs... even those not written in C. For example, when I first learned F# I wrote my F# programs like C programs. It wasn't until someone explained the pipe operator and mapping with anonymous functions that I started to understand the F#-ese, how to write F# like a F# programmer and not a C programmer.
Now I've written a little javascript, mostly basic stuff using jquery, but I was hoping there was a good resource where I could learn to write javascript programs like a javascript programmer.
Douglas Crockford's - Code Conventions for the JavaScript Programming Language would be a good place to start.
I learned a lot of useful information in regards to code convention through his video tutorials, which I suggest viewing. I posted the link to the first video out of the four in the series.
Also, as suggested by Ben, (which is a book I would also highly recommend) is Douglas Crockford's book JavaScript: The Good Parts
If you want to find good explanations on jQuery, check out the creator, lead developer and fellow StackOverflower John Resig's website/personal blog.
The book Pro Javascript Design Patterns is a great resource:
http://jsdesignpatterns.com/
I really like this article:
A re-introduction to JavaScript
http://eloquentjavascript.net/
It may be a little wordy, but it gives you some excellent examples that will stick with ya.
The more you work with JavaScript/jQuery - especially working with other people's code - the more of the style you will pick up. I recommend reading though the documentation on the jQuery website and maybe picking up a book on Javascript. Then just keep working with it. Also, make sure you keep looking at other people's code - read through the source code of some of the jQuery plugins you are using, and seek out examples online for 'best practices'.
First off, start using JSLint on all your code, for at least a week (http://www.jslint.com). I'm not going to say you should use it constantly, forever and ever, and it's perfect, because it's not. But, it will help you learn a lot about JavaScript, if you take the time to read what it says, and understand why. Even if you disagree, which you may, understand the reasoning behind each message. Then you can decide if it's a tool you'd like to continue using.
The other first step is to pick up a copy of JavaScript: The Good Parts. This is by far the best book on JavaScript. It's short, very easy to read, and really will help you learn better JavaScript. http://oreilly.com/catalog/9780596517748
Other than that, there are a lot of good blogs to follow. You can find these via google, but I'd look at Perfection Kills and John Resig's blog, in particular. I think mine is pretty good too, you can find it via my profile if you're interested :)
I would also recommend "Secrets of a JavaScript Ninja" by John Resig. It will be out in July this year and would definitely be an excellent resource.
Else, Douglas Crockford "JavaScript:The good parts" is excellent.
Javascript has functional programming roots.That makes a big difference compared to the OO world.
Here are some links that helped me jump the fence:
A simple explanation:
http://www.joelonsoftware.com/items/2006/08/01.html
A deeper one:
http://www.hunlock.com/blogs/Functional_Javascript
Read/debug the code of this library:
http://osteele.com/archives/2007/07/functional-javascript
You can read/debug the source code of PURE, a JS templating engine we wrote.The 2nd version was totally rewritten in functional JS.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
What are some good resources to learn best practices for Javascript? I'm mainly concerned about when something should be an object vs. when it should just be tracked in the DOM. Also I would like to better learn how to organize my code so it's easy to unit test.
Seconding Javascript: The Good Parts and Resig's book Secrets of the Javascript Ninja.
Here are some tips for Javascript:
Don't pollute the global namespace (put all functions into objects/closures)
Take a look at YUI, it's a huge codebase with only 2 global objects: YAHOO and YAHOO_config
Use the Module pattern for singletons (http://yuiblog.com/blog/2007/06/12/module-pattern/)
Make your JS as reusable as possible (jQuery plugins, YUI modules, basic JS objects.) Don't write tons of global functions.
Don't forget to var your variables
Use JSlint : http://www.jslint.com/
If you need to save state, it's probably best to use objects instead of the DOM.
I disagree to the "use a framework" statement to some degree. Too many people use frameworks blindly and have little or no understanding of what's going on behind the curtains.
I liked JavaScript:The Good Parts by Douglas Crockford although it's focused entirely on the language and ignores the DOM altogether.
If you don't feel like reading you can watch this video: JavaScript the good parts by Doug Crockford.
Probably the single most important thing is to use a framework, such as jQuery, or prototype, to iron out the differences between browsers, and also make things easier in general.
YUI Theatre has a bunch of videos (some with transcripts) by Steve Souders, Douglas Crockford, John Resig and others on JavaScript, YUI, website performance and other related topics.
There are also very interested google tech talks on Youtube on jQuery and other frameworks.
You can pick up a lot from Pro JavaScript Techniques, and I'm looking forward to Resig's forthcoming Secrets of the JavaScript Ninja.
As an addendum to the Crockford book, you may also want to check out this piece Code Conventions for the Javascript Programming Language. I also have a slightly different suggestion: instead of using a JS library off the bat, why not create your own? You may write a crappy library (as I did), but you'll learn something in the process. You have existing examples you can use as models. Also, to help give you an understanding of JS design patterns, I shall recommend another book, 'Pro Javascript Design Patterns'.