Book Image

Backbone.js Patterns and Best Practices

By : Swarnendu De
Book Image

Backbone.js Patterns and Best Practices

By: Swarnendu De

Overview of this book

Table of Contents (19 chapters)
Backbone.js Patterns and Best Practices
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Precompiling Templates on the Server Side
Index

Understanding why unit testing is important


If you already know the benefits of testing and follow the best practices while developing your JavaScript apps, you can skip this section. If you still wonder why you should actually test your application while you are already writing clean and maintainable code, the following are a few reasons to consider:

  • Testing is never a waste of time. You do not need to run your code repeatedly to see whether it works or not. You can run all the test cases at once to see whether everything is functioning as expected. Testing gives you the confidence that your code is working fine.

  • Unit tests are really fast to create and fast to run too.

  • Update your code without worry. Your test will tell you whether the function is working as it is expected to or not. You will find this very helpful, especially when you work in a team.

  • Once you start writing unit tests for your code, you will soon find that you are writing more modular, flexible, and testable code than you...