Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

of

JS Fest 2018. Douglas Crockford. The Better Parts Slide 1 JS Fest 2018. Douglas Crockford. The Better Parts Slide 2 JS Fest 2018. Douglas Crockford. The Better Parts Slide 3 JS Fest 2018. Douglas Crockford. The Better Parts Slide 4 JS Fest 2018. Douglas Crockford. The Better Parts Slide 5 JS Fest 2018. Douglas Crockford. The Better Parts Slide 6 JS Fest 2018. Douglas Crockford. The Better Parts Slide 7 JS Fest 2018. Douglas Crockford. The Better Parts Slide 8 JS Fest 2018. Douglas Crockford. The Better Parts Slide 9 JS Fest 2018. Douglas Crockford. The Better Parts Slide 10 JS Fest 2018. Douglas Crockford. The Better Parts Slide 11 JS Fest 2018. Douglas Crockford. The Better Parts Slide 12 JS Fest 2018. Douglas Crockford. The Better Parts Slide 13 JS Fest 2018. Douglas Crockford. The Better Parts Slide 14 JS Fest 2018. Douglas Crockford. The Better Parts Slide 15 JS Fest 2018. Douglas Crockford. The Better Parts Slide 16 JS Fest 2018. Douglas Crockford. The Better Parts Slide 17 JS Fest 2018. Douglas Crockford. The Better Parts Slide 18 JS Fest 2018. Douglas Crockford. The Better Parts Slide 19 JS Fest 2018. Douglas Crockford. The Better Parts Slide 20 JS Fest 2018. Douglas Crockford. The Better Parts Slide 21 JS Fest 2018. Douglas Crockford. The Better Parts Slide 22 JS Fest 2018. Douglas Crockford. The Better Parts Slide 23 JS Fest 2018. Douglas Crockford. The Better Parts Slide 24 JS Fest 2018. Douglas Crockford. The Better Parts Slide 25 JS Fest 2018. Douglas Crockford. The Better Parts Slide 26 JS Fest 2018. Douglas Crockford. The Better Parts Slide 27 JS Fest 2018. Douglas Crockford. The Better Parts Slide 28 JS Fest 2018. Douglas Crockford. The Better Parts Slide 29 JS Fest 2018. Douglas Crockford. The Better Parts Slide 30 JS Fest 2018. Douglas Crockford. The Better Parts Slide 31 JS Fest 2018. Douglas Crockford. The Better Parts Slide 32 JS Fest 2018. Douglas Crockford. The Better Parts Slide 33 JS Fest 2018. Douglas Crockford. The Better Parts Slide 34 JS Fest 2018. Douglas Crockford. The Better Parts Slide 35 JS Fest 2018. Douglas Crockford. The Better Parts Slide 36 JS Fest 2018. Douglas Crockford. The Better Parts Slide 37 JS Fest 2018. Douglas Crockford. The Better Parts Slide 38 JS Fest 2018. Douglas Crockford. The Better Parts Slide 39 JS Fest 2018. Douglas Crockford. The Better Parts Slide 40 JS Fest 2018. Douglas Crockford. The Better Parts Slide 41 JS Fest 2018. Douglas Crockford. The Better Parts Slide 42 JS Fest 2018. Douglas Crockford. The Better Parts Slide 43 JS Fest 2018. Douglas Crockford. The Better Parts Slide 44 JS Fest 2018. Douglas Crockford. The Better Parts Slide 45 JS Fest 2018. Douglas Crockford. The Better Parts Slide 46 JS Fest 2018. Douglas Crockford. The Better Parts Slide 47 JS Fest 2018. Douglas Crockford. The Better Parts Slide 48 JS Fest 2018. Douglas Crockford. The Better Parts Slide 49 JS Fest 2018. Douglas Crockford. The Better Parts Slide 50 JS Fest 2018. Douglas Crockford. The Better Parts Slide 51 JS Fest 2018. Douglas Crockford. The Better Parts Slide 52 JS Fest 2018. Douglas Crockford. The Better Parts Slide 53 JS Fest 2018. Douglas Crockford. The Better Parts Slide 54 JS Fest 2018. Douglas Crockford. The Better Parts Slide 55 JS Fest 2018. Douglas Crockford. The Better Parts Slide 56 JS Fest 2018. Douglas Crockford. The Better Parts Slide 57 JS Fest 2018. Douglas Crockford. The Better Parts Slide 58 JS Fest 2018. Douglas Crockford. The Better Parts Slide 59 JS Fest 2018. Douglas Crockford. The Better Parts Slide 60 JS Fest 2018. Douglas Crockford. The Better Parts Slide 61 JS Fest 2018. Douglas Crockford. The Better Parts Slide 62 JS Fest 2018. Douglas Crockford. The Better Parts Slide 63 JS Fest 2018. Douglas Crockford. The Better Parts Slide 64 JS Fest 2018. Douglas Crockford. The Better Parts Slide 65 JS Fest 2018. Douglas Crockford. The Better Parts Slide 66 JS Fest 2018. Douglas Crockford. The Better Parts Slide 67 JS Fest 2018. Douglas Crockford. The Better Parts Slide 68 JS Fest 2018. Douglas Crockford. The Better Parts Slide 69 JS Fest 2018. Douglas Crockford. The Better Parts Slide 70 JS Fest 2018. Douglas Crockford. The Better Parts Slide 71 JS Fest 2018. Douglas Crockford. The Better Parts Slide 72 JS Fest 2018. Douglas Crockford. The Better Parts Slide 73 JS Fest 2018. Douglas Crockford. The Better Parts Slide 74 JS Fest 2018. Douglas Crockford. The Better Parts Slide 75 JS Fest 2018. Douglas Crockford. The Better Parts Slide 76 JS Fest 2018. Douglas Crockford. The Better Parts Slide 77 JS Fest 2018. Douglas Crockford. The Better Parts Slide 78
Upcoming SlideShare
What to Upload to SlideShare
Next

2 Likes

Share

JS Fest 2018. Douglas Crockford. The Better Parts

This talk is about using programming languages more effectively, and using that experience to create and select better programming languages. There are bad practices in software development that are so old and well established that it is difficult to recognize the problems they cause. There will be a review of the new good parts in ES6. JSON will also be mentioned.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

JS Fest 2018. Douglas Crockford. The Better Parts

  1. 1. The Better Parts
  2. 2. Antoine de Saint-ExupéryAntoine de Saint-Exupéry
  3. 3. Il semble que la perfection soit atteinte non quand il n’y a plus rien à ajouter, mais quand il n’y a plus rien à retrancher. Antoine de Saint-Exupéry Terre des Hommes, 1939 It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to take away.
  4. 4. Good Parts It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to take away.
  5. 5. If a feature is sometimes useful and sometimes dangerous and if there is a better option then always use the better option.
  6. 6. We are not paid to use every feature of the language. We are paid to write programs that work well and are free of error.
  7. 7. We are not paid to use every feature of the language. We are paid to write programs that work well and are free of error.
  8. 8. A good programming language should teach you.
  9. 9. I made every mistake with JavaScript you could make.
  10. 10. Arguments against good parts • Just a matter of opinion. • Every feature is an essential tool. • It is sometimes useful. • I have a right to use every feature. • I need the freedom to express myself. • I need to reduce my keystrokes. • It is an insult to suggest that I would ever make a mistake with a dangerous feature. • There is a good reason those features were added to the language.
  11. 11. Foot Guns Brendan Eich
  12. 12. The purpose of a programming language is to aid programmers in producing error-free programs.
  13. 13. It is not possible to write good programs in JavaScript.
  14. 14. It is not only possible to write good programs in JavaScript, it is necessary. It is not possible to write good programs in JavaScript.
  15. 15. Java <> JavaScript
  16. 16. Java <> JavaScript Star Trek Star Wars
  17. 17. Java <> JavaScript Star Trek • Phasers • Photon Torpedoes • Uniforms • Regulations Star Wars
  18. 18. Java <> JavaScript Star Trek • Phasers • Photon Torpedoes • Uniforms • Regulations Star Wars • Light Sabres & Blasters • Proton Torpedoes • Sand • Chaos
  19. 19. Meesa web ninja!
  20. 20. The fantasy of infallibility. The futility of faultlessness.
  21. 21. Danger Driven Development
  22. 22. Scheduling A.The time it takes to write the code. B. The time it takes to make the code work right. Always take the time to code well.
  23. 23. New Good Parts in ES6 • Proper tail calls: return func();
  24. 24. New Good Parts in ES6 • Proper tail calls • Ellipsis...aka ...rest, aka ...spread function curry(func, ...first) { return function (...second) { return func(...first, ...second); }; } function curry(func) { var slice = Array.prototype.slice, args = slice.call(arguments, 1); return function () { return func.apply(null, args.concat(slice.call(arguments, 0))); }; }
  25. 25. New Good Parts in ES6 • Proper tail calls • Ellipsis • Module
  26. 26. New Good Parts in ES6 • Proper tail calls • Ellipsis • Module • let and const const fax = {}; fax = faz; // bad fax.fay = faz; // ok
  27. 27. New Good Parts in ES6 • Proper tail calls • Ellipsis • Module • Let • Destructuring let {that, other} = some_object; let that = some_object.that, other = some_object.other;
  28. 28. New Good Parts in ES6 • Proper tail calls • Ellipsis • Module • let and const • Destructuring • WeakMap
  29. 29. New Good Parts in ES6 • Proper tail calls • Ellipsis • Module • let and const • Destructuring • WeakMap • Megastring literals
  30. 30. var rx_number = /^(0(?:b[01]+|o[0-7]+|x[0-9a-fA- F]+|.[0-9]+(?:e[+-]?[0-9]+)?)?|[1-9][0- 9]*(?:.[0-9]+)?(?:e[+-]?[0-9]+)?)$/; function mega_regexp(str, fl) { return new RegExp(str.replace(/s/, ""), fl); } const rx_number = mega_regexp(`^( 0 (?: b [01]+ | o [0-7]+ | x [0-9 a-f A-F]+ | . [0-9]+ (?: e [+ -]? [0-9]+ )? )? | [1-9] [0-9]* (?: . [0-9]+ )? (?: e [+ -]? [0-9]+ )? )$`);
  31. 31. var rx_number = /^(0(?:b[01]+|o[0-7]+|x[0-9a-fA- F]+|.[0-9]+(?:e[+-]?[0-9]+)?)?|[1-9][0- 9]*(?:.[0-9]+)?(?:e[+-]?[0-9]+)?)$/; function mega_regexp(str, fl) { return new RegExp(str.replace(/s/, ""), fl); } const rx_number = mega_regexp(`^( 0 (?: b [01]+ | o [0-7]+ | x [0-9 a-f A-F]+ | . [0-9]+ (?: e [+ -]? [0-9]+ )? )? | [1-9] [0-9]* (?: . [0-9]+ )? (?: e [+ -]? [0-9]+ )? )$`); http://jex.im/regulex
  32. 32. New Bad Parts in ES6 • Proxies • Generators • Iterators • Symbols • Reflect • Fat Arrow Functions
  33. 33. (name) => {id: name}
  34. 34. Worst Bad Part in ES6 class
  35. 35. Good Parts Reconsidered • I stopped using new years ago. Use Object.create instead.
  36. 36. Good Parts Reconsidered • I stopped using new years ago. • I have stopped using Object.create.
  37. 37. Good Parts Reconsidered • I stopped using new years ago. • I have stopped using Object.create. • I have stopped using this. [ADsafe.org]
  38. 38. Good Parts Reconsidered • I stopped using new years ago. • I have stopped using Object.create. • I have stopped using this. • I have stopped using null.
  39. 39. Good Parts Reconsidered • I stopped using new years ago. • I have stopped using Object.create. • I have stopped using this. • I have stopped using null. • I have stopped using falsiness.
  40. 40. Loops Reconsidered • I don’t use for. I now use array.forEach and its many sisters. • I don’t use for in. I now use Object.keys(object).forEach. • ES6 will have proper tail calls. At that point I will stop using while.
  41. 41. function repeat(func) { while (func() !== undefined) { } } function repeat(func) { if (func() !== undefined) { return repeat(func); } }
  42. 42. The Next Language
  43. 43. Programmers are as emotional and irrational as normal people.
  44. 44. It took a generation to agree that high level languages were a good idea. It took a generation to agree that goto was a bad idea. It took a generation to agree that objects were a good idea. It took two generations to agree that lambdas were a good idea.
  45. 45. Systems languages Application languages
  46. 46. Classical Inheritance Prototypal Inheritance
  47. 47. Classification Taxonomy
  48. 48. Prototypal Inheritance • Memory conservation. • May have made sense in 1995. • Confusion: Own vs inherited. • Retroactive heredity. • Performance inhibiting.
  49. 49. Prototypal Inheritance Class Free
  50. 50. Block Scope { let a; { let b; … a … … b … } … a … }
  51. 51. Function Scope function green() { let a; function yellow() { let b; … a … … b … } … a … }
  52. 52. Function Scope function green() { let a; function yellow() { let b; … a … … b … } … a … } a
  53. 53. Closure function green() { let a; function yellow() { let b; … a … … b … } … a … } a b
  54. 54. Inner survives the outer function green() { let a; return function yellow() { let b; … a … … b … }; … a … }
  55. 55. function constructor(spec) { let {member} = spec; let {other} = other_constructor(spec); let method = function () { // member, other, method, spec }; return Object.freeze({ method, other }); }
  56. 56. function constructor(spec) { let {member} = spec; const {other} = other_constructor(spec); let method = function () { // member, other, method, spec }; return Object.freeze({ method, other }); }
  57. 57. function constructor(spec) { let {member} = spec; const {other} = other_constructor(spec); const method = function () { // member, other, method, spec }; return Object.freeze({ method, other }); }
  58. 58. function constructor(spec) { let {member} = spec; const {other} = other_constructor(spec); const method = function () { // member, other, method, spec }; return Object.freeze({ method, other }); }
  59. 59. A Bug Story private int index;
  60. 60. int • Overflow errors • Complement: saving gates in subtraction • Memory used to be really expensive and scarce
  61. 61. Number types Java: byte char short int long float double Wastes the programmer’s time by having to select the right type. Errors result from choosing the wrong type. No real benefit from chosing the right type. JavaScript: number (same as double) Having only one type is a huge improvement. Unfortunately, it is the wrong type.
  62. 62. Number types Java: byte char short int long float double Wastes the programmer’s time by having to select the right type. Errors result from choosing the wrong type. No real benefit. JavaScript: number (same as double) Having only one type is a huge improvement. Unfortunately, it is the wrong type.
  63. 63. 0.1 + 0.2 == 0.3 false
  64. 64. Binary Floating Point Made a lot of sense in the 1950s. Scientific | Business
  65. 65. DEC64 Number = Coefficient * 10Exponent CoefficientCoefficient Exponent
  66. 66. dec64.com https://github.com/douglascrockford/DEC64/ CoefficientCoefficient Exponent
  67. 67. The JSON Data Interchange Format
  68. 68. JSON, XML
  69. 69. JSON, XML
  70. 70. Advice to data format standard designers • Don’t break JSON. • Make it significantly better. • Get a better name.
  71. 71. JSON Java- Script Object Notation
  72. 72. Responsibility 1. The People 2. The Team 3. Management
  73. 73. And finally, one piece of advice: Don’t make bugs.
  • MuhammadRiansyah8

    Dec. 26, 2020
  • winstonmhango

    Jun. 20, 2020

This talk is about using programming languages more effectively, and using that experience to create and select better programming languages. There are bad practices in software development that are so old and well established that it is difficult to recognize the problems they cause. There will be a review of the new good parts in ES6. JSON will also be mentioned.

Views

Total views

1,360

On Slideshare

0

From embeds

0

Number of embeds

189

Actions

Downloads

0

Shares

0

Comments

0

Likes

2

×