doc/cutting-room-floor.tex: Add a diagram of Smalltalk's object braid.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 7 Jun 2020 23:51:05 +0000 (00:51 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 7 Jun 2020 23:51:05 +0000 (00:51 +0100)
doc/cutting-room-floor.tex

index 5590f45..a60486f 100644 (file)
@@ -481,6 +481,60 @@ Let's not.
 %% things to talk about:
 %% Liskov substitution principle and why it's mad
 
+\begin{figure}
+  \centering
+  \begin{tikzpicture}
+      [rounded corners=4mm, x=6mm, y=-15mm, align=center]
+    \node[lit] (obj)    at (0, 0) {Object};
+    \node[lit] (objcls) at (6, 0) {Object class};
+    \node[lit] (bhv)    at (0, 1) {Behavior};
+    \node[lit] (bhvcls) at (6, 1) {Behavior class};
+    \node[lit] (cld)    at (0, 2) {ClassDescription};
+    \node[lit] (cldcls) at (6, 2) {ClassDescription class};
+    \node[lit] (cls)    at (-3, 3) {Class};
+    \node[lit] (clscls) at (1, 3) {Class \\ class};
+    \node[lit] (mtc)    at (5, 3) {Metaclass};
+    \node[lit] (mtccls) at (9, 3) {Metaclass class};
+
+    \coordinate (t) at ($ (obj.north) + (0mm, 5mm) $);
+    \coordinate (b) at ($ (mtc.south) - (0mm, 8mm) $);
+    \coordinate (l) at ($ (cls.west) - (5mm, 0mm) $);
+    \coordinate (r) at ($ (mtccls.east) + (5mm, 0mm) $);
+
+    \foreach \n/\p in {bhv/obj, cld/bhv, cls/cld, mtc/cld}
+      { \draw[->] (\n) to (\p); \draw[->] (\n cls) to (\p cls); }
+    \draw[->] (objcls)
+      -- (t -| objcls.center)
+      -- (t -| l)
+      -- (cls.center -| l)
+      -- (cls);
+
+    \foreach \n in {obj, bhv, cld, cls}
+      \draw[->, dashed] (\n) to (\n cls);
+    \foreach \n/\c in {mtc/mtccls, mtccls/mtc}
+      \draw[->, dashed] (\n) to[bend right] (\c);
+    \draw[->, dashed] (clscls) -- (mtc);
+    \draw[->, dashed] (objcls)
+      -- (objcls.center -| r)
+      -- (b -| r)
+      -- (b -| mtc.center)
+      -- (mtc);
+    \foreach \c in {bhv, cld}
+      \draw[dashed] (\c cls) -- (\c cls.center -| r) -- +(0mm, -5mm);
+  \end{tikzpicture}
+
+  \bigskip
+
+  \hbox to\hsize{\hss
+  \fbox{\ \begin{tikzpicture}
+    \node (subclass) {subclass of};
+    \node (instance) [below=\jot of subclass] {instance of};
+    \draw [->] ($(subclass.west) - (10mm, 0)$) -- ++(8mm, 0);
+    \draw [->, dashed] ($(instance.west) - (10mm, 0)$) -- ++(8mm, 0);
+  \end{tikzpicture}}}
+  \caption{The Smalltalk braid}
+\end{figure}
+
 %%%----- That's all, folks --------------------------------------------------
 
 %%% Local variables: