diff --git a/Lectures/Figures/500px-AdapterPatternForWiki.jpg b/Lectures/Figures/500px-AdapterPatternForWiki.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ab9d5b4b91f8d3661d708be55268a86a4187863e Binary files /dev/null and b/Lectures/Figures/500px-AdapterPatternForWiki.jpg differ diff --git a/Lectures/Figures/AdapterPattern4.gif b/Lectures/Figures/AdapterPattern4.gif new file mode 100644 index 0000000000000000000000000000000000000000..b9d00dafbdbd9cefaa3956dea1e3334d247fb126 Binary files /dev/null and b/Lectures/Figures/AdapterPattern4.gif differ diff --git a/Lectures/Figures/Proxy_pattern_diagram.png b/Lectures/Figures/Proxy_pattern_diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..87b999c9c89a06fb1ad02c60a5d765aeaafff484 Binary files /dev/null and b/Lectures/Figures/Proxy_pattern_diagram.png differ diff --git a/Lectures/Figures/factory_pattern_uml_diagram.jpg b/Lectures/Figures/factory_pattern_uml_diagram.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8d85567ac879518374d1434fcdcc946923a700f7 Binary files /dev/null and b/Lectures/Figures/factory_pattern_uml_diagram.jpg differ diff --git a/Lectures/L36_DesignPatterns/DesignPatterns.pdf b/Lectures/L36_DesignPatterns/DesignPatterns.pdf index bf0e5228f73a942f952fca9b6efc1c8f273add14..bec62d0f10a4011f4814af51480f42f5968cbd3a 100644 Binary files a/Lectures/L36_DesignPatterns/DesignPatterns.pdf and b/Lectures/L36_DesignPatterns/DesignPatterns.pdf differ diff --git a/Lectures/L36_DesignPatterns/DesignPatterns.tex b/Lectures/L36_DesignPatterns/DesignPatterns.tex index 1619649c532038645364f1c5c31ea3a813264f91..691a534a85ed2c1d0b3f3f4d31f6046bc5ead20f 100755 --- a/Lectures/L36_DesignPatterns/DesignPatterns.tex +++ b/Lectures/L36_DesignPatterns/DesignPatterns.tex @@ -226,6 +226,25 @@ doing it the same way.'' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} +\frametitle{Strategy Design Pattern} + +\bi +\item From \href{https://sourcemaking.com/design_patterns/strategy}{Source + Making web-page} +\item Define a family of algorithms, encapsulate each one, and make them + interchangeable. +\item Strategy lets the algorithm vary independently from the clients that use + it. +\item Capture the abstraction in an interface, bury implementation details in + derived classes. +\item \structure{Where have we used this pattern?} +\ei + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \begin{frame} \frametitle{UML Diagram of Measurable Interface} @@ -308,13 +327,22 @@ inefficient; in other cases it may be unsafe. This inefficiency or insecurity i mechanisms, which should be kept separate from both the client and the component to which it needs access. \item Solution: The client communicates with a representative rather than the component itself. This representative, the \structure{proxy}, also does and pre- and postprocessing that is needed. - +\item \href{https://en.wikipedia.org/wiki/Proxy_pattern}{Code} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} +\frametitle{UML Diagram of Proxy} + +\includegraphics[scale=0.5]{../Figures/Proxy_pattern_diagram.png} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \begin{frame} \frametitle{Command Processor Pattern} @@ -348,5 +376,34 @@ so on. The actual execution of the command is delegated to a supplier component %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame} +\frametitle{Adapter Design Pattern} + +\structure{When have we used the adapter (or wrapper) design pattern?} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Adapter Design Pattern} + +\includegraphics[scale=0.7]{../Figures/500px-AdapterPatternForWiki.jpg} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Factory Pattern} + +\includegraphics[scale=0.55]{../Figures/factory_pattern_uml_diagram.jpg} + +\href{https://www.tutorialspoint.com/design_pattern/factory_pattern.htm}{Code} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \end{document}