Archive for November, 2007
The InPlaceEditor hot seat
InPlaceEditor has been going through rough waters.
It currently yields 24 tickets in the Trac; admittedly, a few of those could be closed by now, should I go over them in detail, as most of them are pre-rewrite and are now sometimes irrelevant. Having authored the rewrite, I feel indeed like I’ve become the de facto maintainer of this thing, and I’m not alone in thinking so, as recent posts on the mailing list seem to hint at…
It used to be buggy. I believe it’s less buggy now, and much more useful too, with a lot of cool new options and features. I do have in the crates a very thorough doc+demo page that I have to finish writing ASAP, to help people grab all the features quickly enough.
“Yes, but I’d like to extend IPE because I need to…[insert need here]”
The thing is, IPE was not meant for extension. It hadn’t been designed with that kind of use in mind, and I’m sorry to say, in hindsight, that the rewrite is not very well designed in that respect, either. It’s not hard to extend: it’s just that it’s not particulary easy to extend, either.
A lot of the IPE extension tutorials you’ll find online are pre-rewrite. All of them rely on overriding internals (e.g. Ye Ole onSubmit method) to achieve their goals, but this is all undoc’d, private-like, and therefore nonguaranteed stuff. We did a rewrite, the internals changed, and your extensions b0rk. Okay, time for a rewrite of your own.
Before embarking on an extension project, you should remember a few things, though:
- The new IPE has more customization hooks. For instance, you can now grab the form being built right after predefined controls were put into it, so you can easily augment the generated form: you don’t need to extend the class and override its
createFormmethod anymore. - A lot of the extensions you might need are actually transformations and processings of data sent to or received from the server side. IPE features plenty of callbacks for that. Support for alternative text is also there, even for the collection-based, combo-driven variant.
- In general, you should carefully check out all the options and callbacks before deciding you need to hack into the builtin behaviors. The book’s In-Place Editing chapter is all up-to-date on these.
OK, so you know all about the original capabilities, and still you press on. Alright, so what can you play with?
First, you need to use the new Prototype 1.6 class API syntax: you’ll have a much easier time, and write much shorter code, with the new class extension syntax, including such basic needs as specifying class extension and calling inherited methods from overriding code.
Second, you should be careful when extending internal methods: many of these are not called directly from the code, but through pre-bound wrappers defined at construction time. This is especially true of event listeners for internal controls such as form submission management, mouse response, etc. Check out the initialize code to get a better sense of what to do.
The book’s “Neuron Workout” section for the In-Place Editing chapter has a few extension suggestions. I’ll post suggested solutions to these in this blog at some point (I intend to post such stuff at regular intervals to help readers and foster best-practice debate).
In the meantime, as always: when you go extending a class that doesn’t have an extension-related specific API, read the source carefully and don’t take any internal for granted: it might just change in the future. That’s as true of script.aculo.us as it is of any piece of code. If that risk, however small, is too critical for your needs, then you might be better off forking the code for your own purposes (possibly back-porting IPE enhancements to your own codebase later on).
I hope this helps explain the status of IPE and its extension opportunities.
No commentsThe codebase has been updated
The online codebase for the book had been lagging behind since the official release on November 7.
Thanks to the tireless efforts of Andy Hunt, you can now properly access both the archived versions and the individual files linked from the PDF.
No commentsIt’s out!
Today, the book, Prototype 1.6 and script.aculo.us 1.8 released.
As PDF, at least. The paper form should be available anywhere within a month or so. But why wait? Just head over to the book’s page and grab either the PDF, or the PDF+paper combo, or just order the paper form now, to be shipped ASAP to your waiting mailbox.
The web is abuzz, and I see a lot of wonderful reviews and accolades already:
I’m more grateful than I can say to a lot of people. First and foremost Sam and Thomas, who agreed to sync releases of Prototype 1.6, script.aculo.us 1.8, and the book; and to the team at Pragmatic Programmers, especially my editor, Daniel Steinberg, for driving the project, and obviously Dave Thomas and Andy Hunt, for driving “Prag.”
The libs are there; they kick ass (I’m especially fond of Prototype 1.6 and its custom events). Get the book and get the most out of them. You’ll never use JavaScript the same way you did.
No comments


