Secrets: Table of Contents

After all the terrific feedback that I received from my post on the Untold Secrets of JavaScript I began to compile a Table of Contents that would serve as a guide for the rest of my next book (final title or publisher as yet to be determined).

I’d love some feedback as to the structure and contents of the full table of contents, as it stands:

Introduction (Overview of the contents of the book; introduction to its style and format.)

Test-driven book

Test suite and examples

Perf. test suite and examples

The advanced features of the JavaScript Language

How to tackle cross browser code

Overview of best practices

JavaScript Language

Looking at the most advanced features of the JavaScript language, in depth, completely analyzing how they work and how they can best be used to implement incredible production code.

Functions (Explain the importance of functional programming and show it’s severe capabilities and applicability.)

call/apply

arguments slice

Math.sum()

typeof fn == “function”

fn.length

makeClass()

Closures (In-depth explanation of how closures work, their applicability, and usefulness throughout the language.)

How closures work (interactive visual)

Events & Timers

fn.bind()

Currying

Self-replacing functions

(function(){})()

Loops

Library wrapper

Scope / Private Variables

.call(this)

Timers (In-depth explanation of how timers work internally in the JavaScript engine and how to take advantage of them.)

How timers work (interactive visual)

Using closures w/ timers

Central Timer Queue

“Threading” CPU-intesive tasks

Object Prototypes (An overview of prototypes and how they can be used to build complex data structures.)

Gotchyas

Speed benefits

Native Prototypes

Class-like code

Inheritance

Namespacing

RegExp (A deep look at the functionality provided by the JavaScript RegExp engine.)

.replace(re, fn)

Non-capturing RegExp

Backreferences

Pre-Compiled RegExp

Unicode

Escaped characters

with(){} (Understanding how with works – its benefits and how it can be best used.)

Understanding with: Pros and cons

Packages and Namespacing

function test(){with(this){ … }}

Templating

eval (How the eval function can benefit the clarity and functionality of your code in a cross-browser manner.)

new Function

eval.call

<script> eval

Packer

Cross Browser Code

An in-depth look at solving the most common JavaScript tasks in a cross-browser manner. All solutions will be constructed in a robust manner, able to handle all modern browsers.

Strategies for Cross-Browser Code (A look at how to tackle cross-browser issues in real-world, production, code.)

Test Test Test

Defensive writing

Reduce to common denominator

Browser sniffing

CSS Selector Engine (A top-to-bottom look at how to build a pure-JavaScript CSS selector DOM selection engine, including a look at implementing performant features using XPath.)

I found everything worth reading. It’d be interesting to introduce the current state of javascript, a bit of past and future of the language and why is that important nowadays in webapps, I use to like all that stuff. There’re a lot of “secrets” in the TOC as you well say… When are you planning to publish it? :D

@Luis: I think I can integrate some of that into the introduction. I have some more thoughts concerning the “current state of JavaScript” that I need to have clarified in another blog post.

Right now, I don’t have a firm schedule for publishing – I’m still talking with publishers, submitting proposals, etc. Once I hit upon a combination that I like (in a time frame that’s reasonable) I’ll definitely push ahead.

I’m pushing really strongly to make most (if not all) of this book be available, freely, on the web. The result of this will depend, strongly, on the publisher and their opinions on the matter. I should have some more details concerning this, soon.

Could try jumping onto the whole Radiohead stunt wagon. Free to download but donate as much as you like. I’d donate cause I know it’s a book that would help me. I don’t usually buy books, never really find them that helpful.

It could mean more money directly to you, although there is a risk not many people would donate. Also how would you get a hardcopy of the actual book. I don’t know of any companies that would print a ebook into physical form for you. Although that would be quite cool.

Either way I look forward to the release, time for me to save abit of cash to one side.

That’s awesome! Almost everything in the TOC is what I’m eager to understand in depth. It would be nice to have some JavaScript 2.0 and the future of browsers coverage in such a book. So that people can fine tune the learning direction. Which secrets will stand true in future, which will not?

the TOC already looks terrific. There is one issue that crossed my mind, libraries. On one side, all of your chapters have this as a cross-cutting concern, so maybe you want to include at least exemplary pointers in the chapters how the topic at hand is treated in existing libraries.

On the other side, since the main contents of the book leads nicely to library writing, you might consider devoting an entire chapter on libraries, both existing and self-written. In the case of existing libs you might argue that this information is too volatile and not generic enough for your book. But for real application programming it would be very important to treat how to hook into 3rd party libraries and make good use of them, finding criteria to choose one and so on. And you could throw in your knowledge about the existing libraries landscape.

This will in deed be interesting reading, I have been looking for this kind of black-belt-javascript book for long. The world needs to know more on this wonderful language.

Closures and Timers. Me like.

I am absolutely sure that JavaScript is going to be a huge factor on a lot of different platforms (already used in Tibco ie), this book may well be a huge success. If you can get the Best Practices chapter right, that will help thousands of developers who HATES JavaScript.

John. The outline looks great. I would second Simon Willison’s comment about making the ch. on closures free, if nothing else!

As Arrix noted, maybe some useful info on JavaScript 2 would be useful, though hard to know if it will be off topic and introduce too much politics. Any security-related things of JS now, or being introduced in JS2 could be useful.

To date, I have never purchased a book on HTML/JS/CSS (I always think they will go out of date more quickly than I will finish it!) but this one I certainly look forward too.

Your table of contents looks really promising. I love the idea of writing an advanced book about *JavaScript* the language and not a book about coding for a specific library.

I’m somewhat of a purist when it comes to JavaScript. I prefer to write a small supporting library that does exactly what I want the way I want it done. Everyone has a different style of coding and I love having my own library that thinks like I do. Looking at the proposed content of your book, I think this information will give people with a like mindset the tools they need to get the most out of JavaScript and not have to feel like they need to rely on an all-in-one library to do it for them.

I understand that not everyone thinks like I do — heck, I would bet that there aren’t very many people that think like I do — and that’s why there’s a need for jQuery et al.

I remember the moment the light went on for me. I was reading a JavaScript book (The Definitive Guide) with my jaw open thinking, “JavaScript can do that?!”. I must’ve repeated that hundreds of time throughout the course of that book and still do to this day. I can imagine others reading this book having the same reaction. That’s exciting.

I love JavaScript. It is by far the most fun, powerful, and elegant language I’ve had the pleasure of coding. I hope books like yours can show others the light, so to speak.

On another note. Do you already have technical editors for this book or aren’t you that far along yet?

This looks very comprehensive, I am also glad that you are going to be evangelizing eval and with. Simply saying eval is evil and never use with’s eliminates some really powerful use cases for them, I think. By teaching when not to use them, and when to use is them would be great.

I agree with the others in and I’d certainly buy a copy when it’s out.

“It’d be interesting to introduce the current state of javascript, a bit of past and future of the language and why is that important nowadays in webapps…” -Luis Merino

I’m going to ask that you don’t expand too much on this. You, Jeremy Keith, PPK, and a ton of others have already expounded on this and we can read more up on this elsewhere. This book should just get to the nitty-gritty. Show us the goods and skip the long spiels. :)

Looks great, particularly the treatment of the language first, and then practical browser issues. I agree with Kris about eval and with, a balanced discussion of these is really needed.

How to write about libraries is tricky, since on the one hand they change the experience of writing javascript so much, but on the other the abstraction they provide can serve as a barrier to really getting to know the nuts and bolts of the language…

What about a section on the same-origin policy and writing widget / mashups? This is more of the end (web-specific) part but certainly the kind of thing where having an understanding of the fundamentals (rather than just cargo-culting implementations) is crucial.

there is always the free PDF download with an option to use a print-on-demand service; although bookshelves and distro are handy too.

