Permalink
Browse files

Added discussion of book plan and justification for focus on monadic …

…design patterns.
  • Loading branch information...
1 parent 11948ec commit b69c1df176cf353aa9b0e9205c8484c86e19659e Meredith Gregory committed Feb 23, 2010
@@ -1,6 +1,6 @@
\relax
\@setckpt{bibliography/monadic}{
-\setcounter{page}{40}
+\setcounter{page}{42}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,12 +1,12 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {8}Domain model, storage and state}{35}{chapter.8}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {8}Domain model, storage and state}{37}{chapter.8}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {8.1}Mapping our domain model to storage}{35}{section.8.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {8.2}Storage and language-integrated query}{35}{section.8.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {8.3}Continuations revisited}{35}{section.8.3}}
+\@writefile{toc}{\contentsline {section}{\numberline {8.1}Mapping our domain model to storage}{37}{section.8.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {8.2}Storage and language-integrated query}{37}{section.8.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {8.3}Continuations revisited}{37}{section.8.3}}
\@setckpt{chapters/eight/ch}{
-\setcounter{page}{36}
+\setcounter{page}{38}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,12 +1,12 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {5}The domain model as abstract syntax}{29}{chapter.5}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {5}The domain model as abstract syntax}{31}{chapter.5}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {5.1}Our abstract syntax}{29}{section.5.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {5.2}Our application domain model}{29}{section.5.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {5.3}A transform pipeline}{29}{section.5.3}}
+\@writefile{toc}{\contentsline {section}{\numberline {5.1}Our abstract syntax}{31}{section.5.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {5.2}Our application domain model}{31}{section.5.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {5.3}A transform pipeline}{31}{section.5.3}}
\@setckpt{chapters/five/ch}{
-\setcounter{page}{30}
+\setcounter{page}{32}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,12 +1,12 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {4}Parsing requests, monadically}{27}{chapter.4}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {4}Parsing requests, monadically}{29}{chapter.4}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {4.1}Obligatory parsing monad}{27}{section.4.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {4.2}Your parser combinators are showing}{27}{section.4.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {4.3}EBNF and why higher levels of abstraction are better}{27}{section.4.3}}
+\@writefile{toc}{\contentsline {section}{\numberline {4.1}Obligatory parsing monad}{29}{section.4.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {4.2}Your parser combinators are showing}{29}{section.4.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {4.3}EBNF and why higher levels of abstraction are better}{29}{section.4.3}}
\@setckpt{chapters/four/ch}{
-\setcounter{page}{28}
+\setcounter{page}{30}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,13 +1,13 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {9}Putting it all together}{37}{chapter.9}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {9}Putting it all together}{39}{chapter.9}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {9.1}Our web application end-to-end}{37}{section.9.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {9.2}Deploying our application}{37}{section.9.2}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {9.2.1}Why we are not deploying on GAE}{37}{subsection.9.2.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {9.3}From one web application to web framework}{37}{section.9.3}}
+\@writefile{toc}{\contentsline {section}{\numberline {9.1}Our web application end-to-end}{39}{section.9.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {9.2}Deploying our application}{39}{section.9.2}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {9.2.1}Why we are not deploying on GAE}{39}{subsection.9.2.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {9.3}From one web application to web framework}{39}{section.9.3}}
\@setckpt{chapters/nine/ch}{
-\setcounter{page}{38}
+\setcounter{page}{40}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -9,21 +9,21 @@
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1.3}Advances in functional programming, monads and the awkward squad}{6}{subsection.1.1.3}}
\@writefile{toc}{\contentsline {section}{\numberline {1.2}Where are we going}{10}{section.1.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2.1}A functional web}{10}{subsection.1.2.1}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.2.2}DSL-based design}{10}{subsection.1.2.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {1.3}How are we going to get there}{11}{section.1.3}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.1}Leading by example}{11}{subsection.1.3.1}}
-\@writefile{toc}{\contentsline {subsubsection}{Our toy language}{12}{section*.7}}
-\@writefile{toc}{\contentsline {paragraph}{Abstract syntax}{12}{section*.8}}
-\@writefile{toc}{\contentsline {paragraph}{A simple-minded representation}{12}{section*.9}}
-\@writefile{toc}{\contentsline {paragraph}{Type parametrization and quotation}{13}{section*.10}}
-\@writefile{toc}{\contentsline {paragraph}{Some syntactic sugar}{14}{section*.11}}
-\@writefile{toc}{\contentsline {paragraph}{Digression: complexity management principle}{14}{section*.12}}
-\@writefile{toc}{\contentsline {paragraph}{Concrete syntax}{14}{section*.13}}
-\@writefile{toc}{\contentsline {paragraph}{Translating concrete syntax to abstract syntax}{15}{section*.14}}
-\@writefile{toc}{\contentsline {paragraph}{Structural equivalence and Relations or What makes abstract syntax abstract}{15}{section*.15}}
-\@writefile{toc}{\contentsline {paragraph}{Evaluation -- aka operational semantics}{16}{section*.16}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {1.2.2}DSL-based design}{12}{subsection.1.2.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {1.3}How are we going to get there}{13}{section.1.3}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.1}Leading by example}{13}{subsection.1.3.1}}
+\@writefile{toc}{\contentsline {subsubsection}{Our toy language}{13}{section*.7}}
+\@writefile{toc}{\contentsline {paragraph}{Abstract syntax}{13}{section*.8}}
+\@writefile{toc}{\contentsline {paragraph}{A simple-minded representation}{14}{section*.9}}
+\@writefile{toc}{\contentsline {paragraph}{Type parametrization and quotation}{14}{section*.10}}
+\@writefile{toc}{\contentsline {paragraph}{Some syntactic sugar}{15}{section*.11}}
+\@writefile{toc}{\contentsline {paragraph}{Digression: complexity management principle}{16}{section*.12}}
+\@writefile{toc}{\contentsline {paragraph}{Concrete syntax}{16}{section*.13}}
+\@writefile{toc}{\contentsline {paragraph}{Translating concrete syntax to abstract syntax}{17}{section*.14}}
+\@writefile{toc}{\contentsline {paragraph}{Structural equivalence and Relations or What makes abstract syntax abstract}{17}{section*.15}}
+\@writefile{toc}{\contentsline {paragraph}{Evaluation -- aka operational semantics}{18}{section*.16}}
\@setckpt{chapters/one/ch}{
-\setcounter{page}{19}
+\setcounter{page}{21}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -2,13 +2,92 @@ \section{Where are we going}
With a preamble like that it doesn't take much to guess where all this
is heading. More and more we are looking at trends that lead toward
-more functional and functionally-based web applications. The growing
-popularity of frameworks like \texttt{Lift} is really the tip of the
-iceberg.
+more functional and functionally-based web applications. We need not
+look to the growing popularity of cutting-edge frameworks like
+\texttt{Lift} to see this trend. Both Javascript (with it's origins in
+Self) and Rails must be counted amongst the functionally influenced.
\subsection{A functional web}
-TBD
+Because there are already plenty of excellent functional web
+frameworks in the open source community our aim is not to build
+another. Rather our aim is to supply a set of design patterns that
+will work with most -- in fact are already implicitly at work in many
+-- but that when used correctly will reduce complexity.
+
+Specifically, we will look at the organization of the pipeline of a
+web-application from the pipeline of HTTP requests through the
+application logic to the store and back. We will see how in each case
+judicious use of the monadic design pattern provides for significant
+leverage in structuring code, making it both simpler, more
+maintainable and more robust in the face of change.
+
+To that end we will be looking at
+
+\begin{itemize}
+ \item processing HTTP-streams using presence of \emph{delimited}
+ continuations to allow for a sophisticated state management
+ \item parser combinators for parsing HTTP-requests and higher-level
+ application protocols using HTTP as a transport
+ \item application domain model as an abstract syntax
+ \item zippers as a means of automatically generating navigation
+ \item collections and containers in memory
+ \item storage, including a new way to approach query and search
+\end{itemize}
+
+In each case there is an underlying organization to the computation
+that solves the problem. In each case we find an instance of the
+monadic design pattern. Whether this apparent universal applicability
+is an instance of finding a hammer that turns everything it encounters
+into nails or that structuring computation in terms of monads has a
+genuine depth remains to be seen. What can be said even at this early
+stage of the game is that object-oriented design patterns were
+certainly proposed for each of these situations and many others. It
+was commonly held that such techniques were not merely universally
+applicable, but of genuine utility in every domain of application. The
+failure of object-oriented design methods to make good on these claims
+might be an argument for caution. Sober assessment of the situation,
+however, gives cause for hope.
+
+Unlike the notion monad, objects began as ``folk'' tradition. It was
+many years into proposals for object-oriented design methods before
+there were commonly accepted formal or mathematical accounts. By
+contrast monads began as a mathematical entity. Sequestered away in
+category theory the idea was one of a whole zoology of generalizations
+of common mathematical entities. It took some time to understand that
+both set comprehensions and algebraic data types were instances monads
+and that the former was a universal language for the notion. It took
+even more time to see the application to structuring
+computations. Progress was slow and steady and built from a solid
+foundation. This gave the notion an unprecedented level of quality
+assurance testing. The category theoretic definition is nearly fifty
+years old. If we include the investigation of set comprehensions as a
+part of the QA process we add another one hundred years. If we include
+the forty years of vigorous use of relational databases and the
+\lstinline[language=SQL]!SELECT-FROM-WHERE! construct in the industry,
+we see that this was hardly just an academic exercise.
+
+Perhaps more importantly than any of those is the fact that while
+object-oriented techniques ultimately failed to be compositional in
+any useful way -- inheritance, in fact being at positively at odds
+with concurrent composition -- the notion of monad is actually an
+attempt to capture the meaning of composition. As we will see in the
+upcoming sections, it defines an powerful notion of parametric
+composition. This is crucial because in the real world
+\emph{composition is the primary means to scaling} -- both in the
+sense of performance and in the sense of complexity. As pragmatic
+engineers we manage complexity of scale by building larger systems out
+of smaller ones. As pragmatic engineers we understand that each time
+components are required to interface or synchronize we have the
+potential for introducing performance concerns. The parametric form of
+composition encapsulated in the notion of monad gives us a language
+for talking about both kinds of scaling and connecting the two
+ideas. It provides a language for talking about the interplay between
+the composition of structure and the composition of the flow of
+control. It encapsulates stateful computation. It encapsulates data
+structure. In this sense the notion of monad is poised to be the
+rational reconstruction of the notion of object. Telling this story
+was my motivation for writing this book.
\subsection{DSL-based design}
@@ -1,11 +1,11 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {7}A review of collections as monads}{33}{chapter.7}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {7}A review of collections as monads}{35}{chapter.7}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {7.1}Monad as container}{33}{section.7.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {7.2}Monads and take-out}{33}{section.7.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {7.1}Monad as container}{35}{section.7.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {7.2}Monads and take-out}{35}{section.7.2}}
\@setckpt{chapters/seven/ch}{
-\setcounter{page}{34}
+\setcounter{page}{36}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,12 +1,12 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {6}Zippers and contexts and URI's, oh my!}{31}{chapter.6}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {6}Zippers and contexts and URI's, oh my!}{33}{chapter.6}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {6.1}Zippers are not just for Bruno anymore}{31}{section.6.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {6.2}Constructing contexts and zippers from data types}{31}{section.6.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {6.3}Mapping URIs to zipper-based paths and back}{31}{section.6.3}}
+\@writefile{toc}{\contentsline {section}{\numberline {6.1}Zippers are not just for Bruno anymore}{33}{section.6.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {6.2}Constructing contexts and zippers from data types}{33}{section.6.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {6.3}Mapping URIs to zipper-based paths and back}{33}{section.6.3}}
\@setckpt{chapters/six/ch}{
-\setcounter{page}{32}
+\setcounter{page}{34}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,11 +1,11 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {10}The semantic web}{39}{chapter.10}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {10}The semantic web}{41}{chapter.10}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {10.1}How our web framework enables different kinds of application queries}{39}{section.10.1}}
-\@writefile{toc}{\contentsline {section}{\numberline {10.2}Searching for programs}{39}{section.10.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {10.1}How our web framework enables different kinds of application queries}{41}{section.10.1}}
+\@writefile{toc}{\contentsline {section}{\numberline {10.2}Searching for programs}{41}{section.10.2}}
\@setckpt{chapters/ten/ch}{
-\setcounter{page}{40}
+\setcounter{page}{42}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
@@ -1,14 +1,14 @@
\relax
-\@writefile{toc}{\contentsline {chapter}{\numberline {3}An IO-monad for http streams}{25}{chapter.3}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {3}An IO-monad for http streams}{27}{chapter.3}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {section}{\numberline {3.1}Code first, questions later}{25}{section.3.1}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.1}An HTTP-request processor}{25}{subsection.3.1.1}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.2}What we did}{25}{subsection.3.1.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {3.2}Synchrony, asynchrony and buffering}{25}{section.3.2}}
-\@writefile{toc}{\contentsline {section}{\numberline {3.3}State, statelessness and continuations}{25}{section.3.3}}
+\@writefile{toc}{\contentsline {section}{\numberline {3.1}Code first, questions later}{27}{section.3.1}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.1}An HTTP-request processor}{27}{subsection.3.1.1}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.2}What we did}{27}{subsection.3.1.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {3.2}Synchrony, asynchrony and buffering}{27}{section.3.2}}
+\@writefile{toc}{\contentsline {section}{\numberline {3.3}State, statelessness and continuations}{27}{section.3.3}}
\@setckpt{chapters/three/ch}{
-\setcounter{page}{26}
+\setcounter{page}{28}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
Oops, something went wrong.

0 comments on commit b69c1df

Please sign in to comment.