Beautiful JavaScript: Leading Programmers Explain How They Think

Beautiful JavaScript: Leading Programmers Explain How They Think

by Anton Kovalyov
Beautiful JavaScript: Leading Programmers Explain How They Think

Beautiful JavaScript: Leading Programmers Explain How They Think

by Anton Kovalyov

eBook

$25.49  $33.99 Save 25% Current price is $25.49, Original price is $33.99. You Save 25%.

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

JavaScript is arguably the most polarizing and misunderstood programming language in the world. Many have attempted to replace it as the language of the Web, but JavaScript has survived, evolved, and thrived. Why did a language created in such hurry succeed where others failed?

This guide gives you a rare glimpse into JavaScript from people intimately familiar with it. Chapters contributed by domain experts such as Jacob Thornton, Ariya Hidayat, and Sara Chipps show what they love about their favorite language—whether it’s turning the most feared features into useful tools, or how JavaScript can be used for self-expression.

Contributors include:

  • Angus Croll
  • Jonathan Barronville
  • Sara Chipps
  • Marijn Haverbeke
  • Ariya Hidayat
  • Daryl Koopersmith
  • Anton Kovalyov
  • Rebecca Murphey
  • Daniel Pupius
  • Graeme Roberts
  • Jenn Schiffer
  • Jacob Thornton
  • Ben Vinegar
  • Rick Waldron
  • Nicholas Zakas

Product Details

ISBN-13: 9781449371166
Publisher: O'Reilly Media, Incorporated
Publication date: 08/13/2015
Sold by: Barnes & Noble
Format: eBook
Pages: 168
File size: 3 MB

About the Author

Anton Kovalyov was born and raised in Tashkent, Uzbekistan. Back in the day, he was mostly writing Python and (re-)compiling Gentoo. In 2008, he moved to the United States where he joined Disqus. Around the same time, he discovered JavaScript and the two have been inseparable ever since. While at Disqus, Anton authored JSHint, a JavaScript linting tool and co-authored Third-Party JavaScript(Manning). After Disqus, Anton moved to Mozilla, where he worked on the Firefox Developer Tools team.

Today, Anton works at Medium and lives in Oakland, CA.

Table of Contents

Preface vii

1 Beautiful Mixins 1

Classical Inheritance 1

Prototypes 2

Mixins 3

The Basics 4

The Use Case 4

Classic Mixins 5

The extend Function 6

Functional Mixins 7

Adding Options 8

Adding Caching 9

Advice 10

Wrapup 11

2 Eval and Domain-Specific Languages 13

What About "eval is Evil"? 13

History and Interface 14

Performance 15

Common Uses 16

A Template Compiler 16

Speed 18

Mixing Languages 19

Dependencies and Scopes 20

Debugging Generated Code 21

Binary Pattern Matches 21

Closing Thoughts 25

3 How to Draw a Bunny 27

What Is a Rabbit? 27

What Is a Bunny? 28

What Does This Have to Do with JavaScript? 29

With So Much Variation, Which Way Is Correct? 32

How Does This Affect the Classroom? 33

Is This Art? And Why Does That Matter? 34

What Does This Look Like? 36

What Did I Just Read? 38

4 Too Much Rope, or JavaScript for Teams 39

Know Your Audience 40

Stupid Good 40

Keep It Classy 41

Style Rules 43

Evolution of Code 44

Conclusion 44

5 Hacking JavaScript Constructors for Model Harmony 47

Doppelgangers 48

Miniature Models of Factories 50

Constructor Identity Crisis 51

Making It Scale 52

Conclusion 54

6 One World, One Language 57

An Imperative, Dynamic Proposal 58

The Paradox of Choice 60

Globalcommunicationscript 60

7 Math Expression Parser and Evaluator 61

Lexical Analysis and Tokens 61

Syntax Parser and Syntax Tree 66

Tree Walker and Expression Evaluator 72

Final Words 76

8 Evolution 77

Backbone 79

New Possibilities 80

9 Error Handling 83

Assume Your Code Will Fail 83

Throwing Errors 84

When to Throw Errors 86

Types of Errors 86

Custom Errors 88

Handling Errors 89

Global Error Handling in Browsers 91

Global Error Handling in Node.js 92

Summary 93

10 The Node.js Event Loop 95

Event-Driven Programming 95

Asynchronous, Nonblocking I/O 97

Concurrency 99

Adding Tasks to the Event Loop 99

11 JavaScript Is 101

JavaScript Is Dynamic 101

JavaScript Can Be Static 102

JavaScript Is Functional 102

JavaScript Does Everything 103

12 Coding Beyond Logic 105

0 The Basement 105

1 Quine's Paradox 105

2 The Conjecture 110

3 Peer Review 112

13 JavaScript Is Cutieful 115

All This Loose Beauty 115

The Absurdity of Dalí 115

Dalí's JavaScript 116

Is This Beauty Just Ugly? 116

An Unfortunate Necessity 116

The Beauty Is in the Madness 116

Let's Have a Wee Look at map 116

Hello, thisArg 117

Okay! So That's a Bunch of Stuff I Already Knew About [].map-Now What? 117

Calling All Cars 117

Number 117

Now I Know Everything 118

Wild 118

14 Functional JavaScript 119

Functional Programming 119

Functional JavaScript 121

Objects 126

Now What? 127

15 Progress 129

Index 147

From the B&N Reads Blog

Customer Reviews