@A Flatoff - you can also check my signature for a link to the publisher's site
@Nimchi - the book has a little unusual approach which is to use the Firebug console as a training tool and this is described in chapter 2, so I thought it would be nice to show the reader what they type of code they can expect.
Other than that my thinking with the book outline was that people unfamiliar with OOP sometimes have troubles "getting it", so the approach is to introduce the OO related code gradually.
chapter 1 - (people often skip chapter 1 of computer books, so I tried to keep it really short
) - history, what's JS and an intro to the
OO concepts in general - objects, properties, methods, inheritance,
polymorphism...
chapter 2 - the basics,
data types, loops, conditions. The thing with JS is that since about 2004, with Ajax, web 2.0 and so on, we (the web dev community in general) are in process of rediscovering JS and relearning the language we might have dismissed previously. So this chapter gives an opportunity for proper relearning, or simply learning, if you're new to JS.
chapter 3 -
functions, a whole chapter because JS has many uses for functions. Also detailed explanation and examples of
closures, which are powerful and often misunderstood topic
chapter 4 -
objects. Now that the reader has the strong base, making the step towards objects seems like the most natural thing. In the end, in JavaScript objects are just hashes and some values in those hashes can be functions (hence methods). In this chapter the plot thickens
and the reader understands the whole truth - in JavaScript functions are objects, arrays are objects, even null is an object, basically
everything is an object with the exception of the 4 of the 5 primitive types from chapter 2, namely number,
string, boolean, undefined. The chapter also goes through all the
built-in objects with examples of using selected methods/properties (full reference is in the appendix)
chapter 5 -
protoypes, an important topic in JS
chapter 6 -
inheritance, a dozen ways to approach it. Here the reader feels at ease with the JS OO specifics and can really
get creative.
chapter 7 - the browser, what types of objects do we have "for free" in the browser,
BOM (the Browser Object Model, the book discusses only the cross-browser de-facto-standard properties of this non-standardized area),
DOM, Ajax, JSON Chapter 8 -
coding and design patterns, where "coding" means JS-specific patters and "design" means JS implementations of the patterns from the book of four.
The appendices are references:
A - reserved wordsB - built-in functions C - built-in objects (that's a big one)D - regular expressions All the references are not dry descriptions (that's what the
ECMA standard is for), but contain many examples. Throughout the book actually there are many one-line or few-line examples that the reader is encouraged to try out and tweak in the firebug console, which is great for quick hands-on experience with the topics.
BTW, yuiblog.com will soon publish a PDF of chapter 8, the patterns chapter so you can check out some of the more OO stuff.