Skip to content

Commit 1b13c05

Browse files
committed
some toc-building, flesh out chapter 5 toc
1 parent c4786ce commit 1b13c05

File tree

3 files changed

+113
-11
lines changed

3 files changed

+113
-11
lines changed

chapters/ch05.asciidoc

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,93 @@
1-
5 Modular Patterns and Practices
1+
[[modular-patterns-and-practices]]
2+
== Modular Patterns and Practices
3+
4+
..
5+
6+
=== 5.1 Leveraging Modern JavaScript
7+
28
# discuss role of latest language features, spread, how they can make code more maintainable, async/await, promises, etc
3-
5.1 Revealing Module
4-
5.2 Object Factory
5-
5.3 Composition Over Inheritance
6-
5.4 Events
7-
5.5 Conventions
89

9-
# Mapping, Filtering, Sorting, and Reducing Data?
10+
==== 5.1.1 Destructuring, Rest, Spread, and Template Literals
11+
12+
.. how each of these features helps us keep code simpler, or how to simplify existing code using them.
13+
14+
==== 5.1.2 Striving for simple `const` bindings
15+
16+
.. thinking about how `let` and `var` may mean we're doing complicated things, and how striving to avoid those bindings almost always leads to better/simpler code.
17+
18+
==== 5.1.3 Asynchronous Functions and Promises
19+
20+
.. why converting flows to promises may be a good way of simplifying it, on the basis that a lot of the language now is built around support for promises
21+
22+
=== 5.2 Composition and Inheritance
23+
24+
..
25+
26+
==== 5.2.1 Aspects and Decorators
27+
28+
how we can decorate components either via composition or decorators to add features to them, and reuse that logic for other kinds of components..
29+
30+
==== 5.2.2 The Perks of Inheritance
31+
32+
.. how inheritance can be useful when there's an abstract interface to implement and methods to override, thinking of React's Component in terms of `render()` being an abstract method to be implemented and pretty much every other method being a virtual method [in C# terms], explains benefits of these kinds of contracts. maybe hint at 5.5.2 protocols
33+
34+
==== 5.2.3 Choosing between Composition and Inheritance
35+
36+
in real apps you'll seldom have to use inheritance except when connecting to specific frameworks you depend on, or for specific patterns, everywhere else probably use composition [ellaborate on that]
37+
38+
==== 5.3 Code Patterns
39+
40+
..
41+
42+
==== 5.3.1 Revealing Module
43+
44+
.. this one is sort-of obvious but explain how hiding most of a class in a function can help avoid unwarranted access
45+
46+
==== 5.3.2 Object Factories
47+
48+
.. and how they're great for keeping state contained to the instance
49+
50+
==== 5.3.3 Event Emission
51+
52+
.. events for things that we want to have clearly-delineated side-effects.
53+
54+
==== 5.3.4 Message Passing
55+
56+
.. situations like SW, normal workers, extensions, frames.
57+
58+
=== 5.4 Data manipulation use cases
59+
60+
.. tips and tricks to consider when working with data. not isolated methods but instead use cases.
61+
.. Mapping data
62+
Filtering through data
63+
When should we `Array#reduce`?
64+
65+
==== 5.4.1 Filtering and mapping data
66+
67+
.. chat about filtering and mapping, how iterators can help create a pipeline, but how tools like `lodash` also do this when we use the wrapper style, and how this shouldn't be a topmost concern of ours
68+
69+
==== 5.4.2 Reducing lists into as hash-maps
70+
71+
.. (and other use cases for reduce)
72+
73+
==== 5.4.3 The caveats of `Array#reduce`
74+
75+
.. it's not used often, but when it's used, it's quite often for the wrong reasons. explain why it can be very complex to understand if the use case isn't correct
76+
77+
=== 5.5 Conventions and Protocols
78+
79+
..
80+
81+
==== 5.5.1 Enforcing User-Defined Contracts
82+
83+
.. coming up with own conventions, what/why and how to enforce it. probably talk of Symbol
84+
85+
==== 5.5.2 JavaScript Protocols
86+
87+
[aka interface]
88+
89+
.. the proposal: https://github.com/michaelficarra/proposal-first-class-protocols
90+
91+
==== 5.5.3 Conventions at a Large Scale
92+
93+
.. talk about conventions such as MVC, React's view rendering mechanism, or other large-scale conventions we adopt and seldom think about etc

chapters/ch06.asciidoc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
[[secure-isolated-and-scalable]]
2+
== Secure, Isolated, and Scalable
13

2-
6 Secure, Isolated, and Scalable
34
# chapter around basically 12factor but repurposed for modules
4-
6.1 ..
5+
6+
=== 6.1
7+
8+
..
9+
10+
==== 6.1.1
11+
12+
..

chapters/ch07.asciidoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
[[managing-complexity-across-modules]]
2+
== Managing Complexity Across Modules
13

2-
7 Managing Complexity Across Modules
34
# chapter around ways of reducing complexity across whole module system
4-
7.1 ..
5+
56
# complexity of change across layers/time, drop mention of How Buildings Learn
7+
68
# managing local state (as an instance factory) vs globally (e.g mongoose.currentConnection)
9+
10+
=== 7.1
11+
12+
..
13+
14+
==== 7.1.1
15+
16+
..

0 commit comments

Comments
 (0)