Effective JavaScript: PowerPoint Presentation, PPT - DocSlides

Download sherrill-nordquist | 2017-12-04 | General Three Days of the Good Parts. Douglas Crockford. The First Day. Programming Style and Your Brain. And Then There Was JavaScript. Function the Ultimate. The Metamorphosis of Ajax. The Second Day. Fun with Functions. ID: 612519

PowerPoint Effective JavaScript: PowerPoint Presentation, PPT - DocSlides Slideshow

Slide1Effective JavaScript:Three Days of the Good PartsDouglas Crockford.Slide2The First DayProgramming Style and Your BrainAnd Then There W

  • Views 45
Download this presentation

Effective JavaScript: PowerPoint Presentation, PPT - DocSlides

Click below link (As may be) to download this presentation.

Download Note - The PPT/PDF document "Effective JavaScript: PowerPoint Present..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Presentations text content in Effective JavaScript: PowerPoint Presentation, PPT - DocSlides

  • Effective JavaScript:Three Days of the Good Parts
  • Douglas Crockford
  • The First Day
  • Programming Style and Your Brain
  • And Then There Was JavaScript
  • Function the Ultimate
  • The Metamorphosis of Ajax
  • The Second Day
  • Fun with Functions
  • The Third Day
  • Fun with Functions
  • Principles of Security
  • Managing
  • Asynchronicity
  • The Better Parts
  • Programming Style&Your Brain
  • Douglas
  • Crockford
  • System Two: HeadSystem One: Gut
  • Visual Processing.
  • An analogy.
  • 0
  • Advertising.
  • 1
  • Tobacco.
  • 2
  • Computer Programs.
  • The most complicated things people make.
  • 3
  • Artificial Intelligence.
  • 4
  • Programming Language.
  • 5
  • Perfection.
  • 6
  • Hunters and Gatherers.
  • 7
  • Programming uses Head and Gut.
  • Tradeoffs.
  • 8
  • JavaScript.
  • Good Parts.
  • Bad Parts.
  • 9
  • JSLint.
  • JSLint
  • defines a professional subset of JavaScript.
  • http://www.JSLint.com/
  • 0
  • WARNING!
  • JSLint will hurt your feelings.
  • 1
  • Left or Right?
  • block{ ....}
  • block
  • {
  • ....
  • }
  • 2
  • Left or Right?
  • block{ ....}Be consistent.
  • block
  • {
  • ....
  • }
  • Everyone should do it like I do.
  • 3
  • Left or Right?
  • return{ ok: false};SILENT ERROR!
  • return {
  • ok: true
  • };
  • Works well in JavaScript.
  • 4
  • return
  • {
  • ok: false
  • };
  • 5
  • return
  • ; // semicolon insertion
  • {
  • ok: false
  • };
  • 6
  • return;
  • {
  • // block
  • ok: false
  • }
  • ;
  • 7
  • return;
  • {
  • ok:
  • false
  • // label
  • };
  • 8
  • return;
  • {
  • // useless
  • ok:
  • false
  • // expression
  • };
  • // statement
  • 9
  • return;
  • {
  • ok: false
  • ; // semicolon
  • };
  • // insertion
  • 0
  • return;
  • {
  • ok: false;
  • }
  • ;
  • // empty statement
  • 1
  • return;
  • {
  • // unreachable statement
  • ok: false;
  • }
  • 2
  • return
  • { ok: false};
  • return;
  • false;
  • 3
  • Prefer forms that are error resistant.
  • 4
  • switch statement.
  • The
  • fallthrough
  • hazard.
  • 5
  • “That hardly ever happens”
  • is another way of saying
  • “It happens”.
  • 6
  • A good style can help produce better programs.
  • Style should not be about personal preference and self-expression.
  • 7
  • THEROMANSWROTELATINALLINUPPERCASEWITHNOWORDBREAKSORPUNCTUATION
  • 8
  • Medieval copyists introduced lowercase, word breaks, and punctuation.
  • These innovations helped reduce the error rate.
  • 9
  • Good use of style can help reduce the occurrence of errors.
  • 0
  • The Elements of StyleWilliam Strunk
  • http://www.crockford.com/wrrrld/style.html
  • 1
  • Programs must communicate clearly to people.
  • 2
  • Use elements of good composition where applicable.
  • For example, use a space after a comma, not before.
  • 3
  • Use spaces to disambiguate parens.
  • No space between a function name and
  • (
  • .
  • One space between all other names and
  • (
  • .
  • Wrong:
  • foo
  • (bar);
  • return(
  • a+b
  • );
  • if(a===0) {…}
  • function
  • foo
  • (b) {…}
  • function(x) {…}
  • 4
  • Immediately Invocable Function Expressions
  • function () {
  • ...
  • }(); // Syntax error!
  • 5
  • Immediately Invocable Function Expressions
  • (
  • function () {
  • ...
  • }
  • )
  • ()
  • ;
  • 6
  • Immediately Invocable Function Expressions
  • (
  • function () {
  • ...
  • }()
  • )
  • ; // Neatness counts.
  • 7
  • The Heartbreak of Automatic Semicolon Insertion
  • x = y // <-- Missing semicolon
  • (
  • function () {
  • ...
  • }()
  • )
  • ;
  • Never rely on automatic semicolon insertion!
  • 8
  • with statement.
  • with (o) { foo = koda;}
  • o.foo =
  • koda
  • ;
  • o.foo =
  • o.koda
  • ;
  • foo
  • =
  • koda
  • ;
  • foo
  • =
  • o.koda
  • ;
  • 9
  • with statement.
  • with (o) { foo = koda;}
  • o.foo = koda; o.foo = o.koda; foo = koda; foo = o.koda;
  • I am not saying that it isn’t useful.
  • I am saying that there is never a case where it isn’t confusing.
  • 0
  • Confusion must be avoided.
  • 1
  • Transitivity? What's That?
  • 0 == "" // true
  • 0 == "0" // true
  • "" == "0" // false
  • false == "false" // false
  • false == "0" // true
  • " \t\r\n " == 0 // true
  • Always use
  • ===
  • , never
  • ==
  • .
  • 2
  • If there is a feature of a language that is sometimes problematic, and if it can be replaced with another feature that is more reliable, then always use the more reliable feature.
  • 3
  • Multiline string literals
  • var
  • long_line_1 = "This is a \
  • long line"; // ok
  • var
  • long_line_2 = "This is a \
  • long line"; // syntax error
  • 4
  • Avoid forms that are difficult to distinguish from common errors.
  • 5
  • if (a = b) {…}
  • a = b;
  • if (a) {…}
  • if (a === b) {…}
  • 6
  • Make your programs look like what they do.
  • 7
  • Global variables.
  • Global variables are evil.
  • Avoid global variables.
  • When using global variables, be explicit.
  • UPPER_CASE
  • Global variables should be as rare as hens teeth and stick out like a sore thumb.
  • 8
  • new prefix
  • Forgetting
  • new
  • causes a constructor to clobber global variables without warning.
  • Fixed in ES5/strict.
  • 9
  • Constructor functions should be named with InitialCaps.
  • Nothing else should be named with
  • InitialCaps
  • .
  • 0
  • var
  • a = b = 0;
  • var
  • a = 0;
  • var
  • b = 0;
  • b = 0;
  • var
  • a = b;
  • 1
  • Write in a way that clearly communicates your intent.
  • 2
  • if (a) b(); c();
  • 3
  • if (a) b(); c();
  • if (a) {b(); c();}
  • if (a) {b();} c();
  • 4
  • As our processes become more agile, our coding must be more resilient.
  • 5
  • ++
  • 6
  • ++
  • x += 1
  • 7
  • ++
  • x += 1
  • x++
  • 8
  • ++
  • x += 1x++++x
  • 9
  • ++x;++x;
  • x += 2;
  • 0
  • For no cost, by adopting a more rigorous style, many classes of errors can be automatically avoided.
  • 1
  • Bad stylists
  • Under educated.
  • Old school.
  • Thrill seeker.
  • Exhibitionist.
  • 2
  • “That was intentional.”
  • “I know what I’m doing.”
  • 3
  • Performance.
  • Performance specific code is usually
  • crufty
  • .
  • Clean code is easier to reason about.
  • Premature optimization is the root of all evil.
  • Donald Knuth
  • Most of the code has a negligible impact on performance. Only optimize the code that is taking the time.
  • Algorithm replacement is vastly more effective than code fiddling.
  • 4
  • Programming is the most complicated thing that humans do.
  • Computer programs must be perfect.
  • Humans are not good at perfect.
  • 5
  • Designing a programming style demands discipline.
  • It is not selecting features because they are liked, or pretty, or familiar.
  • 6
  • The Abyss
  • 7
  • The JSLint style was driven by the need to automatically detect defects.
  • Forms that can hide defects are considered defective.
  • 8
  • Language Subsetting.
  • Only a madman would use all of C++.
  • 9
  • There will be bugs.
  • Do what you can to move the odds to your favor.
  • 0
  • NextChapter 2: Then There Was JavaScript
Recommended
Successful sales, but ethical operations?
  • 29

Successful sales, but ethical operations?

Venous
  • 81

Venous

Terri Bianchi, DNP, ARNP
  • 37

Terri Bianchi, DNP, ARNP

APRIDEC MEDICAL OUTREACH GROUP
  • 28

APRIDEC MEDICAL OUTREACH GROUP

“Imparting Technical Teacher Training Through Infused Knowledge and Skill Structures of Outcome B
  • 28

“Imparting Technical Teacher Training Through Infused Knowledge and Skill Structures of Outcome B

Copyright — What’s the Big Deal
  • 27

Copyright — What’s the Big Deal

Copyrighting
  • 44

Copyrighting

The 7 types of B2B copywriter
  • 32

The 7 types of B2B copywriter

Welcome COR Parents
  • 22

Welcome COR Parents

Report this Document.