diff --git a/Lectures/Figures/Adapter.png b/Lectures/Figures/Adapter.png new file mode 100644 index 0000000000000000000000000000000000000000..bee9923049afbe4a18bc86df4f55ba06b0803892 Binary files /dev/null and b/Lectures/Figures/Adapter.png differ diff --git a/Lectures/L27_DesignPatterns/DesignPatterns.tex b/Lectures/L27_DesignPatterns/DesignPatterns.tex index ddc9cf91d7106e35a6f6d8c1b3c5591e8b6c0d45..9f4888b889a49f62f3dc1949934c98e017193e3b 100755 --- a/Lectures/L27_DesignPatterns/DesignPatterns.tex +++ b/Lectures/L27_DesignPatterns/DesignPatterns.tex @@ -486,7 +486,8 @@ so on. The actual execution of the command is delegated to a supplier component \includegraphics[scale=0.8]{../Figures/command.png} ~\\ -\href{http://www.dofactory.com/net/command-design-pattern}{http://www.dofactory.com/net/command-design-pattern} +\href{http://www.dofactory.com/net/command-design-pattern} +{http://www.dofactory.com/net/command-design-pattern} \end{frame} diff --git a/Lectures/L28_ParnasTables/ParnasTables.pdf b/Lectures/L28_ParnasTables/ParnasTables.pdf index 00c7dd4746a809e42bcd622ed7fa04eabb13a888..0232a2d9192487ae16ffb1314f6f3f54e4bb9221 100644 Binary files a/Lectures/L28_ParnasTables/ParnasTables.pdf and b/Lectures/L28_ParnasTables/ParnasTables.pdf differ diff --git a/Lectures/L28_ParnasTables/ParnasTables.tex b/Lectures/L28_ParnasTables/ParnasTables.tex index 5313616f6e4a7e78ea66f201644be13b49d076c2..b5b192fb77f3285f5f001ff48a25ef33f2189894 100755 --- a/Lectures/L28_ParnasTables/ParnasTables.tex +++ b/Lectures/L28_ParnasTables/ParnasTables.tex @@ -1,5 +1,5 @@ -%\documentclass[t,12pt,numbers,fleqn,handout]{beamer} -\documentclass[t,12pt,numbers,fleqn]{beamer} +\documentclass[t,12pt,numbers,fleqn,handout]{beamer} +%\documentclass[t,12pt,numbers,fleqn]{beamer} \usepackage{pgfpages} \usepackage{hyperref} @@ -83,14 +83,11 @@ TBD \item A3 \begin{itemize} -\item Part 1 - Solution: Mar 18 \item Part 2 - Code: due 11:59 pm Mar 26 \end{itemize} \item A4 \bi -\item Your own design and specification -\item Model module for game of Freecell \item Due April 9 at 11:59 pm \ei @@ -135,11 +132,30 @@ so on. The actual execution of the command is delegated to a supplier component %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} +\frametitle{Command in UML} + +\includegraphics[scale=0.8]{../Figures/command.png} +~\\ +\href{http://www.dofactory.com/net/command-design-pattern} +{http://www.dofactory.com/net/command-design-pattern} + +%invoker can track list of previous commands +%command can include undo execute +%receiver actually knows how to do the calculation +%client associates receiver and concrete command + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \begin{frame} \frametitle{Adapter Design Pattern} \structure{When have we used the adapter (or wrapper) design pattern?} +% wrapper for sequence for A1 +% npolyVal(n, x) implemented by numpy polyfit \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -153,6 +169,18 @@ so on. The actual execution of the command is delegated to a supplier component %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} +\frametitle{Adapter UML Diagram} + +\includegraphics[scale=0.42]{../Figures/Adapter.png} + +\href{https://commons.wikimedia.org/wiki/File:Adapter_using_delegation_UML_class_diagram.png} +{Link} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \begin{frame} \frametitle{Factory Pattern} @@ -160,6 +188,9 @@ so on. The actual execution of the command is delegated to a supplier component \href{https://www.tutorialspoint.com/design_pattern/factory_pattern.htm}{Code} +% create object without exposing the creation logic, refer to newly created +% object using a common interface. +% Client is decoupled from the implementation details of derived classes \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -260,6 +291,10 @@ designs %sp is set point %e mean enumerated type %subscript -1 means previous value +~\\ +~\\ +\structure{What is this table specifying?} + \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -367,12 +402,15 @@ If Condition 1 then f\_name = Result 1\\ Elseif Condition 2 then f\_name = Result 2\\ Elseif ...\\ Elseif Condition n then f\_name = Result n\\ +or f\_name = (Condition 1 $\Rightarrow$ Result 1 $|$ ...) + ~\newline \uncover<2->{\structure<2>{Disjointedness $\equiv$ $\forall (i, j: \mathbb{N} | 1 \leq i \leq n \wedge 1 \leq j \leq n \wedge i \neq j : \mbox{Condition } i \wedge \mbox{Condition } j \Leftrightarrow \mbox{false})$\\ ~\\ -Completeness $\equiv \vee (i: \mathbb{N} | 1 \leq i \leq n : \mbox{Condition } i )$}} +Completeness $\equiv \vee (i: \mathbb{N} | 1 \leq i \leq n : \mbox{Condition } i +)$}} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -430,8 +468,8 @@ Horizontal condition tables \\ \frametitle{World View of Tables} \bi -\item \structure{Do tables take a dynamic or a static world view?} -\item \structure{Can you write an algorithm with a table?} +\item \structure{Do tables take a dynamic or a static world view?} %static +\item \structure{Can you directly write an algorithm from a table?} %maybe \ei \end{frame} @@ -484,7 +522,7 @@ sequences of operations \begin{itemize} -\item Consider all of the cases +\item Consider all of the cases for a rectangle \item Draw a picture \item Short form notation \begin{itemize} @@ -495,6 +533,7 @@ sequences of operations \item $llxw = \mathit{lower\_left}.\mbox{xcoord()} + \mathit{width}$ \item $llyh = \mathit{lower\_left}.\mbox{ycoord()} + \mathit{height}$ \item T = Constants.TOLERANCE +\item $p1$.dist$(p2$) is the distance between p1 and p2 \end{itemize} \end{itemize} @@ -623,4 +662,16 @@ $p.\mbox{dist}(\mbox{PointT}(llxw, llyh)) ] \leq \mbox{T}$}\\ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} +\frametitle{Nine Cases, but 2D} + +\bi +\item \structure{How would you write all 9 cases, but with a tabular form that + closely matches the original 2D problem description?} +\ei + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \end{document} \ No newline at end of file