slides/slides02.tex
author Christian Urban <urbanc@in.tum.de>
Fri, 10 Nov 2017 09:23:23 +0000
changeset 143 11396c17cd8b
parent 66 3506b681c191
child 147 72f7dd1a3754
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t,xelatex]{beamer}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{../slides}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage{../graphics}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage{../langs}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
%\usepackage{../data}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\hfuzz=220pt 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
%\setmonofont[Scale=.88]{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
%\newfontfamily{\consolas}{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\lstset{language=Scala,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
        style=mystyle,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
        numbersep=0pt,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
        numbers=none,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
        xleftmargin=0mm}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\newcommand{\bl}[1]{\textcolor{blue}{#1}}     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
% beamer stuff 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\renewcommand{\slidecaption}{PEP (Scala) 02, King's College London}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\begin{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\frametitle{%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
  \begin{tabular}{@ {}c@ {}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
  \\[5mm]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
  \huge PEP Scala (2) 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  \end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  \normalsize
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  \begin{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  \begin{tabular}{ll}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  Email:  & christian.urban at kcl.ac.uk\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  Office: & S1.27 (1st floor Strand Building)\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  Slides \& Code: & KEATS
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  \end{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
\frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
\begin{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
\item \large {\bf You can avoid \textcolor{blue}{\texttt{null}}}:
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
\end{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
\begin{textblock}{6}(1,5)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
  \begin{bubble}[10.5cm]\small
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
      ``I call it my billion-dollar mistake. It was the invention of
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
      the null reference in 1965. At that time, I was designing the
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
      first comprehensive type system for references in an object
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
      oriented language (ALGOL W). My goal was to ensure that all use
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
      of references should be absolutely safe, with checking performed
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
      automatically by the compiler. But I couldn't resist the
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
      temptation to put in a null reference, simply because it was so
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
      easy to implement. This has led to innumerable errors,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
      vulnerabilities, and system crashes, which have probably caused
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
      a billion dollars of pain and damage in the last forty years.''
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
      \hfill Sir Tony (Hoare)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
\end{bubble}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
\end{textblock}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
\begin{textblock}{5}(11.8,1)
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
\includegraphics[scale=0.20]{hoare.jpg}\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
\end{textblock}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
\begin{frame}[c]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\frametitle{\huge\textbf{\texttt{return}}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\begin{center}\LARGE
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
you should never use it
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
\end{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
\begin{frame}[c]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
\frametitle{Types}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
\begin{itemize}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
\item Base types\smallskip
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  \begin{tabular}{@{}l@{}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
    \textcolor{codegreen}{\texttt{Int}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
    \textcolor{codegreen}{\texttt{Long}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
    \textcolor{codegreen}{\texttt{BigInt}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
    \textcolor{codegreen}{\texttt{Float}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
    \textcolor{codegreen}{\texttt{Double}}\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
    \textcolor{codegreen}{\texttt{String}},
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
    \textcolor{codegreen}{\texttt{Char}}\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
    \textcolor{codegreen}{\texttt{Boolean}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
\item Compound types \smallskip   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
  \begin{tabular}{@{}ll@{}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
    \textcolor{codegreen}{\texttt{List[Int]}}     & lists of Int's \\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
    \textcolor{codegreen}{\texttt{Set[Double]}}   & sets of Double's \\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
    \textcolor{codegreen}{\texttt{(Int, String)}} & Int-String pair\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
    \textcolor{codegreen}{\texttt{List[(BigInt, String)]}} &
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
                                      lists of BigInt-String\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
                                      & pairs\\
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
    \textcolor{codegreen}{\texttt{List[List[Int]]}} & list of lists of Int's\\                                  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
\end{itemize}  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
\begin{frame}[c]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
\frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
\mbox{}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
%%% Local Variables:  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
%%% mode: latex
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
%%% TeX-master: t
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
%%% End: 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141