Commit 9493efb7168dd6cc9509e00e6d0b5eec8e50002c
practice
Michael Williams committed on 7/31/2017, 4:03:31 AMParent: d6c332a182ee3818f7ba43e380bd7de532155b64
Files changed
NOTES.md | changed |
README.md | changed |
index.html | changed |
package-lock.json | changed |
NOTES.md | ||
---|---|---|
@@ -450,4 +450,27 @@ | ||
450 | 450 … | |
451 | 451 … | ## references |
452 | 452 … | |
453 | 453 … | - [The Post JavaScript Apocalypse - Douglas Crockford](https://www.youtube.com/watch?v=NPB34lDZj3E) |
454 … | + | |
455 … | +--- | |
456 … | + | |
457 … | +like framing | |
458 … | + | |
459 … | +- here's luddite.js | |
460 … | + - we are against centralized committees and decion-making | |
461 … | + - gonna show some examples of the luddite way to do things | |
462 … | +- there's a centralized committee making JavaScript standards | |
463 … | + - it's cool, but it's not the only way | |
464 … | + - here's how some people have been doing things for a while now | |
465 … | + - anyone can make standards | |
466 … | +- here's the committee way to do X | |
467 … | + - here's the luddite way to do X | |
468 … | +- at the end of the day, programming is supposed to be fun and anyone can play around with fun standards if they want. | |
469 … | + | |
470 … | +- if you don't use fancy syntax (jsx, etc), you don't need fancy build steps | |
471 … | + | |
472 … | +- add back es observables vs observ-ables | |
473 … | +- move redux to be a quinteesential example of a function signature standard over fancy syntax or library | |
474 … | + | |
475 … | +- acknowledge that pull streams could be its own talk | |
476 … | + - link to actual talks |
README.md | ||
---|---|---|
@@ -1,9 +1,9 @@ | ||
1 | 1 … | # luddite.js |
2 | 2 … | |
3 | 3 … | --- |
4 | 4 … | |
5 | -## hey [CampJS VIII](http://viii.campjs.com) | |
5 … | +## hey [CampJS](http://campjs.com) | |
6 | 6 … | |
7 | 7 … | i'm [Mikey (@ahdinosaur)](http://dinosaur.is) from [Enspiral](http://enspiral.com) |
8 | 8 … | |
9 | 9 … | <div class="row"> |
@@ -20,9 +20,9 @@ | ||
20 | 20 … | ??? |
21 | 21 … | |
22 | 22 … | second time presenting at a conference. |
23 | 23 … | |
24 | -i'm going to attack some JavaScript patterns, but i use those patterns too. | |
24 … | +i might say negative things about some JavaScript patterns, but i use those patterns too. | |
25 | 25 … | |
26 | 26 … | everyone in the JavaScript community is doing a wonderful job. |
27 | 27 … | |
28 | 28 … | apologies in advance if i disguise any opinions as facts. |
@@ -34,25 +34,19 @@ | ||
34 | 34 … | **luddite.js** is _simple decentralized JavaScript_. |
35 | 35 … | |
36 | 36 … | ??? |
37 | 37 … | |
38 | -a study of JavaScript evolution | |
38 … | +but really a study of functional JavaScript patterns that have evolved in userland | |
39 | 39 … | |
40 | -also totally made up | |
41 | - | |
42 | -JavaScript was good | |
43 | - | |
44 | -now it's popular | |
45 | - | |
46 | -here's the beef | |
47 | - | |
48 | 40 … | --- |
49 | 41 … | |
50 | 42 … | ## Luddite? |
51 | 43 … | |
52 | 44 … | the [Luddites](https://en.wikipedia.org/wiki/Luddite) was a political movement against _automated centralized technology_. |
53 | 45 … | |
54 | -<img src="./luddite.jpeg" /> | |
46 … | +<div style='display: flex; justify-content: center'> | |
47 … | + <img src="./luddite.jpg" height='400' /> | |
48 … | +</div> | |
55 | 49 … | |
56 | 50 … | ??? |
57 | 51 … | |
58 | 52 … | - many Luddites were skilled machine operators in the textile industry |
@@ -62,28 +56,31 @@ | ||
62 | 56 … | --- |
63 | 57 … | |
64 | 58 … | ## but JavaScript? |
65 | 59 … | |
66 | -at the | |
60 … | +i'm going to talk about | |
67 | 61 … | |
68 | -- simple primitives | |
69 | -- decentralized userland | |
62 … | +- simple functional patterns | |
63 … | +- decentralized userland ecosystems | |
70 | 64 … | |
71 | 65 … | ??? |
72 | 66 … | |
67 … | +- less coupling to trendy libraries, more function signature conventions: https://twitter.com/jekrb/status/859242655011745793 | |
73 | 68 … | - top-down standards process |
74 | 69 … | - vs emergent (mad science) bottom-up module ecosystems |
75 | 70 … | - izs pants post |
76 | 71 … | |
77 | -## simple primitives | |
72 … | +--- | |
78 | 73 … | |
74 … | +## simple functional patterns | |
75 … | + | |
79 | 76 … | what if i told you... |
80 | 77 … | |
81 | 78 … | that you only needed plain functions and objects? |
82 | 79 … | |
83 | 80 … | ??? |
84 | 81 … | |
85 | -- no fancy syntax | |
82 … | +- no fancy syntax necessary | |
86 | 83 … | - less language clutter |
87 | 84 … | |
88 | 85 … | ---- |
89 | 86 … | |
@@ -93,19 +90,11 @@ | ||
93 | 90 … | function fn (...args) { return value } |
94 | 91 … | ``` |
95 | 92 … | |
96 | 93 … | ```js |
97 | -const fn = (...args) => { return value } | |
98 | -``` | |
99 | - | |
100 | -```js | |
101 | 94 … | const fn = (...args) => value |
102 | 95 … | ``` |
103 | 96 … | |
104 | -```js | |
105 | -const fn = (...args) => ({ value }) | |
106 | -``` | |
107 | - | |
108 | 97 … | --- |
109 | 98 … | |
110 | 99 … | ## sync function signals |
111 | 100 … | |
@@ -129,17 +118,8 @@ | ||
129 | 118 … | ``` |
130 | 119 … | |
131 | 120 … | --- |
132 | 121 … | |
133 | -## import / export | |
134 | - | |
135 | -```js | |
136 | -import thing from 'module' | |
137 | -import { thing as thingy } from 'module' | |
138 | -``` | |
139 | - | |
140 | ---- | |
141 | - | |
142 | 122 … | ## require / module.exports = |
143 | 123 … | |
144 | 124 … | ```js |
145 | 125 … | const thing = require('module') |
@@ -152,8 +132,17 @@ | ||
152 | 132 … | ``` |
153 | 133 … | |
154 | 134 … | --- |
155 | 135 … | |
136 … | +## vs: import / export | |
137 … | + | |
138 … | +```js | |
139 … | +import thing from 'module' | |
140 … | +import { thing as thingy } from 'module' | |
141 … | +``` | |
142 … | + | |
143 … | +--- | |
144 … | + | |
156 | 145 … | ## hyperscript |
157 | 146 … | |
158 | 147 … | ```js |
159 | 148 … | const h = require('react-hyperscript') |
@@ -168,8 +157,12 @@ | ||
168 | 157 … | }) |
169 | 158 … | } |
170 | 159 … | ``` |
171 | 160 … | |
161 … | +??? | |
162 … | + | |
163 … | +- `React.createElement` is basically a strict hyperscript without the class/id sugar | |
164 … | + | |
172 | 165 … | --- |
173 | 166 … | |
174 | 167 … | ## vs: hyperx |
175 | 168 … | |
@@ -194,9 +187,8 @@ | ||
194 | 187 … | </table>` |
195 | 188 … | } |
196 | 189 … | ``` |
197 | 190 … | |
198 | - | |
199 | 191 … | --- |
200 | 192 … | |
201 | 193 … | ## vs: jsx |
202 | 194 … | |
@@ -217,8 +209,26 @@ | ||
217 | 209 … | ``` |
218 | 210 … | |
219 | 211 … | --- |
220 | 212 … | |
213 … | +## redux | |
214 … | + | |
215 … | +reducer: | |
216 … | + | |
217 … | +```js | |
218 … | +(state, action) => nextState | |
219 … | +``` | |
220 … | + | |
221 … | +--- | |
222 … | + | |
223 … | +??? | |
224 … | + | |
225 … | +- actions | |
226 … | +- reducers | |
227 … | +- global state tree | |
228 … | + | |
229 … | +--- | |
230 … | + | |
221 | 231 … | ## async function |
222 | 232 … | |
223 | 233 … | ```js |
224 | 234 … | const request = require('request') |
@@ -236,13 +246,10 @@ | ||
236 | 246 … | --- |
237 | 247 … | |
238 | 248 … | ## promise |
239 | 249 … | |
240 | -a "promise" is an eventual values | |
250 … | +a "promise" is an eventual value | |
241 | 251 … | |
242 | - | |
243 | -a "continuable" is a function that takes a single argument, a node-style (error-1st) callback. | |
244 | - | |
245 | 252 … | ```js |
246 | 253 … | const promise = new Promise((resolve, reject) => { |
247 | 254 … | // do stuff... |
248 | 255 … | resolve(value) |
@@ -303,57 +310,122 @@ | ||
303 | 310 … | ## async errors |
304 | 311 … | |
305 | 312 … | with a error-first callback, there are three possible signals: |
306 | 313 … | |
307 | -1. programmer error: `throw error` | |
308 | -2. value: `cb(null, value)` | |
309 | -3. user error: `cb(error)` | |
314 … | +1. value: `cb(null, value)` | |
315 … | +2. user error: `cb(error)` | |
316 … | +3. programmer error: `throw error` | |
310 | 317 … | |
311 | 318 … | ??? |
312 | 319 … | |
313 | 320 … | promise errors smush the user and programmer errors together |
314 | 321 … | |
315 | 322 … | --- |
316 | 323 … | |
317 | -## redux | |
324 … | +## pull stream | |
318 | 325 … | |
319 | 326 … | ??? |
320 | 327 … | |
321 | -- actions | |
322 | -- reducers | |
323 | -- global state tree | |
328 … | +- [history of streams](http://dominictarr.com/post/145135293917/history-of-streams) | |
329 … | +- [pull stream examples](https://github.com/dominictarr/pull-stream-examples) | |
330 … | +- [pull streams intro](http://dominictarr.com/post/149248845122/pull-streams-pull-streams-are-a-very-simple) | |
331 … | +- [pull stream](https://pull-stream.github.io/) | |
332 … | +- [pull stream workshop](https://github.com/pull-stream/pull-stream-workshop) | |
324 | 333 … | |
325 | 334 … | --- |
326 | 335 … | |
327 | -## pull stream | |
336 … | +### source | |
328 | 337 … | |
338 … | +```js | |
339 … | +function values (array) { | |
340 … | + var i = 0 | |
341 … | + function read (abort, callback) { | |
342 … | + if (abort || i === array.length) cb(true) | |
343 … | + else cb(null, array[i++] | |
344 … | + } | |
345 … | +} | |
346 … | +``` | |
347 … | + | |
348 … | +??? | |
349 … | + | |
350 … | +- look ma, just functions! | |
351 … | + | |
329 | 352 … | --- |
330 | 353 … | |
331 | -### source | |
354 … | +### sink | |
332 | 355 … | |
333 | 356 … | ```js |
357 … | +function log (read) { | |
358 … | + read(null, function next (err, data) { | |
359 … | + if (err) return console.log(err) | |
360 … | + console.log(data) | |
361 … | + // recursively call read again! | |
362 … | + read(null, next) | |
363 … | + }) | |
364 … | +} | |
365 … | +``` | |
334 | 366 … | |
367 … | +--- | |
368 … | + | |
369 … | +### through | |
370 … | + | |
371 … | +```js | |
372 … | +function map (mapper) { | |
373 … | + // a sink function: accept a source | |
374 … | + return function (read) { | |
375 … | + // but return another source! | |
376 … | + return function (abort, cb) { | |
377 … | + read(abort, function (err, data) { | |
378 … | + // if the stream has ended, pass that on. | |
379 … | + if (err) cb(err) | |
380 … | + // apply a mapping to that data | |
381 … | + else cb(null, mapper(data)) | |
382 … | + }) | |
383 … | + } | |
384 … | + } | |
385 … | +} | |
335 | 386 … | ``` |
336 | 387 … | |
337 | 388 … | --- |
338 | 389 … | |
339 | 390 … | ## pull stream errors |
340 | 391 … | |
341 | -with a pull stream callback, there are four possible signals: | |
392 … | +with a pull stream source callback, there are four possible signals: | |
342 | 393 … | |
343 | -1. programmer error: `throw error` | |
344 | -2. value: `cb(null, value)` | |
345 | -3. user error: `cb(error)` | |
394 … | +1. value: `cb(null, value)` | |
395 … | +2. user error: `cb(error)` | |
396 … | +3. programmer error: `throw error` | |
346 | 397 … | 4. complete: `cb(true)` |
347 | 398 … | |
399 … | +??? | |
348 | 400 … | |
401 … | +- both the source and sink can signal back-pressure ("hey i'm busy") by not calling the respective callback | |
402 … | + | |
349 | 403 … | --- |
350 | 404 … | |
351 | 405 … | ## stories |
352 | 406 … | |
353 | 407 … | --- |
354 | 408 … | |
355 | 409 … | ### catstack |
356 | 410 … | |
411 … | +build a framework alone from scratch | |
412 … | + | |
413 … | +learnings: | |
414 … | + | |
415 … | +- choose your battles | |
416 … | +- one person team is anti-pattern | |
417 … | + | |
418 … | +??? | |
419 … | + | |
420 … | +reinvent all the wheels! | |
421 … | + | |
357 | 422 … | --- |
358 | 423 … | |
359 | -### patch\* | |
424 … | +### patch ecosystem | |
425 … | + | |
426 … | +build an app with others, bring-your-own framework modules | |
427 … | + | |
428 … | +learnings: | |
429 … | + | |
430 … | +- do what you think #SomebodyShould do | |
431 … | +- collaborate with active listening and empathy |
index.html | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 882726 bytes New file size: 884348 bytes |
Built with git-ssb-web