

% add the PATH to retrieve cls and sty beamer styles files
\makeatletter
\providecommand*{\input@path}{}
\edef\input@path{{../../support/beamer/}\input@path}% prepend
\makeatother

% \documentclass{pharoslides}
% \documentclass[aspectratio=169]{pharoslides} % format 16/9
\documentclass[withvideo]{pharoslides} % format 16/9 + incrustation video

\graphicspath{{./figures/}{../}{../../support/beamer/imgs/}}

%Information to be included in the title page:
\title{Libraries versus Frameworks}
\subtitle{}
\author{Damien Cassou, Stéphane Ducasse and Luc Fabresse}
\institute{http://stephane.ducasse.free.fr}
\date{}
\slidesid{}

\begin{document}

\frame[plain]{\titlepage}



\begin{frame}[fragile]

\frametitle{Outline}

\begin{itemize}
\item What are libraries?
\item What are frameworks?
\item Some guidelines to create a new framework
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{What are Libraries?}

\begin{itemize}
\item a \textit{library} is a set of code entities (classes and methods)
\item the \textit{client} of a library sends \textit{requests} to the library
\item the library returns \textit{responses}
\item the main code (dark blue) is in the client
\end{itemize}


\begin{center}
\includegraphics[width=0.6\textwidth]{figures/Library.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{What are Frameworks?}

\begin{itemize}
\item a \textit{framework} is a set of code entities (classes and methods), just like in libraries
\item the framework has \textit{abstractions} (i.e., holes) to be implemented
\item the \textit{client} implements the abstractions to parameterize the framework
\item the main code (dark blue) is in the framework
\end{itemize}


\begin{center}
\includegraphics[width=0.7\textwidth]{figures/Framework.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Libraries versus Frameworks}

\begin{itemize}
\item Library
\begin{itemize}
\item You call it
\item You use callbacks to extend it
\end{itemize}

\item Framework
\begin{itemize}
\item \textit{Hollywood principle}: Don't call me, I will call you
\end{itemize}

\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Libraries versus Frameworks}

\begin{tabular}{ll}
\toprule
\textbf{Library} & \textbf{Framework} \\
\midrule
The client instantiates the classes & The framework instantiates the classes \\
The client invokes library functions & The framework invokes code in the client \\
The client is responsible for the flow & The framework is responsible for the flow \\
\bottomrule
\end{tabular}
\end{frame}



\begin{frame}[fragile]

\frametitle{Inheritance as Parameterization}

\begin{itemize}
\item a client parameterizes a framework by overriding operations
\item the \textit{template method} design pattern is often used
\end{itemize}


\begin{center}
\includegraphics[width=0.7\textwidth]{figures/FrameworkParameterization.png}\end{center}

% syntax highlighting = smalltalk

\begin{listing}{}
MyGUI new newWindow  --> creates a window of width 25
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Framework Design}

\begin{itemize}
\item Needs at least 3 clients
\item \symbol{34}\textit{A Pattern Language for Developing Object-Oriented Frameworks}\symbol{34}, by Don Roberts and Ralph Johnson
\item Framework design often relies on whitebox abstractions
\begin{itemize}
\item framework are extended by inheritance
\item blackbox abstraction is also possible: usage of composition
\end{itemize}

\end{itemize}
\end{frame}




% \setlength{\textwidth}{\originaltextwidth}
\setbeamertemplate{background canvas}{\insertBorderForHandout}

\begin{frame}[plain]

\begin{minipage}{\originaltextwidth}
\centering
\large


\vspace{2em}

A course by

\vspace{1em}

\hspace{-20px}\includegraphics[height=32px]{inriaLogo}\hspace{3em}\raisebox{7px}{and}\hspace{3em}\raisebox{-6px}{\includegraphics[height=30px]{logoutop}}

\vspace{2em}

in collaboration with

\vspace{1em}

\includegraphics[height=40px]{unisciellogo}\hskip 1.5em%
\raisebox{5px}{\includegraphics[height=30px]{unitlogo}}\hskip 2em%
\raisebox{8px}{\includegraphics[height=24px]{univLilleLogo}}\hskip 2em%
\raisebox{3px}{\includegraphics[height=29px]{logo-IMT}}\hskip 2em%
\raisebox{1px}{\includegraphics[height=32px]{minesDouaiLogo}}

\vspace{2.5em}

\includegraphics[width=50px]{by-nc-nd} \tiny \hskip 0.5em \raisebox{5px}{Inria 2016}

\medskip

\tiny
Except where otherwise noted, this work is licensed under CC BY-NC-ND 3.0 France

\url{https://creativecommons.org/licenses/by-nc-nd/3.0/fr/} 

\end{minipage}
\end{frame}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
