Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WEB APP TESTING USING KNOCKOUT.JS

You're reading from   WEB APP TESTING USING KNOCKOUT.JS Design, implement, and maintain a fully tested JavaScript web application using Knockout.JS

Arrow left icon
Product type Paperback
Published in Nov 2014
Publisher
ISBN-13 9781783982844
Length 154 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Roberto Messora Roberto Messora
Author Profile Icon Roberto Messora
Roberto Messora
Arrow right icon
View More author details
Toc

Idiomatic JavaScript patterns


Every programming language has its own idiomatic patterns. They are design patterns that can be expressed using the specific characteristics and syntax of that programming language.

Our objective is to write good code, which can be tested in the simplest possible way. If we learn how to effectively use JavaScript, we can write clean code and avoid a certain number of additional tests.

There are two idiomatic patterns that are very important in our scenario. We will extensively use them throughout all the My Todo solution:

  • Constructor functions

  • Module pattern

Obviously, there are many other patterns and techniques that are extremely useful, for example, Asynchronous Module Definition (AMD) and Dependency Injection (DI), but they are out of the scope of this book in order to keep things simple but ready for further refinements.

Constructor functions

Constructor functions are used to define classes in our solution instead of literals. This is very important, especially...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime