

% 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{Inheritance Basics}
\subtitle{}
\author{Damien Cassou, Stéphane Ducasse and Luc Fabresse}
\institute{http://stephane.ducasse.free.fr}
\date{}
\slidesid{W4S01}

\begin{document}

\frame[plain]{\titlepage}



\begin{frame}[fragile]

\frametitle{Goal}

\begin{itemize}
\item What is inheritance?
\item When to use it?
\end{itemize}

Pharo treats inheritance the same way as Java
\end{frame}



\begin{frame}[fragile]

\frametitle{The Basics}

\begin{columns}

\begin{column}{0.6\textwidth}

\begin{itemize}
\item often we want small adaptations
\item we want to extend existing behavior and state
\item solution: \textbf{class inheritance}
\item a class extends the definition of its superclass
\end{itemize}
\end{column}


\begin{column}{0.4\textwidth}


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

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{The Basics}

\begin{columns}

\begin{column}{0.6\textwidth}

a subclass

\begin{itemize}
\item can add state and behavior:
\begin{itemize}
\item \code{color}, \code{borderColor}, ...
\end{itemize}

\item can use superclass behavior and state
\item can specialize and redefine superclass behavior
\end{itemize}
\end{column}


\begin{column}{0.4\textwidth}


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

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{Root of Inheritance Hierarchy}

\begin{columns}

\begin{column}{0.7\textwidth}

\begin{itemize}
\item \code{Object} is the root of most classes
\item \code{ProtoObject} (\code{Object}'s superclass) is for special purposes...
\begin{itemize}
\item ...but we will ignore it as it is not important
\end{itemize}

\end{itemize}
\end{column}


\begin{column}{0.3\textwidth}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/InheritanceDiagram-from-Object.png}\end{center}

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{The Basics}

inheritance is

\begin{itemize}
\item static for state (i.e., during class creation)
\item dynamic for behavior (i.e., during execution)
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Inheritance of Instance Variables}

\begin{columns}

\begin{column}{0.65\textwidth}

\begin{itemize}
\item happens during class definition
\item computed from
\begin{itemize}
\item the class own instance variables
\item the ones of its superclasses
\end{itemize}

\end{itemize}
\end{column}


\begin{column}{0.35\textwidth}


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

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{Inheritance of Behavior}

\begin{columns}

\begin{column}{0.5\textwidth}

\begin{itemize}
\item happens at runtime
\item the method is searched
\begin{itemize}
\item starting from the receiver's class
\item then going to the superclass
\end{itemize}

\end{itemize}
\end{column}


\begin{column}{0.5\textwidth}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/InheritanceDiagram-lookup-withBlank.png}\end{center}

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{Inheritance of Behavior}

\begin{columns}

\begin{column}{0.5\textwidth}

\begin{itemize}
\item happens at runtime
\item the method is searched
\begin{itemize}
\item starting from the receiver's class
\item then going to the superclass
\end{itemize}

\end{itemize}
\end{column}


\begin{column}{0.5\textwidth}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/InheritanceDiagram-lookup-superclass.png}\end{center}

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{What You Should Know}

\begin{itemize}
\item Inheritance allows a class to refine state and behavior
\item A class has 1 and only 1 superclass
\item A class eventually inherits from \code{Object}
\item Inheritance of state is static
\item Inheritance of behavior is dynamic
\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:
