Writing a Prototype Book for The Pragmatic Programmers
I’m really excited to report that The Pragmatic Programmers have accepted my proposal for a book on Prototype!
I’ve been working on the book for about a month as a personal side project, but after talking with some friends and weighing my options, I decided to pitch it to Dave and Andy. I feel really grateful to be able to write for a publisher whose books have helped me so much in my career.
I’m also happy to report that I have the support of both Sam Stephenson, the author of Prototype and Thomas Fuchs, the author of Script.aculo.us. Sam obviously knows Prototype better than any other and Thomas is certainly no newcomer to Prototype with the excellent work he’s done on Script.aculo.us.
Most of my readership is familiar with Prototype, so I ask the question: What would you like to see in a book covering Prototype?
How does the book affect this blog?
I obviously will be spending my time writing the book and continuing to work with JadedPixel. I will try to maintain consistency in posting to EncyteMedia, but there is a possibility that post will come less frequent.
I’ll be keeping you posted on the progress of the book, so make sure you grab the feed!
Sorry, comments are closed for this article.
Justin develops iPhone and Mac software over at Labrat Revenge by night and by day he is the Design Director for entp, the company behind Lighthouse, Warehouse, and Mephisto. You can check out his dated portfolio for a peek of what he's done.
-

Beautifully simple issue tracking and project management. With a beautiful Mac-like interface, email and subversion integration, Lighthouse is the perfect project management tool. We took the suck out of issue tracking.
-
Jan12
YouTube has just announced HouseHub and Senate Hub.
permalink -
Oct10
Best Practices For Cocoa and CocoaTouch—Invaluable tips from Cocoa developers.
permalink -
Sep25
Track House And Senate Votes On Twitter. I’ve put together a small script that parses vote data collected by Govtrack.us and posts to twitter.
permalink -
Jul28permalink
Protip: Color grep searches in terminal
alias grep='GREP_COLOR="1;37;41" LANG=C grep --color=auto'Stash this away in your Z Shell (~/.zshenv) or Bash environment (~/.bashrc) and set your preferred ANSI code.
-
Jun08
ActiveRecord Ported To Objective-C brought to us by Ninja Kitten
permalink -
May06
With the release of Opera’s DragonFly, IE 8’s Developer tools, Safari’s/Webkit’s Web Inspector and Drosera; and the Grand Daddy of them all, Firebug – we’ve now come full circle.
permalink -
Feb08permalink
DoubleClick and Define using Apple Dictionary
var selection; if(window.getSelection) selection = window.getSelection(); else if(document.selection) selection = document.selection.createRange(); document.observe("dblclick", function() { if(navigator.userAgent.include("Macintosh")) { location.href = "dict://" + selection; } });A quick (and probably dirty) Prototype-based hack allowing Mac users to get the definition of any word by double clicking it.
-
Feb08permalink
Object.extend(Date.prototype, { strftime: function(format) { var day = this.getUTCDay(), month = this.getUTCMonth(); var hours = this.getUTCHours(), minutes = this.getUTCMinutes(); function pad(num) { return num.toPaddedString(2); }; return format.gsub(/\%([aAbBcdDHiImMpSwyY])/, function(part) { switch(part[1]) { case 'a': return $w("Sun Mon Tue Wed Thu Fri Sat")[day]; break; case 'A': return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[day]; break; case 'b': return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[month]; break; case 'B': return $w("January February March April May June July August September October November December")[month]; break; case 'c': return this.toString(); break; case 'd': return this.getUTCDate(); break; case 'D': return pad(this.getUTCDate()); break; case 'H': return pad(hours); break; case 'i': return (hours === 12 || hours === 0) ? 12 : (hours + 12) % 12; break; case 'I': return pad((hours === 12 || hours === 0) ? 12 : (hours + 12) % 12); break; case 'm': return pad(month + 1); break; case 'M': return pad(minutes); break; case 'p': return hours > 11 ? 'PM' : 'AM'; break; case 'S': return pad(this.getUTCSeconds()); break; case 'w': return day; break; case 'y': return pad(this.getUTCFullYear() % 100); break; case 'Y': return this.getUTCFullYear().toString(); break; } }.bind(this)); } });UPDATE: Bugs fixed. Thanks Andrew and Stephen
Also, some of my old and new code has been posted on GitHub. You might find something useful.
-
Feb04
A beautiful, organic animation by Flight404 created using Processing.
-
Jan08
Aaron Patterson shows us how to define ruby methods which can be called from JavaScript using RKelly.
permalink -
Jan07
Dustin might not surprise you at your house with a book in hand, but he’ll damn sure send you his innermost fu in the form of a shiny yellow and black book. It’s an excellent read if you’re looking to put more funk in your functions and class in your classes. Check out “Pro JavaScript Design Patterns” by Dustin and Ross Harmes.
—I’m Justin Palmer and I approve this message.
permalink -
Dec23
IE 8 PAsses the Acid 2 Test for those not keeping tabs on things.
permalink -
Oct24
Mislav has written up an excellent overview on upgrading Radiant (which used 1.5) to Prototype 1.6. The article does a great job of showing how 1.6 is superior to 1.5.
permalink -
Oct19
According to the New York Times, the Daily Show Archives, with over 7,000 videos are online—free and searchable.
permalink -
Oct11
Copyright © 2005-2009 Justin Palmer | Powered by Mephisto

Discussion
CONGRATULATIONS.
Please please please make a chapter on “How to Read Prototype.” Prototype’s source is surprisingly complex, and that kind of knowledge will outfit us all for the many changes that will come in the time between when your book is published and when you can update it. :)
YES.
This is fantastic news, nice work.
Covering Object.extend() in some depth (with examples) would be really useful to help others start building more object oriented js code. It’s one of the most useful things i’ve been using recently with prototype, since it lets anyone build nice extensible frameworks.
Also, when you read through prototype.js, there’s a lot of different syntaxes for the way Object.extend is used, which can be quite daunting – explaining how and why each of these works the way they do would be nice.
And all the little syntax gotchas collected into one chapter might be good (like the “this” inside iterators syntax you mentioned in your enumerable article).
Congrats =)
I’ve found the unofficial manual to be exceedingly helpful – let’s face it, Prototype’s documentation is… well, nonexistent. I’m very happy to hear there’s a book coming, and I’ll likely be one of your first buyers.
Congrats!
Sounds like a great book. Is Prototype alone really something that merits a whole book, though? I assume you’ll have a section on using P with Rails. What about a chapter on libraries built on Prototype like script.aculo.us and moo.fx?
Don’t spend too much time with theoretical stuff or go extremely lowlevel. I would like lots of practical examples that I could easily use in my site. Kind of like the Rails Hacks book.
After reading your book, I should have all sorts of ideas I could do with my site to make it nicer to use. I don’t want to have the feeling “well, interesting book, but I still have no idea how to apply the knowledge”
A chapter on treating javascript as a real language (unit testing, debugging, useful extensions in firefox,..) would be nice too.
Awwww… super sweet! I wrote Dave about two weeks ago asking for this book and he said he was considering a proposal. Sooo glad it got the go-ahead.
I agree with Amy. I totally thought I had a handle on JavaScript until I started walking through the source for Prototype… back to the drawing board, as it were. It would be really helpful if you could include a section explaining the ins and outs of how Prototype is constructed and works.
In particular, I think Prototype’s approach to creating JavaScript objects is compelling. Would love to see an in depth discussion of creating classes and subclasses with the Prototype methodology.
Best of luck with the book project! Congrats.
Great News!!! I support Travis’ opinion. OOP should be a good part of it.
That’s great news. Congrats! If you keep your writing style similar to your tutorials on this site, I will be satisfied. Plenty of low level examples that assume the readers comes in with little knowledge.
And just because I’m not a huge Rails users, it would be cool if the book isn’t too Rails centric, but I can understand if it needs to be.
Sweet! (and about time!) Can’t wait.
Thats awesome! They are a great publishing company. I know because i’m currently writing a book on Ruby on Rails security for them.
http://www.bensblog.com
I was trying to write a book, I just a can strap that idea.
Are you going to base your book on ver 1.4 or 1.5? Any idea when ver 1.5 is expected?
Can’t believe that… just wrote the lengthiest comment which didn’t get saved…
Did it again… is there a limited number of links we can put in the comments (to prevent spamming maybe).
Here’s the stripped down version… the original was full of related resources:
That’s excellent news!
Your blog has been my number one resource since I started seriously tackling Prototype, so I can’t wait to get a copy of your book.
Regarding suggestions:bindandbindAsEventListener,thisandself,Anyway… really looking forward to read this and congratulations!
Any idea on when we can expect the first beta book ?
I need to sit down and learn Javascript correctly.
It would be great to have one chapter on the basics of Javascript for all those people like me who write it but don’t really know what they are doing (working with hashes, creating objects, parameters, etc.).
Congratulations, Justin. I’ve shrugged JavaScript, AJAX, and the whole Dynamic Client Content, off until reciently. Lately, I’ve been stepping into using Prototype, Rico, and a few others, this is defietnly good news for everyone like me, who could learn by example. I can’t wait.
Excellent! I’m totally losing track of the number of awesome book titles that seem to be on the way. I already own 6 PragProg titles, and you’re not helping! Just kidding.
What I would like to see: A nice balance between these three styles:
Congrats!! Prototype is awesome and having some printed material out there means it won’t go away.
I think a good explanation of basic OO Javascript using prototype would be extremely useful and open the door to more complex client side apps. A clear explanation of inheritance using prototype would go a long way.
I have an interesting code snippet for you. I modified prototype’s ‘Class’ so that all object properties have to be ‘declared’ in the ‘initialize’ method. If a method outside initialize creates or deletes a property, it throws an exception. It wraps all a class’s methods and this concept could be used to create code profiling and code coverage tools with prototype.js
Sorry for chiming in so late on this, but I do want most of you guys to know that most of what has been suggested will be covered in the book.
One thing I’d like to see is a bit of some analysis and comparison with the other frameworks out there.
Don’t forget to explain the basic concepts and introduction to so called object-oritented Javascript constrcuts so users who only understand a little about javascript can also find it interesting reading book instead getting frustrated.
heh, better late than never? I’d like it somewhat minimalistic, not a beginners book but a book for those who know JavaScript more or less good but are thinking “christ, can you do THAT” when looking at the Prototype code. So basically a good walkthrough of the code, why it works, how you can make it work for you, and of course a quick lookup of the functions and how they work and then perhaps some practical examples to know how to use them.
Soto sum up, I want to learn advanced JavaScript-fu by understanding the Prototype source. Then I also want an easy reference for when I don’t want to write stuff myself.
Cograts on the book deal. I hope you could add performance considerations of some of the library’s methods (like $$) and indications of what doesn’t work identically (or at all) with the major browsers. Adding script load time speeding tips should help a lot developers using a large library for the first time.