human javascript by Henrik Joreteg
There has to be a saner way to write javascript.
At some point, this all became a mess.
Collaboration and maintenance is nearly impossible because only the "JavaScript rock star" who wrote the 3,000 line file understands how anything works.
Adding features sounds frightening because the whole app's a pile of fragility.
Knock one bug off and three more always show up.
What if there was a better way?
What if you could eliminate 3,000 line JavaScript files, nasty state bugs and that nagging feeling of oh-please-don't-touch-it fragility?
What if you could make your team's communication and code collaboration better while shipping higher quality software at an increasing rate?
And what if you could do all this while investing in software skills that aren't tied to the anchor of a here-today-irrelevant-tomorrow framework?
Introducing
human javascript
Practical patterns for simple but powerful JavaScript apps

And now a word from the author, Henrik Joreteg:
Testimonials

Required reading for every JavaScript Developer.Sven Lito@svenlito

It's like the Holy Grail—an answer to my search for a complete picture for how to develop stuff practically.David Dias@daviddias

The best book you can buy right now to get a grip on frontend JavaScript.Jan Lehnardt@janl

Human Javascript is one of these books I would have loved to have read two years ago. Great book!Norman Rzepka@normanrz
An excerpt from Jan Lehnardt's foreword:
I read the draft in one sitting, took lots of notes and at the end of it, this whole space of the frontend world that wasn’t accessible to me, became clearer.
I saw the necessity for more complex MVC frameworks on the client than I had experience with. I started to understand why structuring your code in certain ways makes it more robust in the face of having multiple people work on it. The book managed to illuminate well known concepts in the unfamiliar frontend territory. Human JavaScript made frontend development accessible to me.
Truly inspired again I went on and built a small side project. It isn’t much, but it makes me excited about building more web apps.
Human JavaScript is the collected wisdom of the team at &yet, where Henrik works, and all the blood and sweat that goes into their excellent client projects, and their own products. It couldn’t come from a better group of people. They care about the right technology as much as teaching it. They take it upon themselves to fill the gaps of missing canon for web development.
I just can’t wait to see what the people they inspire come up with.
I can’t wait to see what you come up with.
— Jan Lehnardt
Berlin, September 27th 2013

Jan is an Open Source Software developer from Berlin, Germany. He is the Vice President of Apache CouchDB, the database that replicates. He’s the co-curator of JSConf EU, a partner at The Node Firm and his one famous JavaScript project is mustache.js. He currently works on hood.ie, an open source noBackend solution that aims to do for frontend development what Rails did for the backend: make all the tedious pain go way, and hide it behind an intuitive JavaScript API.
Here's what you'll learn:
You'll discover a better way of thinking about advanced JavaScript application development.
You'll gain a strong foundation for building amazing web app experiences in a logical way.
You'll understand the philosophy behind how to make decisions with your app structure.
No magic frameworks. No monolithic toolkits. You're going to work with proper, real-life JavaScript in a way you'll understand, and with explanations that help you learn how to make great choices as you build your apps.
Table of Contents
Foreword by Jan Lehnardt
Ch 1 – Introduction
- Acknowledgements
- This Book Will Help You Build Native HTML5 Apps
- Realtime apps are human apps
- Misconceptions, FUD and engineering
- Picking your tools
Ch 2 – Client or server? Go big or go home.
- Deciding between client/server app
- So I didn't talk you out of it? Ok, then go all out!
Ch 3 – Writing code for humans.
- Tools and trickery
- Cleverness is a double edged sword
- Code Linting
Ch 4 – No more clientside spaghetti. Organizing your code.
- Refactor early, refactor often
- Separating views and state
- CommonJS Modules
- Grab your mooonboots
- A note on going to production
- The structure of the clientapp folder
- Creating an `app` global
Ch 5 – Using Events – Modules talking to modules
- Using events to build decoupled applications/reusable modules
- Emitters and events, no magic, just functions
Ch 6 – Models
- A simple example
- Using models for everything
- Applying this approach to the example
- Model alternatives
- Readability
- Derived properties
- Direct access to properties
- Quick note on getters/setters
- Warning!
- Type enforcement
- Better handling of lists/dates
- Summarizing models
Ch 7 – Views and the DOM
- Introducing views
- What they do
- How they work
- Introducing HumanView
- A Hierarchy of Views
- Ca veat – understanding `this.$`
- Registering DOM event handlers
- Binding model values to templates
- HumanView's convenience methods
- Rendering collections
- A bit about defining bindings in templates (à la AngularJS, Ractive)
Ch 8 – Handling templates
- Stop sending template engines to the browser
- How we used to do it
- Why that's less-than-ideal
- How we're doing it now
- The end result
Ch 9 – Clientside Routing
- Same sh*t different URL/handing control of routing to client
- How to deal with clientside routes
Ch 10 – 3... 2... 1... Blastoff!
- Application launch sequence
- Stepping through an example
Ch 11 – Testing and QA that doesn't suck (so your app won't)
- The problem/challenge of proper QA
- Meet the SpaceMonkey
- Doing cross-browser testing
Ch 12 – Settings and configs
- The problem
- getconfig
- clientconfig
- Using them together
- Security caveats
Ch 13 – Caveats/Gotchas
- Function bindings
- Gotchas regarding DOM manipulation in views (they may still be detached)
- Failed Ajax requests
Ch 14 – A few closing thoughts
- Staying up to date
- Complimentary resources
- Open Source
- Feedback
- Thank you!
Here's what's included:
- DRM-free Kindle, ePub, and PDF copies
- 100+ pages of clear explanations
- Code examples
- Project skeleton for JavaScript applications
- A lifetime subscription of updates to the book
(100 user site license also available during checkout)
Stay Up To Date
Every so often we’ll make some special announcements about tools and new resources, highly limited Human JavaScript training, major updates to the book, and special sales. Add your email here to get on the list for announcements.


About Henrik Joreteg
Henrik Joreteg has helped clients like AT&T, Ericsson, and Pacific Northwest National Labs understand how to build modern JavaScript applications in an enjoyable and effective way.
Follow him on twitter to hear about updates to the book and supporting libraries.
Henrik's company, &yet, provides full-stack software consulting and training for building advanced realtime apps, APIs, JavaScript SDKs.
&yet also builds And Bang (a shared tasks and chat platform) and talky.io (a WebRTC multi-user experience).
He and his wife Holly just had their second baby. :)