slides01.tex
changeset 0 8d6145cea799
child 1 4856ff72a64b
equal deleted inserted replaced
-1:000000000000 0:8d6145cea799
       
     1 \documentclass[dvipsnames,14pt,t]{beamer}
       
     2 \usepackage{beamerthemeplainculight}
       
     3 \usepackage[T1]{fontenc}
       
     4 \usepackage[latin1]{inputenc}
       
     5 \usepackage{mathpartir}
       
     6 \usepackage[absolute,overlay]{textpos}
       
     7 \usepackage{ifthen}
       
     8 \usepackage{tikz}
       
     9 \usepackage{pgf}
       
    10 \usepackage{calc} 
       
    11 \usepackage{ulem}
       
    12 \usepackage{courier}
       
    13 \usepackage{listings}
       
    14 \renewcommand{\uline}[1]{#1}
       
    15 \usetikzlibrary{arrows}
       
    16 \usetikzlibrary{automata}
       
    17 \usetikzlibrary{shapes}
       
    18 \usetikzlibrary{shadows}
       
    19 \usetikzlibrary{positioning}
       
    20 \usetikzlibrary{calc}
       
    21 
       
    22 %%%\usetikzlibrary{mindmap}
       
    23 
       
    24 \usepackage{graphicx} 
       
    25 
       
    26 \definecolor{javared}{rgb}{0.6,0,0} % for strings
       
    27 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
       
    28 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
       
    29 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
       
    30 
       
    31 \lstset{language=Java,
       
    32 	basicstyle=\ttfamily,
       
    33 	keywordstyle=\color{javapurple}\bfseries,
       
    34 	stringstyle=\color{javagreen},
       
    35 	commentstyle=\color{javagreen},
       
    36 	morecomment=[s][\color{javadocblue}]{/**}{*/},
       
    37 	numbers=left,
       
    38 	numberstyle=\tiny\color{black},
       
    39 	stepnumber=1,
       
    40 	numbersep=10pt,
       
    41 	tabsize=2,
       
    42 	showspaces=false,
       
    43 	showstringspaces=false}
       
    44 
       
    45 \lstdefinelanguage{scala}{
       
    46   morekeywords={abstract,case,catch,class,def,%
       
    47     do,else,extends,false,final,finally,%
       
    48     for,if,implicit,import,match,mixin,%
       
    49     new,null,object,override,package,%
       
    50     private,protected,requires,return,sealed,%
       
    51     super,this,throw,trait,true,try,%
       
    52     type,val,var,while,with,yield},
       
    53   otherkeywords={=>,<-,<\%,<:,>:,\#,@},
       
    54   sensitive=true,
       
    55   morecomment=[l]{//},
       
    56   morecomment=[n]{/*}{*/},
       
    57   morestring=[b]",
       
    58   morestring=[b]',
       
    59   morestring=[b]"""
       
    60 }
       
    61 
       
    62 \lstset{language=Scala,
       
    63 	basicstyle=\ttfamily,
       
    64 	keywordstyle=\color{javapurple}\bfseries,
       
    65 	stringstyle=\color{javagreen},
       
    66 	commentstyle=\color{javagreen},
       
    67 	morecomment=[s][\color{javadocblue}]{/**}{*/},
       
    68 	numbers=left,
       
    69 	numberstyle=\tiny\color{black},
       
    70 	stepnumber=1,
       
    71 	numbersep=10pt,
       
    72 	tabsize=2,
       
    73 	showspaces=false,
       
    74 	showstringspaces=false}
       
    75 
       
    76 % beamer stuff 
       
    77 \renewcommand{\slidecaption}{Scala, King's College London, 27.~March 2012}
       
    78 
       
    79 
       
    80 \begin{document}
       
    81 
       
    82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    83 \mode<presentation>{
       
    84 \begin{frame}<1>[t]
       
    85 \frametitle{%
       
    86 \begin{tabular}{@ {\hspace{-3mm}}c@ {}}
       
    87 \\
       
    88 \large \textcolor{black}{PRA, Programming Applications:}\\[5mm]
       
    89 \Huge Scala\\[-1mm]
       
    90 \large ``Better Java'' for Programming the JVM\\[5mm]
       
    91 \normalsize \textcolor{black}{Christian Urban}
       
    92 \end{tabular}}
       
    93 \end{frame}}
       
    94  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
    95 
       
    96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    97 \mode<presentation>{
       
    98 \begin{frame}[c]
       
    99 \frametitle{\begin{tabular}{c}1.~Reason\end{tabular}}
       
   100 
       
   101 \begin{textblock}{6}(1,3)
       
   102 \begin{tabular}{l}
       
   103 \mbox{}\hspace{-1mm}\includegraphics[scale=0.36]{twitter.png}\\[-1mm]
       
   104 \includegraphics[scale=0.30]{linked.png}\\
       
   105 \includegraphics[scale=0.30]{guardian.jpg}\\[-3mm]
       
   106 \mbox{}\hspace{-2mm}\includegraphics[scale=0.38]{morgan.png}\\[-3mm]
       
   107 \includegraphics[scale=0.30]{suisse.png}\\
       
   108 \includegraphics[scale=0.20]{edf.png}\\[-1mm]
       
   109 \includegraphics[scale=0.08]{novell.png}\\[-1mm]
       
   110 \includegraphics[scale=0.30]{foursquare.png}\\
       
   111 \includegraphics[scale=0.30]{hsbc.png}\\
       
   112 {\large\bf ...}
       
   113 \end{tabular}
       
   114 \end{textblock}
       
   115  
       
   116 \only<2->{  
       
   117 \begin{textblock}{6}(6,3)
       
   118 \includegraphics[scale=0.35]{jobgraph.png}\\
       
   119 \end{textblock}}  
       
   120   
       
   121 \only<3->{  
       
   122 \begin{textblock}{6}(7.3,9.2)
       
   123 \begin{tabular}{l}
       
   124 \footnotesize 2013: 1$\%$\\[-2mm]
       
   125 \footnotesize 2014: 3$\%$\\[-2mm]
       
   126 \footnotesize 2015: 9$\%$\\[-2mm]
       
   127 \footnotesize 2016: 27$\%$\\[-2mm]
       
   128 \footnotesize 2017: 81$\%$\\[-2mm]
       
   129 \footnotesize 2018: 243$\%$ \raisebox{-1mm}{\includegraphics[scale=0.02]{smiley.jpg}}
       
   130 \end{tabular}
       
   131 \end{textblock}}  
       
   132   
       
   133 \only<3->{  
       
   134 \begin{textblock}{6}(6,9.5)
       
   135 \footnotesize 5 yrs $\begin{cases}\mbox{}\\[1.4cm]\end{cases}$
       
   136 \end{textblock}}
       
   137 
       
   138 \only<4->{  
       
   139 \begin{textblock}{11}(5,14.1)
       
   140 \textcolor{gray}{
       
   141 \footnotesize {\bf in London today:} 1 Scala job for every 30 Java jobs;\\[-2mm]
       
   142 Scala programmers seem to get up to 20\% better salary}
       
   143 \end{textblock}}
       
   144   
       
   145 \end{frame}}
       
   146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   147 
       
   148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   149 \mode<presentation>{
       
   150 \begin{frame}[c]
       
   151 \frametitle{\begin{tabular}{c}2.~Reason\end{tabular}}
       
   152 
       
   153 \begin{textblock}{11}(1,7)
       
   154 \begin{tikzpicture}[scale=1.0]
       
   155 %\draw[step=2mm] (-1,-1) grid (10,1);
       
   156 \draw[->, line width=2mm] (-0.2,0) -- (11,0);
       
   157 \draw[line width=0.8mm] (0,0) -- (0,-0.3);
       
   158 \node at (0,-0.5) [black] {\footnotesize 1985};
       
   159 \draw[line width=0.8mm] (2.8,0) -- (2.8,-0.3);
       
   160 \node at (2.8,-0.5) [black] {\footnotesize 1992};
       
   161 \draw[line width=0.8mm] (1.2,0) -- (1.2,-0.3);
       
   162 \node at (1.2,-0.5) [black] {\footnotesize 1988};
       
   163 \draw[line width=0.8mm] (4.8,0) -- (4.8,-0.3);
       
   164 \node at (4.8,-0.5) [black] {\footnotesize 1997};
       
   165 \draw[line width=0.8mm] (6,0) -- (6,-0.3);
       
   166 \node at (6,-0.5) [black] {\footnotesize 2000};
       
   167 \draw[line width=0.8mm] (7.6,0) -- (7.6,-0.3);
       
   168 \node at (7.6,-0.5) [black] {\footnotesize 2004};
       
   169 \draw[line width=0.8mm] (10.4,0) -- (10.4,-0.3);
       
   170 \node at (10.4,-0.5) [black] {\footnotesize 2011};
       
   171 \end{tikzpicture}
       
   172 \end{textblock}
       
   173 
       
   174 \begin{textblock}{5}(1,9)
       
   175 \small Basic\\[-1mm]
       
   176 Assembler\\
       
   177 \end{textblock}
       
   178 \begin{textblock}{5}(2.8,11)
       
   179 \small Pascal\\[-1mm]
       
   180 C\\
       
   181 \end{textblock}
       
   182 \begin{textblock}{5}(4.3,9)
       
   183 \small Modula 3\\[-1mm]
       
   184 C++\\
       
   185 \end{textblock}
       
   186 \begin{textblock}{5}(6.7,9)
       
   187 \small $\lambda$Prolog\\
       
   188 \end{textblock}
       
   189 \begin{textblock}{5}(8.6,9)
       
   190 \small Ocaml\\[-1mm]
       
   191 \small SMLj\\[-1mm]
       
   192 \small Pizza
       
   193 \end{textblock}
       
   194 \begin{textblock}{5}(10.6,9)
       
   195 \normalsize\bf SML\\[-1mm]
       
   196 \end{textblock}
       
   197 \begin{textblock}{5}(14,9)
       
   198 \small Scala\\
       
   199 \end{textblock}
       
   200 \begin{textblock}{5}(13.2,11)
       
   201 \small \underline{Future?}\\[0mm]
       
   202 \small Python\\[-1mm]
       
   203 \small Ruby\\[-1mm]
       
   204 \small Javascript\\
       
   205 \end{textblock}
       
   206 
       
   207 \begin{textblock}{5}(0.2,2)
       
   208 \includegraphics[scale=0.30]{punch.jpg}\\
       
   209 \end{textblock}
       
   210 \begin{textblock}{5}(0.4,4.5)
       
   211 \includegraphics[scale=0.20]{plus4.jpg}\\
       
   212 \end{textblock}
       
   213 \begin{textblock}{5}(2.8,2.1)
       
   214 \includegraphics[scale=0.15]{robotron.jpg}\\
       
   215 \end{textblock}
       
   216 \begin{textblock}{5}(5.0,3.7)
       
   217 \includegraphics[scale=0.10]{sparc.jpg}\\
       
   218 \end{textblock}
       
   219 \begin{textblock}{5}(8.0,4)
       
   220 \includegraphics[scale=0.40]{titanium.jpg}\\
       
   221 \end{textblock}
       
   222 \begin{textblock}{5}(12,4.5)
       
   223 \includegraphics[scale=0.10]{air.jpg}\\
       
   224 \end{textblock}
       
   225 \end{frame}}
       
   226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
   227 
       
   228 
       
   229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   230 \mode<presentation>{
       
   231 \begin{frame}[c]
       
   232 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   233 
       
   234 \large
       
   235 \begin{itemize}
       
   236 \item compiles to JVM (.Net \& Android)\bigskip
       
   237 \item integrates seamlessly with Java (Swing)\bigskip
       
   238 \end{itemize}
       
   239   
       
   240 \end{frame}}
       
   241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   242 
       
   243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   244 \mode<presentation>{
       
   245 \begin{frame}[c]
       
   246 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   247 
       
   248 \large
       
   249 \begin{itemize}
       
   250 \item combines {\bf functional} and {\bf object-oriented} programming
       
   251 \end{itemize}
       
   252   
       
   253 \end{frame}}
       
   254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   255 
       
   256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   257 \mode<presentation>{
       
   258 \begin{frame}[c]
       
   259 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   260 
       
   261 
       
   262 \begin{itemize}
       
   263 \item \large {\bf Actors}:\\
       
   264 \normalsize keep asynchronous concurrency simple 
       
   265 \end{itemize}
       
   266   
       
   267 \end{frame}}
       
   268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   269 
       
   270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   271 \mode<presentation>{
       
   272 \begin{frame}[c]
       
   273 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   274 
       
   275 
       
   276 \begin{itemize}
       
   277 \item \large {\bf Immutability}:\\
       
   278 \normalsize keeps concurrency predictable
       
   279 \end{itemize}
       
   280   
       
   281 \end{frame}}
       
   282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   283 
       
   284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   285 \mode<presentation>{
       
   286 \begin{frame}[c]
       
   287 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   288 
       
   289 
       
   290 \begin{itemize}
       
   291 \item \large {\bf First-Class Functions}:\\
       
   292 \normalsize powerful idea from functional programming
       
   293 \end{itemize}
       
   294   
       
   295 \end{frame}}
       
   296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   297 
       
   298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   299 \mode<presentation>{
       
   300 \begin{frame}[c]
       
   301 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   302 
       
   303 
       
   304 \begin{itemize}
       
   305 \item \large {\bf Pattern-Matching}:\\
       
   306 \normalsize ``keeps your needles out of the haystacks''
       
   307 \end{itemize}
       
   308   
       
   309 \end{frame}}
       
   310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   311 
       
   312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   313 \mode<presentation>{
       
   314 \begin{frame}[t]
       
   315 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   316 
       
   317 
       
   318 \begin{itemize}
       
   319 \item \large {\bf You can avoid \textcolor{blue}{\texttt{null}}}:
       
   320 \end{itemize}
       
   321 
       
   322 \begin{textblock}{6}(0.5,5)
       
   323   \begin{tikzpicture}
       
   324   \draw (0,0) node[inner sep=3mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
       
   325   { \begin{minipage}{11cm}\raggedright\small
       
   326   	``I call it my billion-dollar mistake. It was the invention of the null reference in 
       
   327 		1965. At that time, I was designing the first comprehensive type system for references in an 
       
   328 		object oriented language (ALGOL W). My goal was to ensure that all use of references should 
       
   329 		be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist 
       
   330 		the temptation to put in a null reference, simply because it was so easy to implement. This has 
       
   331 		led to innumerable errors, vulnerabilities, and system crashes, which have probably caused 
       
   332 		a billion dollars of pain and damage in the last forty years.'' Sir Tony Hoare\end{minipage}};
       
   333 \end{tikzpicture}
       
   334 \end{textblock}
       
   335   
       
   336 \begin{textblock}{5}(11.8,1)
       
   337 \includegraphics[scale=0.20]{hoare.jpg}\\
       
   338 \end{textblock}
       
   339   
       
   340 \end{frame}}
       
   341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   342 
       
   343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   344 \mode<presentation>{
       
   345 \begin{frame}[c]
       
   346 \frametitle{\begin{tabular}{c}\texttt{null}\end{tabular}}
       
   347 
       
   348 \lstset{language=java}\footnotesize
       
   349 \texttt{\lstinputlisting{MapJavaTester.java}}
       
   350   
       
   351 \end{frame}}
       
   352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   353 
       
   354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   355 \mode<presentation>{
       
   356 \begin{frame}[c]
       
   357 \frametitle{\begin{tabular}{c}Why Scala?\end{tabular}}
       
   358 
       
   359 
       
   360 \begin{itemize}
       
   361 \item \large The Price You Pay with Scala: \textcolor{red}{\bf Complexity}\\
       
   362 \normalsize But it is worth it!
       
   363 \end{itemize}
       
   364   
       
   365 \end{frame}}
       
   366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   367 
       
   368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   369 \mode<presentation>{
       
   370 \begin{frame}[c]
       
   371 \frametitle{\begin{tabular}{c}Java: A Brief History\end{tabular}}
       
   372 
       
   373 \begin{itemize}
       
   374 \item Released in 1995 by James Gosling from \\Sun Microsystems (work started in 1991)\medskip
       
   375 \item derives much of its syntax from C and C++\medskip
       
   376 \item compiles to JVM (``write once, run everywhere'')\medskip
       
   377 \item no pointers --- instead automatic memory management (has a garbage collector)\medskip
       
   378 \item statically typed\\ (``you cannot compare apples with oranges'')
       
   379 \end{itemize}
       
   380   
       
   381 \begin{textblock}{5}(13,2)
       
   382 \includegraphics[scale=0.20]{java.png}\\
       
   383 \end{textblock}
       
   384   
       
   385 \end{frame}}
       
   386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   387 
       
   388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   389 \mode<presentation>{
       
   390 \begin{frame}[c]
       
   391 
       
   392 \lstset{language=java}\fontsize{8}{10}\selectfont
       
   393 \texttt{\lstinputlisting{FruitMain.java}}
       
   394 
       
   395 \only<2>{
       
   396 \begin{textblock}{6}(5,5)
       
   397 \begin{tikzpicture}
       
   398   \draw (0,0) node[inner sep=3mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
       
   399   {\begin{minipage}{8cm}\raggedright\tt\footnotesize
       
   400 \begin{tabular}{l}
       
   401 FruitMain.java:20:~incompatible types\\
       
   402 found: Orange\\
       
   403 required: Apple\\
       
   404         a = o;\\
       
   405 1 error\\
       
   406 \end{tabular}
       
   407 \end{minipage}};
       
   408 \end{tikzpicture}
       
   409 \end{textblock}}
       
   410 
       
   411   
       
   412 \end{frame}}
       
   413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   414 
       
   415 
       
   416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   417 \mode<presentation>{
       
   418 \begin{frame}[c]
       
   419 
       
   420 \lstset{language=java}\fontsize{8}{10}\selectfont
       
   421 \texttt{\lstinputlisting{FruitArray.java}}
       
   422 
       
   423 \only<2>{
       
   424 \begin{textblock}{8}(1,5)
       
   425 \begin{tikzpicture}
       
   426   \draw (0,0) node[inner sep=3mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
       
   427   {\begin{minipage}{11cm}\raggedright\tt\fontsize{8}{10}\selectfont
       
   428 \begin{tabular}{l}
       
   429 {\large \rm runtime exception}\\
       
   430 orange\\
       
   431 Exception in thread "main" java.lang.ArrayStoreException:~Apple\\
       
   432 at FruitArray.main(FruitArray.java:21)\\
       
   433 \end{tabular}
       
   434 \end{minipage}};
       
   435 \end{tikzpicture}
       
   436 \end{textblock}}
       
   437 
       
   438 
       
   439 \end{frame}}
       
   440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   441 
       
   442 
       
   443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   444 \mode<presentation>{
       
   445 \begin{frame}[c]
       
   446 
       
   447 \begin{itemize}
       
   448 \item {\bf In Java a class for students}
       
   449 \end{itemize}
       
   450 
       
   451 {\lstset{language=java}\fontsize{8}{10}\selectfont
       
   452 \texttt{\lstinputlisting{Student.java}}}
       
   453 
       
   454 \onslide<2->{
       
   455 \begin{itemize}
       
   456 \item {\bf Same in Scala}
       
   457 \end{itemize}
       
   458 
       
   459 {\lstset{language=Scala}\fontsize{8}{10}\selectfont
       
   460 \texttt{\lstinputlisting{Student.scala}}}}
       
   461 
       
   462 \end{frame}}
       
   463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   464 
       
   465 
       
   466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   467 \mode<presentation>{
       
   468 \begin{frame}[c]
       
   469 \frametitle{\begin{tabular}{c}Scala\end{tabular}}
       
   470 
       
   471 \begin{itemize}
       
   472 \item First released in 2003 (work started in 2001) by Martin Odersky from EPFL in Lausanne\smallskip
       
   473 \item at the moment 2.9.2 (2012)\smallskip
       
   474 \item blend of functional and oo-programming\medskip\medskip
       
   475 \item Twitter switched in 2009 from Ruby to Scala
       
   476 \item Guardian switched in 2011 from Java to Scala
       
   477 \item UBS approved it for general production usage (2011)
       
   478 \end{itemize}
       
   479 
       
   480 
       
   481 \end{frame}}
       
   482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   483 
       
   484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   485 \mode<presentation>{
       
   486 \begin{frame}[t]
       
   487 
       
   488 \only<1>{
       
   489 Hello World in Java:\medskip
       
   490 {\lstset{language=Java}\fontsize{12}{14}\selectfont
       
   491 \texttt{\lstinputlisting{Hello.java}}}}
       
   492 \only<2->{
       
   493 Hello World in Scala:\medskip
       
   494 {\lstset{language=Scala}\fontsize{12}{14}\selectfont
       
   495 \texttt{\lstinputlisting{Hello.scala}}}\bigskip\medskip
       
   496 
       
   497 
       
   498 Some curiosities, compared to Java:
       
   499 \begin{itemize}
       
   500 \item<3-> The semicolons are missing.
       
   501 \item<4-> The {\bf\texttt{public}} access modifier is missing.
       
   502 \item<5-> The declaration of main starts with {\bf\texttt{def}}.
       
   503 \item<6-> main returns mysterious type {\bf\texttt{Unit}}.
       
   504 \item<7-> In Scala there is {\bf\texttt{object}} and {\bf\texttt{class}}.
       
   505 \end{itemize}}
       
   506 
       
   507 
       
   508 \end{frame}}
       
   509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   510 
       
   511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   512 \mode<presentation>{
       
   513 \begin{frame}[c]
       
   514 
       
   515 \begin{center}
       
   516 \textcolor{ProcessBlue}{\LARGE\bf Demo}
       
   517 \end{center}
       
   518 \end{frame}}
       
   519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   520 
       
   521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   522 \mode<presentation>{
       
   523 \begin{frame}[c]
       
   524 \frametitle{\begin{tabular}{c}Functions\end{tabular}}
       
   525 
       
   526 Transformations:\bigskip
       
   527 \begin{center}
       
   528 \LARGE
       
   529 Input(s)  $\Rightarrow$ Output\bigskip\bigskip
       
   530 \end{center}\pause
       
   531 
       
   532 ``Given some input; produce some output.''\\
       
   533 ``Transform the input into some output.''\\
       
   534 
       
   535 \end{frame}}
       
   536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   537 
       
   538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   539 \mode<presentation>{
       
   540 \begin{frame}[c]
       
   541 \frametitle{\begin{tabular}{c}Functions in Scala\end{tabular}}
       
   542 
       
   543 \mbox{}\bigskip\bigskip\bigskip\bigskip
       
   544 {\lstset{language=Scala}\fontsize{12}{14}\selectfont
       
   545 \texttt{\lstinputlisting{max.scala}}}
       
   546 
       
   547 \small
       
   548 \begin{textblock}{8}(1,3)
       
   549 {\bf\texttt{def}} starts a function definition
       
   550 \end{textblock}
       
   551 \begin{textblock}{8}(2.3,4)
       
   552 function name
       
   553 \end{textblock}
       
   554 \begin{textblock}{8}(3.8,5)
       
   555 parameter list in parentheses
       
   556 \end{textblock}
       
   557 \begin{textblock}{8}(6.5,6)
       
   558 function's result type
       
   559 \end{textblock}
       
   560 \begin{textblock}{8}(11,7)
       
   561 equal sign
       
   562 \end{textblock}
       
   563 \begin{textblock}{8}(9,10)
       
   564 function body\\ 
       
   565 in curly braces
       
   566 \end{textblock}
       
   567 
       
   568 \end{frame}}
       
   569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   570 
       
   571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   572 \mode<presentation>{
       
   573 \begin{frame}[c]
       
   574 
       
   575 {\lstset{language=Java}\fontsize{7}{8}\selectfont
       
   576 \texttt{\lstinputlisting{URLReader.java}}}
       
   577 
       
   578 \only<2>{
       
   579 \begin{textblock}{5}(12,2)
       
   580 \includegraphics[scale=0.50]{skeleton.jpg}\\
       
   581 \end{textblock}}
       
   582 \end{frame}}
       
   583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   584 
       
   585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   586 \mode<presentation>{
       
   587 \begin{frame}[t]
       
   588 \frametitle{\begin{tabular}{c}Map\end{tabular}}
       
   589 
       
   590 \begin{itemize}
       
   591 \item {\bf\texttt{map}} takes a function, say f, and applies it to every element of the list:
       
   592 \end{itemize}
       
   593 
       
   594 \begin{textblock}{15}(2,7)
       
   595 \fontsize{13}{14}\selectfont
       
   596 \bf\texttt{List(1, 2, 3, 4, 5, 6, 7, 8, 9)}
       
   597 \end{textblock}
       
   598 
       
   599 \begin{textblock}{15}(2,10)
       
   600 \fontsize{13}{14}\selectfont
       
   601 \bf\texttt{List(1, 4, 9, 16, 25, 36, 49, 64, 81)}
       
   602 \end{textblock}
       
   603 
       
   604 \end{frame}}
       
   605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   606 
       
   607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   608 \mode<presentation>{
       
   609 \begin{frame}<1-2>[t]
       
   610 \frametitle{\begin{tabular}{c}Filter\end{tabular}}
       
   611 
       
   612 \begin{itemize}
       
   613 \item {\bf\texttt{filter}} takes a condition, say p, and filters out all elements of the list not satisfying p:
       
   614 \end{itemize}
       
   615 
       
   616 \begin{textblock}{15}(2,7)
       
   617 \fontsize{13}{14}\selectfont
       
   618 \bf\texttt{List(1, 2, 3, 4, 5, 6, 7, 8, 9)}
       
   619 \end{textblock}
       
   620 
       
   621 \end{frame}}
       
   622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   623 
       
   624 
       
   625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   626 \mode<presentation>{
       
   627 \begin{frame}[c]
       
   628 \frametitle{\begin{tabular}{c}Conclusion\end{tabular}}
       
   629 
       
   630 \begin{itemize}
       
   631 \item Scala is still under development (compiler is slow)\medskip
       
   632 \item there are at least 5 books on the market\medskip
       
   633 \item {\bf\texttt{http://www.scala-lang.org/}}\medskip
       
   634 \item ``deep'' type-system (computer science)\bigskip\pause
       
   635 \item (for the lazy programmer)\\ programming in Scala is much more fun
       
   636 
       
   637 \end{itemize}
       
   638 \end{frame}}
       
   639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   640 
       
   641 
       
   642 \end{document}
       
   643 
       
   644 %%% Local Variables:  
       
   645 %%% mode: latex
       
   646 %%% TeX-master: t
       
   647 %%% End: 
       
   648