My design company did the layout for an RPG that used lulu.com and it has been working out pretty good for them. Since you already have a rather large captive audience this might be a good option for you.
Other POD services I know of but have not used: lightningsource.com (http://www.fonerbooks.com/pod.htm) & booksurge.com

The technical detail in that page is excellent. Also, be sure to address the potential memory leak scenarios when using closures, particularly in IE. It would be great to have an in-depth examination of what causes the leaks, patterns that create leaks, patterns that avoid leaks, ways to clean up the leaks, and when you can ignore the problems entirely.

Also if
>typeof fn == “function”

refers to sniffing out if something really is a function, I hope you get into details about why this is fundamentally impossible, point out the more robust attempts at getting it correct and what the pros/cons are, and finally why the “need” to figure out if something is a function may actually point to bad design decisions.

For the chapter on cross-browser code, I hope it doesn’t evangelize browser sniffing as a good approach. It would be great to really dig into the difficulties of writing cross-browser code without browser sniffing, how it can be done, and why some believe that browser sniffing is still a better approach.

I think the TOC looks great, and if you really dig deep into the issues and provide detailed and technically deep information on the topics, this will be one of the best JS books ever written. Enough with reference books. People need the gory details, and few writers are able to really write about them. Good luck!

I wonder if something like “Designing [libraries] for extension” fits into the TOC somewhere.

I’d be happy to help out anywhere! Its so much easier to order a book and give it to your eager coworkers then trying to teach them at work or just pointing to scattered blog posts.

I wouldn’t use the term “Best Practice”. I’ve seen it being misused way to often, eg. as a knock-out argument. And I don’t want to look back in three years and think, well, it may have been best practices then, but we are much further now. You can’t cover everything anyway.

In spite of that: Great TOC! I’m really looking forward to a first draft…

Definitely looking forward to anymore books which you’re authoring. One subject I find sorely lacking in many JavaScript books is front-end caching using js. caching of objects and such is something I’d love to see made available in a text book.

I would like to see a chapter on the creating APIs for mashups,such as the googledata API and cover the today way of doing cross site updates and authentication (multiple iframes – google calendar) along with future Firefox 3 ways.

All this combined with the considerations with embeding javascript includes from other domains and the way you should code with them such as subspace.

I think the chapter should also include best practices with JSON and webservices.

The single most important item to me would be code design – A chapter dedicated to explaining the proper coding practices for javascript, which despite years of use is still a very open topic for me. My own style was influenced mainly by reviewing the source code of the profilic JS libraries such as jQuery and Dojo, but there are some design choices that I couldn’t understand and I have yet to see a book cover this important subject.

Javascript, being a client side and prototype based language, has such different approaches to code design than the traditional server-side languages I am more proficient in, those also having much better coding practices references. If you put this chapter in your book, I guarantee I’ll buy a copy for each of my team members ;)

Hmm I would like to read more text than code on following topics:
1> CSS selector engines (The technique, idea and prolly pointers to how jQuery CSS selector engine works )
2> HTML to DOM deserialization ( how that works) because if I understand that I can myself figure out how to do nifty queries on DOM
3> Events->Delegation, Events->throttling ( equal amount of code as well)
Few Other stuff I will be looking forward to:
1> Async testing with selenium or something better and how to write tests or pointers to that
2> More details on applicability of closures and more details on how closures work at a noob level (I understand its not a beginner’s book, but might even help a seasoned JS devel)

And a additional chapter on hints to read jQuery code :)

Thanks a lot for thinking about to make it freely available, but more importantly pick a publisher which publishes it in India like Apress or Wrox or Addison Wisley ..

Looks awesome.
Would you consider a section on templating / string interpolation. I find a common coding practice is to receive json, convert it to html, then bind events. Should we be using XML/XSLT? Should we use a templating language, or just use string concatenation.

Awesome! I’m thrilled to see someone write a doctoral-level guide on the topic. I have a feeling this book will raise the bar of JavaScript/AJAX education very high– something that’s long over due. This should really help further separate the professional JavaScript programming from the web coding hackers.