Now shipping: Principles of Object-Oriented JavaScript
I’m very proud to announce that Principles of Object-Oriented JavaScript is now shipping! For frequent readers, this book is the print version of my self-published ebook, The Principles of Object-Oriented Programming in JavaScript, which I published at the beginning of 2013.
Birth of an ebook
The whole process began after a chat with Kate Matsudaira. We were talking about the ins and outs of publishing, and she managed to convince me that I should self-publish my next book. After doing a bit of research, I wound up selecting Leanpub as the publisher. I really liked a lot about their service:
- Books could be written in Markdown
- Automatically generate three formats of ebook
- Automatic customizable product page
- Handling of payments and refunds
- Royalty payments through PayPal
- Readers can select how much money they want to pay
- Ability to update the ebook at any time and allow existing readers to update for free
I chose the topic because I was consulting at the time and was teaching a full-day course on object-oriented programming in JavaScript. Although I would leave a copy of my slides with the attendees, I felt like that wasn’t enough for them to remember everything we had talked about. I thought a companion book that covered the topics in the same order and with the same examples would be incredibly useful. So I started writing.
I quickly realized that this would be a short book, much shorter than most of my others. When compared to Professional JavaScript for Web Developers, which is over 900 pages, this book would clock in at just under 100 pages. That made me happy because I know that 900 pages can be intimidating. I’d also grown much fonder of short books with a laser-focus on specific topics.
Enter No Starch
When the ebook was complete, I didn’t think there was much chance of getting it published as a physical book by an existing publisher. Most publishers want around 200 pages. I figured if there was enough interest then I’d try to self-publish the physical book as well, but I would wait to see what the response was.
I ended up in a conversation with Bill Pollack from No Starch Press at Fluent last year. I explained to him what I was doing and he shared how No Starch approaches publishing. I was really enamored by the old-school approach he described: serious copy and tech editors, fine-tuning of topics and tone, and an approach to putting out a small quantity of high-quality books each year. We left with a handshake that we’d talk again if he liked what he read.
After reading the ebook, Bill thought it was worthwhile to proceed to create a physical book. No Starch wasn’t the first publisher to approach me, but they definitely felt like the right one. One of my big concerns was being able to continue selling on Leanpub so I could fulfill my commitment to those who had purchased the ebook already. Where other publishers said I would have to take down the Leanpub offering, No Starch allowed me to keep it up.
Working with the folks at No Starch was great, it reminded me of how things were in publishing ten years ago. The copy editing was fantastic and really smoothed out a lot of my narrative. The tech editing by Angus Croll was incredibly useful and appropriately nitpicky (seriously, if you don’t think your tech editor is nitpicky, you need to find a new one). And the cover design, well, I couldn’t be happier (the theme is JavaScript as the engine that driving web and server).
Code Lindley graciously agreed to write a foreword for the No Starch version.
So what is this book?
First and foremost, this book is the print edition of my self-published ebook, but with actual copy editing, tech editing, and professional graphics. The topics covered are the same and are mostly covered in the same way (the No Starch version has additional clarifications in some places). As a bonus, there is a No Starch ebook version.
The book itself is about understanding objects in JavaScript. Topics include:
- The differences between primitive and reference values
- What makes JavaScript functions so unique
- The various ways of creating an object
- The difference between data properties and accessor properties using ECMAScript 5
- How to define your own constructors
- How to work with and understand prototypes
- Various inheritance patterns for types and objects
- How to create private and privileged object members
- How to prevent modification of objects using ECMAScript 5 functionality
One of the things I wanted to do with this book was treat ECMAScript 5 as the current version of JavaScript. There are still a lot of books that end up saying things like, “if your browser supports ECMAScript 5, do it this way.” I wanted to look towards a future where ECMAScript 5 is the minimum version everyone uses, and so I chose to do away with those qualifying statements and use ECMAScript 5 terminology exclusively throughout.
I also wrote the book in such a way that it’s relevant both for web and Node.js developers. There is very little mention of web browsers or Node.js, and that is intentional, to focus on the core of JavaScript that is universally applicable.
Overall, I’m very proud of this book. I think it’s short enough to not be intimidating but dense enough that you should get a good and fairly deep understanding of object-oriented concepts in JavaScript. Although I wasn’t planning on an actual print book for this material, I am very happy with the result. So thanks to everyone involved – this has been a fun journey.
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.