Preface

The universe, perhaps, is just a crazy runtime environment with sparse documentation and seemingly random side effects, and life is nothing more than a program written in a language called "Universcript." I conclude that this might be the case because, when I decided to invoke my audition method in the fall of 2008 to try out for the role of Moritz Stiefel in a local production of Spring Awakening, I never expected that it would return a Book object.

Fortunately, not all things are that quirky. The universe might think that it's a great idea to take my botched audition and turn it into a writing opportunity—an API decision I fully approve, by the way—but most programming languages behave more predictably. Some languages behave predictably well, some languages behave predictably well with some exceptions, and some languages behave predictably weird.

The fascinating thing, though, is that a language's predictability often has less to do with the language itself and more to do with its users. The more we learn about a programming language, the more predictable it becomes. The key, then, isn't coding blindly and whining (quite loudly for some) about a language's apparent shortcomings, but learning, experimenting, and applying. The quirks will stay quirky, but at least now we can appreciate their quirkiness.

This book is about JavaScript as it relates to the MooTools framework. Like any other language, JavaScript's predictability has a lot to do with the people who code with it. While it is pretty predictable, JavaScript does have some quirks and unique features that might not be apparent at base level. Unfortunately, a lot of us who proudly proclaim to be JavaScript developers don't take time to learn the language enough to appreciate these quirks and features.

A big part of this problem, surprisingly, comes from the popularity of frameworks. JavaScript's almost prodigal-son-like comeback into the limelight of web development has brought forth a slew of libraries and frameworks that promise an easier experience when working with the language. While most of them do deliver on the promise, it comes with the cost of dependency: developers get so comfortable with a framework that they forget there's a powerful language underneath the abstraction.

This book tries to address this particular issue for the MooTools framework. MooTools is in the unique position of being one of the more popular frameworks that extend and improve JavaScript rather than bury it in the guise of an API. MooTools works with native JavaScript, uses native JavaScript, and feels like native JavaScript. MooTools users, therefore, are exposed to the power of JavaScript at every level—all they have to do is look at it.

If you're looking for a recipe book, a how-to book, or a book of source code that you can copy and paste into your next application, I'm afraid this is not that book. This book is all about exploring JavaScript and looking at how JavaScript is used for the internals of the MooTools framework. This book will show you how the features of JavaScript are used inside the framework, and how they come together to create the very powerful set of APIs we know as MooTools.

In essence, this book is an extension and expansion of the Up the MooTools Herd series I previously wrote for my blog. As with that series, this book is not aimed at beginners, but at intermediate and advanced users. So, if you're new to MooTools or JavaScript, I suggest you put this book on your to-read list and grab a beginner's book first.

This book is divided into three parts. The first part is all about JavaScript as ECMAScript, and focuses on the native features of the language—functions, objects, and types—and the subsystems inside MooTools that work with these parts. The second part of the book focuses on JavaScript in the browser and explores subjects such as elements, events, and animation. Finally, the last part of this book is a short exploration of JavaScript outside the browser and gives an introduction to CommonJS and MooTools using Deck.

As you'll learn in the next chapter, MooTools is divided into two main projects: MooTools Core and MooTools More. In writing this book, I've decided to focus solely on MooTools Core, so there's no mention of any of the features or extensions found in MooTools More. Also, I've limited myself to MooTools version 1.3 for this book, so any features from or incompatibilities with previous versions are not mentioned.

And with those words out of the way, it's time for us to start our exploration. It's best that we begin with the opening credits and get to know our dramatis personae. So if you're ready, let's meet the cast: JavaScript and MooTools.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset