\documentclass[dvipsnames,14pt,t,xelatex]{beamer}\usepackage{../slides}\usepackage{../graphics}\usepackage{../langs}%\usepackage{../data}\hfuzz=220pt %\setmonofont[Scale=.88]{Consolas}%\newfontfamily{\consolas}{Consolas}\lstset{language=Scala, style=mystyle, numbersep=0pt, numbers=none, xleftmargin=0mm}\newcommand{\bl}[1]{\textcolor{blue}{#1}} % beamer stuff \renewcommand{\slidecaption}{PEP (Scala) 01, King's College London}\begin{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[t]\frametitle{% \begin{tabular}{@ {}c@ {}} \\[5mm] \huge PEP Scala (1) \end{tabular}} \normalsize \begin{center} \begin{tabular}{ll} Email: & christian.urban at kcl.ac.uk\\ Office: & S1.27 (1st floor Strand Building)\\ Slides \& Code: & KEATS \end{tabular} \end{center}\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{Why Scala?}\begin{textblock}{6}(3,4)\begin{tabular}{l}\mbox{}\hspace{-1mm}\includegraphics[scale=0.36]{../pics/twitter.png}\\[-1mm]\includegraphics[scale=0.30]{../pics/linked.png}\\\includegraphics[scale=0.30]{../pics/guardian.jpg}\\[-3mm]\mbox{}\hspace{-2mm}\includegraphics[scale=0.38]{../pics/morgan.png}\\[-3mm]\includegraphics[scale=0.30]{../pics/suisse.png}\\{\large\bf ...}\end{tabular}\end{textblock}\begin{textblock}{6}(9,4)\begin{tabular}{l}\includegraphics[scale=0.20]{../pics/edf.png}\\[-1mm]\includegraphics[scale=0.08]{../pics/novell.png}\\[-1mm]\includegraphics[scale=0.30]{../pics/foursquare.png}\\\includegraphics[scale=0.30]{../pics/hsbc.png}\\{\large\bf ...}\end{tabular}\end{textblock}\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{Why Scala?}\begin{itemize}\item compiles to the JVM\\ \textcolor{gray}{(also JavaScript, native X86 in the works)}\medskip\item integrates seamlessly with Java\medskip\item combines \underline{\bf functional} and {\bf object-oriented} programming\bigskip\item it is a bit on the ``mathematical'' side\\ \textcolor{gray}{(no pointers, no \texttt{null})}\item often one can write very concise and elegant code\end{itemize}\bigskip\medskip \smallalternatives: Elm, Haskell, Ocaml, ML, Lisp (Racket), \ldots\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{Java vs Scala}{\lstset{language=java}\fontsize{12}{12}\selectfont\texttt{\lstinputlisting{Point.java}}}\rule{11cm}{0.3mm}\\[-2mm]{\lstset{language=scala}\fontsize{12}{12}\selectfont\texttt{\lstinputlisting{Point.scala}}}\begin{textblock}{6}(13,3)\textbf{\large Java}\end{textblock}\begin{textblock}{6}(13,13.4)\textbf{\large Scala}\end{textblock} \end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{Scala Tools}\begin{itemize}\item there is a plugin for Eclipse (called Scala IDE)\medskip\item there is also a plugin for IntelliJ\bigskip\item I use the venerable Emacs ;o)\end{itemize} \end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{Types}\begin{itemize}\item Base types\smallskip \begin{tabular}{@{}l@{}} \textcolor{codegreen}{\texttt{Int}}, \textcolor{codegreen}{\texttt{Long}}, \textcolor{codegreen}{\texttt{BigInt}}, \textcolor{codegreen}{\texttt{Float}}, \textcolor{codegreen}{\texttt{Double}}\\ \textcolor{codegreen}{\texttt{String}}, \textcolor{codegreen}{\texttt{Char}}\\ \textcolor{codegreen}{\texttt{Boolean}} \end{tabular}\item Compound types \smallskip \begin{tabular}{@{}ll@{}} \textcolor{codegreen}{\texttt{List[Int]}} & lists of Int's \\ \textcolor{codegreen}{\texttt{Set[Double]}} & sets of Double's \\ \textcolor{codegreen}{\texttt{(Int, String)}} & Int-String pair\\ \textcolor{codegreen}{\texttt{List[(BigInt, String)]}} & lists of BigInt-String\\ & pairs\\ \textcolor{codegreen}{\texttt{List[List[Int]]}} & list of lists of Int's\\ \end{tabular}\end{itemize} \end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{An Http Request}\begin{textblock}{1}(2,5)\begin{tabular}{c}\includegraphics[scale=0.15]{../pics/servers.png}\\[-2mm]\small Server\end{tabular}\end{textblock}\begin{textblock}{1}(5.6,4) \begin{tikzpicture}[scale=1.1] \draw[white] (0,1) node (X) {}; \draw[white] (2,1) node (Y) {}; \draw[white] (0,0) node (X1) {}; \draw[white] (2,0) node (Y1) {}; \draw[white] (0,-1) node (X2) {}; \draw[white] (2,-1) node (Y2) {}; \draw[red, <-, line width = 2mm] (X) -- (Y); \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {}; \draw[red, ->, line width = 2mm] (X1) -- (Y1); \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {}; \draw[red, <-, line width = 2mm] (X2) -- (Y2); \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {}; \end{tikzpicture}\end{textblock}\begin{textblock}{1}(9,5.5)\begin{tabular}{c}\includegraphics[scale=0.15]{../pics/laptop.png}\\[-2mm]\small Browser\end{tabular}\end{textblock}\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]{\lstset{language=Java}\fontsize{7}{8}\selectfont\texttt{\lstinputlisting{URLReader.java}}}\only<2>{\begin{textblock}{5}(12,2)\includegraphics[scale=0.50]{../pics/skeleton.jpg}\\\end{textblock}}\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{Conclusion}\begin{itemize}\item Scala is still under heavy development\\ (the compiler is terribly slow)\medskip\item {\bf\url{http://www.scala-lang.org/}}\bigskip\item it is a rather \textbf{\alert{deep}} language\ldots i.e.~gives you a lot of rope to shoot yourself\bigskip\bigskip \item hope you have fun with the coursework \end{itemize}\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\begin{frame}[c]\frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}\mbox{}\end{frame}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document}\end{document}%%% Local Variables: %%% mode: latex%%% TeX-master: t%%% End: