git ssb

0+

dinoworm 🐛 / campjs-viii-ludditejs



Commit cc739adf29428df8628ea59c7c691605e3a9ae71

checkpoint

Michael Williams committed on 8/5/2017, 9:01:00 AM
Parent: a30dc6bf64d6ab714be21520a8f4da3c9103353f

Files changed

README.mdchanged
index.htmlchanged
package.jsonchanged
README.mdView
@@ -38,13 +38,49 @@
3838
3939 ???
4040
4141 - second time presenting at a conference.
42 +- i want to share what i am passionate about
43 + - i might say negative things about some JavaScript patterns, but i use those patterns too
44 + - i don't want to yuck your yum
4245 - i'll try to be upfront and honest, apologies in advance if i disguise any opinions as facts
43-- i might say negative things about some JavaScript patterns, but i use those patterns too
4446 - in general everyone in the JavaScript community is doing a wonderful job, i appreciate your work
4547
4648 ---
49 +class: center, info
50 +
51 +## shout-out
52 +
53 +???
54 +
55 +- when i was writing this talk a few days ago, covered in Imposter Syndrome, i realized...
56 + - someone inspired my passion behind this talk without me realizing
57 +
58 +---
59 +class: info
60 +
61 +### Douglas Engelbart
62 +
63 +augment human intellect
64 +
65 +<img src="./engelbart.jpg" height="350" class="center" />
66 +
67 +???
68 +
69 +- i take the Douglas Engelbart approach to developer experience
70 +- you may have heard of the Mother of all Demos, if not i highly recommend you check it out
71 +- he intended to boost collective intelligence to solve urgent global problems
72 +- Englebart's vision was that the power of technology came with inherent complexity
73 +- so priority is not ease of use but powerful human computer expression
74 +- let's evolve our JavaScript together to solve urgent global problems
75 +
76 +references:
77 +
78 +- https://alistapart.com/column/douglas-engelbart
79 +- http://www.dougengelbart.org/pubs/augment-3906.html
80 +- http://99percentinvisible.org/episode/of-mice-and-men/
81 +
82 +---
4783 class: center
4884
4985 ### let's adventure
5086
@@ -63,9 +99,9 @@
6399 class: info
64100
65101 ## Luddite?
66102
67-the [Luddites](https://en.wikipedia.org/wiki/Luddite) was a political movement against _automated centralized technology_.
103 +the [Luddites](https://en.wikipedia.org/wiki/Luddite) was a political movement against _centralized automated technology_.
68104
69105 <img src="./luddite.jpg" height='300' class="center" />
70106
71107 ???
@@ -80,9 +116,9 @@
80116 class: info
81117
82118 ## luddite.js?
83119
84-**luddite.js** is a (made-up) meme for _simple decentralized JavaScript_.
120 +**luddite.js** is a (made-up) meme for _decentralized simple JavaScript_.
85121
86122 - decentralized userland ecosystems
87123 - simple patterns based on function signatures
88124
@@ -126,15 +162,15 @@
126162 ```
127163
128164 ???
129165
166 +- a standard is one opinion, shared my many
130167 - tc39 is a great team advancing the state of the art in JavaScript,
131- - but the standards produced by tc39 are only one of _many_ possible JavaScript standards.
168 + - but the standards produced by tc39 are only one of _many_ possible JavaScript opinions
169 +- we all have the power to create our own JavaScript opinions
170 + - no experience necessary!
132171 - what other standards can you think of?
133- - JS syntax: babel plugins
134- - front-end: react
135- - back-end: express
136- - anything "best practice"
172 + - anything "best practice", maybe even within a small niche community
137173
138174 ---
139175 class: info
140176
@@ -249,16 +285,12 @@
249285
250286 ???
251287
252288 - why new syntax?
253- - there's myths that es modules do something new
254- - something about "tree shaking"
255- - anything possible with es modules is possible without
256- - common shake
257- - who knew developers were so superstitious
289 + - there's myths that es modules make possible something new
258290 - what is happening here?
259- - confusing to beginners who don't understand the special syntax and complex implementation details
260-- breaks CommonJS code with default
291 + - i find this can be confusing for beginners who don't understand the special syntax and complex implementation details
292 +- in the wild, export default breaks CommonJS code
261293 - yes, i'm bitter about this, i've lost many hours debugging broken code, only to realize the module author published a patch version that broke the CommonJS exports
262294
263295 ---
264296 class: success
@@ -301,20 +333,22 @@
301333
302334 ```js
303335 import React from 'react'
304336
305-export default Table
306-
307-function Table ({ table }) {
308- return <table className='table'>
309- {table.map(row => {
310- <tr className='row'>
311- {row.map(item => {
312- <td className='item'>{item}</td>
313- })
314- </tr>
315- })
316- </table>
337 +export default function ({ rows }) {
338 + return (
339 + <Table>
340 + {rows.map(row =>
341 + <Row>
342 + {row.map(item =>
343 + <Item>
344 + {item}
345 + </Item>
346 + )}
347 + </Row>
348 + )}
349 + </Table>
350 + )
317351 }
318352 ```
319353
320354 ???
@@ -324,8 +358,21 @@
324358 - hides that React is actually `React.createElement` function calls
325359 - "why can't i use `if () { first } else { second }`?
326360 - can only use expressions, not statements
327361
362 +```js
363 +function Table ({ children }) {
364 + return <table className='table'>{children}</table>
365 +}
366 +
367 +function Row ({ children }) {
368 + return <tr className='row'>{children}</tr>
369 +}
370 +
371 +function Item ({ children }) {
372 + return <td className='item'>{children}</td>
373 +})
374 +```
328375 ---
329376 class: success
330377
331378 ### hyperscript
@@ -335,20 +382,42 @@
335382
336383 module.exports = Table
337384
338385 function Table ({ rows ) {
339- return h('table.table', rows.map(row => {
340- h('tr.row', row.map(item => {
341- h('td.item', item)
386 + return h('table', {
387 + className: 'table'
388 + }, rows.map(row => {
389 + h('tr', {
390 + className: 'row'
391 + }, row.map(item => {
392 + h('td', {
393 + className: 'item'
394 + }, Item(item))
342395 })
343396 })
344397 }
398 +
345399 ```
346400
347401 ???
348402
349-- `React.createElement` is basically a strict hyperscript without the class/id sugar
403 +- `React.createElement` is basically a strict hyperscript
404 +- syntax can be confusing at first
350405
406 +```js
407 +function Table ({ children }) {
408 + return <table className='table'>{children}</table>
409 +}
410 +
411 +function Row ({ children }) {
412 + return <tr className='row'>{children}</tr>
413 +}
414 +
415 +function Item ({ children }) {
416 + return <td className='item'>{children}</td>
417 +})
418 +```
419 +
351420 ---
352421 class: success
353422
354423 ### hyperx
@@ -421,16 +490,23 @@
421490
422491 a "continuable" is a function that takes a single argument, a node-style error-first callback
423492
424493 ```js
425-const continuable = (cb) => {
494 +const continuable = (callback) => {
426495 // do stuff...
427- cb(null, data)
496 + callback(null, value)
428497 // oh no!
429- cb(error)
498 + callback(error)
430499 }
431500 ```
432501
502 +```js
503 +continuable((err, value) => {
504 + if (err) console.error(err)
505 + else console.log(value)
506 +})
507 +```
508 +
433509 ???
434510
435511 a continuable is the callback version of a promise
436512
@@ -446,10 +522,10 @@
446522
447523 module.exports = fetchCats
448524
449525 function fetchCats ({ cats }) {
450- return cb => parallel(cats.map(cat => {
451- return request(cat, cb)
526 + return callback => parallel(cats.map(cat => {
527 + return request(cat, callback)
452528 }))
453529 })
454530 ```
455531
@@ -459,10 +535,10 @@
459535 ### async errors
460536
461537 with a node-style error-first callback, there are three possible signals:
462538
463-1. value: `cb(null, value)`
464-2. user error: `cb(error)`
539 +1. value: `callback(null, value)`
540 +2. user error: `callback(error)`
465541 3. programmer error: `throw error`
466542
467543 ???
468544
@@ -506,8 +582,17 @@
506582 - [`push-stream`](https://github.com/ahdinosaur/push-stream)
507583 - [`mutant`](https://github.com/mmckegg/mutant)
508584
509585 ---
586 +class: success
587 +
588 +```js
589 +TODO add mutant html example
590 +```
591 +
592 +???
593 +
594 +---
510595 class: center, info
511596
512597 ## values over time
513598
@@ -541,9 +626,9 @@
541626
542627 async streams using only functions!
543628
544629 ```js
545-pull(source(), through(), sink())
630 +pull(source, through, sink)
546631 ```
547632
548633 - composable partial pipelines
549634 - unbuffered by default
@@ -562,23 +647,27 @@
562647
563648 ---
564649 class: success
565650
566-##### source usage
651 +#### source spec
567652
568653 ```js
569-const source = values([0, 1, 2, 3])
570-
571-source(null, (err, value) {
572- console.log('first value:', value)
573-})
574-// first value: 0
654 +function createSource (...args) {
655 + // a source function accepts
656 + // - abort: a boolean whether to signal end
657 + // - callback: where to send next signal
658 + return source (abort, callback) => {
659 + if (abort || done) callback(true)
660 + else callback(null, value)
661 + }
662 +}
575663 ```
576664
577----
578-class: success
665 +???
579666
580-##### source example
667 +- look ma, just functions!
668 +- yes, we are using callbacks even for synchronous results
669 + - much faster this way, no reason to delay til next tick
581670
582671 ```js
583672 function values (array) {
584673 var i = 0
@@ -586,96 +675,139 @@
586675 if (abort || i === array.length) {
587676 callback(true)
588677 }
589678 else {
590- cb(null, array[i++]
679 + callback(null, array[i++]
591680 }
592681 }
593682 }
594683 ```
595684
596-???
597-
598-- look ma, just functions!
599-- yes, we are using callbacks even for synchronous results
600- - much faster this way, no reason to delay til next tick
601-
602685 ---
603686 class: success
604687
605-#### sink usage
688 +#### source usage
606689
607690 ```js
691 +const values = require('pull-stream/sources/values')
692 +
608693 const source = values([0, 1, 2, 3])
609694
610-log(source)
611-// 0
612-// 1
613-// 2
614-// 3
695 +source(null, (err, value) {
696 + console.log('first value:', value)
697 +})
698 +// first value: 0
615699 ```
616700
617701 ---
618702 class: success
619703
620-#### sink example
704 +#### sink spec
621705
622706 ```js
623-function log (read) {
624- read(null, function next (err, data) {
707 +function createSink (...args) {
708 + // a sink function accepts a source
709 + return (source) => {
710 + // reads a value from the source
711 + source(null, function next (err, value) {
712 + // handle the result
713 + if (err) return handleError(err)
714 + handleValue(value)
715 +
716 + // recursively call source again!
717 + source(null, next)
718 + })
719 + }
720 +}
721 +```
722 +
723 +???
724 +
725 +- `handleError` might abort the source and call a done callback passed in through the args
726 +- `handleValue` might do something with each value
727 +
728 +
729 +```js
730 +function log (source) {
731 + source(null, function next (err, data) {
625732 if (err) return console.log(err)
626733 console.log(data)
627- // recursively call read again!
628- read(null, next)
734 + // recursively call source again!
735 + source(null, next)
629736 })
630737 }
631738 ```
632739
633-???
634-
635740 with continuables:
636741
637742 ```js
638-function log (read) {
639- return (cb) => {
640- read(null, function next (err, data) {
641- if (err) return cb(err)
743 +function log (source) {
744 + return (callback) => {
745 + source(null, function next (err, data) {
746 + if (err) return callback(err)
642747 console.log(data)
643- // recursively call read again!
644- read(null, next)
748 + // recursively call source again!
749 + source(null, next)
645750 })
646751 }
647752 }
648753 ```
649754
650755 ---
651756 class: success
652757
653-#### through usage
758 +#### sink usage
654759
655760 ```js
761 +const values = require('pull-stream/sources/values')
762 +const drain = require('pull-stream/sinks/drain')
763 +
656764 const source = values([0, 1, 2, 3])
657-const double = map(x => x * 2)
765 +const log = drain(console.log)
658766
659-log(double(source))
767 +log(source)
768 +// 0
769 +// 1
770 +// 2
771 +// 3
660772 ```
661773
662774 ---
663775 class: success
664776
665-#### through example
777 +#### through spec
666778
667779 ```js
780 +function createThrough (...args) {
781 + // a sink function: accept a source
782 + return (source) => {
783 + // but return another source!
784 + return (abort, callback) {
785 + // if the through should abort, pass that on.
786 + source(abort, (err, value) => {
787 + // if the source has an error, pass that on.
788 + if (err) callback(err)
789 + // else transform the value
790 + else callback(null, transformValue(value))
791 + })
792 + }
793 + }
794 +}
795 +```
796 +
797 +???
798 +
799 +```js
668800 function map (mapper) {
669801 // a sink function: accept a source
670- return function (read) {
802 + return function (source) {
671803 // but return another source!
672- return function (abort, cb) {
673- read(abort, function (err, data) {
804 + return function (abort, callback) {
805 + source(abort, function (err, data) {
674806 // if the stream has ended, pass that on.
675- if (err) cb(err)
807 + if (err) callback(err)
676808 // apply a mapping to that data
677- else cb(null, mapper(data))
809 + else callback(null, mapper(data))
678810 })
679811 }
680812 }
681813 }
@@ -683,13 +815,47 @@
683815
684816 ---
685817 class: success
686818
819 +#### through usage
820 +
821 +```js
822 +const values = require('pull-stream/sources/values')
823 +const drain = require('pull-stream/sinks/drain')
824 +const map = require('pull-stream/throughs/map')
825 +
826 +const source = values([0, 1, 2, 3])
827 +const log = drain(console.log)
828 +const double = map(x => x * 2)
829 +
830 +log(double(source))
831 +// 0
832 +// 2
833 +// 4
834 +// 6
835 +```
836 +
837 +---
838 +class: success
839 +
840 +#### compose pull streams
841 +
842 +```js
843 +pull(source, through) // returns source
844 +
845 +pull(through, sink) // returns sink
846 +
847 +pull(source, sink) // runs to end
848 +```
849 +
850 +---
851 +class: success
852 +
687853 #### wild pull streams
688854
689855 ecosystem of modules: [pull-stream.github.io](https://pull-stream.github.io)
690856
691-```
857 +```js
692858 // parse a csv file
693859 pull(
694860 File(filename),
695861 CSV(),
@@ -716,12 +882,12 @@
716882 #### pull stream errors
717883
718884 with a pull stream source callback, there are four possible signals:
719885
720-1. value: `cb(null, value)`
721-2. user error: `cb(error)`
886 +1. value: `callback(null, value)`
887 +2. user error: `callback(error)`
722888 3. programmer error: `throw error`
723-4. complete: `cb(true)`
889 +4. complete: `callback(true)`
724890
725891 ???
726892
727893 - both the source and sink can signal back-pressure ("hey i'm busy") by not calling the respective callback
@@ -752,67 +918,31 @@
752918
753919 ???
754920
755921 - clear inputs and outputs
756-- no hidden state to manage
922 +- small code blocks (or "snippets") can be deceiving
923 + - leads to a positive first impression, until you use in production where the edge cases leak through the abstractions
924 + - i find nothing more difficult than edge cases at scale caused by hiding complexity in our tools
757925
758926 ---
759927 class: success
760928
761-### easier to understand
929 +### path to mastery
762930
763-less "snippet-driven development"
764-
765-more learnable tools focused on power users
766-
767-???
768-
769-- is probably a contentious opinion:
770- - yes promises are more "intuitive" than callbacks, a beginner can start using with less learning, training, or practice
771-
772- His system, called NLS, showed actual instances of, or precursors to, hypertext, shared screen collaboration, multiple windows, on-screen video teleconferencing, and the mouse as an input device.
773-
774- He intended to boost collective intelligence and enable knowledge workers to think in powerful new ways, to collectively solve urgent global problems.
775-
776-> The pendulum has swung about as far as it can toward the consumerization of computing technology, in which everything should be immediately intuitive and nothing should require learning, training, or practice. Engelbart’s vision was on the opposite end of that pendulum swing—he believed that the power of these tools came with inherent complexity.
777-
778----
779-class: info
780-
781-#### augment human intellect
782-
783931 learnable tools focused on power users
784932
785-<img src="./engelbart.jpg" height="350" class="center" />
933 +<img src="./training-wheels.jpg" height="350" class="center" />
786934
787935 ???
788936
789-- i take the Douglas Engelbart approach to developer experience
790- - technology should augment human intellect, which means it should be a learnable tool focused on power users
791- - priority is not ease of use but powerful human computer expression
937 +- training wheels are great to get started and go around the blockS
938 +- yes promises are easier than callbacks, a beginner can start using with less learning, training, or practice
939 +- but when you want to go up a hill or go a long distance, you want a real bike
940 + - this takes time to learn how to steer and balance on
941 +- how many hours to do we spend writing complex code, is the most intuitive abstraction best suited for our evolving understanding?
942 + - here's one of many possible abstractions, but is not the end answer
792943
793-references:
794-
795-- https://alistapart.com/column/douglas-engelbart
796-- http://www.dougengelbart.org/pubs/augment-3906.html
797-- http://99percentinvisible.org/episode/of-mice-and-men/
798-
799944 ---
800-class: info
801-
802-#### remove the training wheels!
803-
804-<img src="./training-wheels.jpg" height="425" class="center" />
805-
806-
807-???
808-
809-"You don’t need any special training to operate a tricycle, and that’s fine if you’re just going to go around the block. If you’re trying to go up a hill or go a long distance, you want a real bike. The kind with gears and brakes– the kind that takes time to learn how to steer and balance on."
810-
811-how many hours do we spend writing complex code, why should we keep using the training-wheel abstractions best suited for unexperienced newbies?
812-
813-
814----
815945 class: center, info
816946
817947 ## stories
818948
@@ -826,37 +956,14 @@
826956 <img src="./catstack.jpg" height="350" class="center" />
827957
828958 ???
829959
830-reinvent every wheel possible!
960 +reinvent every wheel possible! the entire web stack.
831961
832962 https://github.com/root-systems/catstack
833963
834964 i did it, but it was unsustainable, unable to transfer context to team
835965
836-- ui views
837- - hyps
838- - hyper-fela
839-- ui state
840- - inu-engine
841- - inu
842- - inu-log
843- - inu-router
844-- http handlers
845- - http-compose
846- - http-sender
847- - http-routes
848-- services
849- - vas
850- - vas-http
851-- modules
852- - depject
853- - depnest
854- - depject-priority
855-- framework
856- - module system
857- - command-line tasks
858-
859966 ---
860967 class: warning
861968
862969 ### learning:
@@ -925,17 +1032,23 @@
9251032 class: success, center
9261033
9271034 #### offline social media
9281035
929-<img src="./patchwork-screenshot.jpg" height="500" class="center" />
1036 +<http://patchwork.campjs.com>
9301037
1038 +<img src="./patchwork-screenshot.jpg" height="400" class="center" />
1039 +
9311040 ---
9321041 class: success, center
9331042
9341043 #### git projects
9351044
936-<img src="./git-ssb-screenshot.png" height="450" class="center" />
1045 +```js
1046 +npm install -g git-ssb
1047 +```
9371048
1049 +<img src="./git-ssb-screenshot.png" height="400" class="center" />
1050 +
9381051 ---
9391052 class: success
9401053
9411054 ### learning: mad science works!
@@ -961,9 +1074,9 @@
9611074 ### so what
9621075
9631076 everyone has opinions.
9641077
965-this one is mine. :3
1078 +this one is mine. =^.^=
9661079
9671080 ???
9681081
9691082 as my Mom always says:
index.htmlView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 22902 bytes
New file size: 900334 bytes
package.jsonView
@@ -4,9 +4,9 @@
44 "description": "Luddite.js, or how to write quality JavaScript apps using only functions and objects.",
55 "main": "index.js",
66 "scripts": {
77 "present": "ecstatic .",
8- "build": "markdown-to-slides -t 'Luddite.js' README.md -o index.html -s index.css -j index.js",
8 + "build": "markdown-to-slides -t 'Luddite.js' README.md -o index.html -s index.css -j index.js -i",
99 "watch": "npm run build -- -w",
1010 "livereload": "wtch -d . -e html,css,png,gif,jpg | garnish --level debug",
1111 "static": "ecstatic-lr .",
1212 "start": "npm-run-all -p watch livereload static",

Built with git-ssb-web