Your guide to building full web-scale applications. Buy now!
Early Release content now available:
- Asynchronous Operations, Callbacks, Promises and Deferreds
- Code Quality
- Function Polymorphism
- Function Scope, Hoisting and Closures
- Functional Programming and Stateless Functions
- Immediately Invoked Function Expressions
- Method Chaining and Fluent APIs
- Method Context
- Named Parameters
- Node Modules
- Object Factories
- Partial Application and Currying
- Principles of Modularity
- Prototypal Inheritance, Prototype Cloning and the Flyweight Pattern
- The Module Pattern
- Unit Testing
- Architecting for Scale
- Collaboration, Build, Continuous Integration, Deployment
- Communicating with Servers and APIs
- Designing and Programming RESTful APIs with Node.js
- Event-driven, Modular Client Side Application Architecture
- Feature Toggles
- Logging and Cross Cutting Concerns
- Separatian of Concerns (MVC, etc.)
by Adam Flaherty (O’Reilly)
1. Why is your book timely – what makes it important right now?
2. What information do you hope that readers of your book will walk away with?
3. What’s the most exciting/important thing happening in your space?
WebGL games and demos are showing technology that would have been impressive on native desktops five years ago. It might be another five years before web games can compete with the technical capabilities of today’s desktop and platform games, but it’s clear that’s the direction we’re headed in.
That’s really exciting for more than just the game community. It will also impact consumer expectations of what’s possible with website user interfaces. I think we’ll see the shift first in entertainment properties and ad agency content, but the web experience is definitely going to get more immersive in the very near future. It’s already starting to happen.
4. Please include a short list of 5 tips and tricks.
2. Unit test all of your surface-area code. That means, if you export a function for somebody else to use, that function should be covered by tests. Make sure you remember to test for edge and error cases.
Unit tests are more than just an assurance that your code does what it’s supposed to do. They can also act as an implementation checklist to help you while you’re developing your code. Of course, the best part about unit tests is that code is a changing, ever evolving thing. Unit tests give you the assurance that when you go in and make changes, whether they’re bug fixes, feature additions, or refactors, you’ll know right away if anything goes wrong. Just run your test suite and make sure the tests still pass.
Unit tests teach you discipline, and provide you with a deep debugging insight into your code. It really helps to know what still works and what doesn’t when a bug creeps in, and short of littering your code with all sorts of logging statements, unit tests give you better insight into that than almost anything else you can do. I know there are lots of developers on the fence about this, or just not sure where to begin. Here’s your kick: It’s worth the effort to figure it out.
3. Don’t get attached to any particular implementation of your code. A month from now, you’re going to wish you’d done things differently. Get used to it. Once you’ve set down your code, forget about the pride in your implementation. The important questions are, “does it do the job?” and “will it be easy to change?” — emphasis on the second question.
“Code by itself almost rots and it’s gotta be rewritten. Even when nothing has changed, for some reason, it rots.” – Ken Thompson