Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
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

Product type Book
Published in Nov 2014
Publisher
ISBN-13 9781783982844
Pages 154 pages
Edition 1st Edition
Languages
Author (1):
ROBERTO MESSORA ROBERTO MESSORA
Author Profile Icon ROBERTO MESSORA
ROBERTO MESSORA
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