Search icon CANCEL
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
Clean Code in JavaScript

You're reading from   Clean Code in JavaScript Develop reliable, maintainable, and robust JavaScript

Arrow left icon
Product type Paperback
Published in Jan 2020
Publisher Packt
ISBN-13 9781789957648
Length 548 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
James Padolsey James Padolsey
Author Profile Icon James Padolsey
James Padolsey
Arrow right icon
View More author details
Toc

Table of Contents (26) Chapters Close

Preface 1. Section 1: What is Clean Code Anyway?
2. Setting the Scene FREE CHAPTER 3. The Tenets of Clean Code 4. The Enemies of Clean Code 5. SOLID and Other Principles 6. Naming Things Is Hard 7. Section 2: JavaScript and Its Bits
8. Primitive and Built-In Types 9. Dynamic Typing 10. Operators 11. Parts of Syntax and Scope 12. Control Flow 13. Section 3: Crafting Abstractions
14. Design Patterns 15. Real-World Challenges 16. Section 4: Testing and Tooling
17. The Landscape of Testing 18. Writing Clean Tests 19. Tools for Cleaner Code 20. Section 5: Collaboration and Making Changes
21. Documenting Your Code 22. Other Peoples' Code 23. Communication and Advocacy 24. Case Study 25. Other Books You May Enjoy

Setting the Scene

JavaScript was created by Brendan Eich in 1995, with the goal of being a glue language. It was intended to help web designers and amateurs easily manipulate and derive behavior from their HTML. JavaScript was able to do this via the DOM API, a set of interfaces provided by the browser that would give access to the parsed representation of HTML. Soon after this, DHTML became the popular term, referring to the more dynamic user interfaces that JavaScript enabled: everything from animated rollover button states to client-side form validation. Eventually came the rise of Ajax, which enabled communication between the client and the server. This opened up a considerable fountain of potential applications. The web, previously purely the domain of documents, was now on the way to becoming a powerhouse of processor- and memory-intensive applications:

In 1995, nobody could have predicted that JavaScript would one day be used to build complex web applications, program robots, query databases, write plugins for photo manipulation software, and be behind one of the most popular server runtimes in existence, Node.js.

In 1997, not long after its creation, JavaScript was standardized by Ecma International under the name ECMAScript, and it is still undergoing frequent changes under the TC39 committee. Most recent versions of the language have been named according to the year of their release, such as ECMAScript 2020 (ES2020).

Due to its burgeoning capabilities, JavaScript has attracted a passionate community that drives its growth and ubiquity. And due to its considerable popularity, there are now countless different ways to do the same thing in JavaScript. There are thousands of popular frameworks, libraries, and utilities. The language too is changing on a near-constant basis in reaction to the increasing demands of its applications. This creates a great challenge: among all of this change, while being pushed and pulled in different directions, how can we know how to write the best possible code? Which frameworks should we use? What conventions should we employ? How should we test our code? How should we craft sensible abstractions?

To answer these questions, we need to briefly go back to basics. And that is the purpose of this chapter. We'll be discussing the following:

  • What the true purpose of the code is
  • Who our users are and what problems they have
  • What it means to write code for humans
You have been reading a chapter from
Clean Code in JavaScript
Published in: Jan 2020
Publisher: Packt
ISBN-13: 9781789957648
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 €18.99/month. Cancel anytime