36 \begin{center} |
37 \begin{center} |
37 \begin{tabular}{ll} |
38 \begin{tabular}{ll} |
38 Email: & christian.urban at kcl.ac.uk\\ |
39 Email: & christian.urban at kcl.ac.uk\\ |
39 Office: & N\liningnums{7.07} (North Wing, Bush House)\\ |
40 Office: & N\liningnums{7.07} (North Wing, Bush House)\\ |
40 Slides \& Code: & KEATS\medskip\\ |
41 Slides \& Code: & KEATS\medskip\\ |
41 Office Hours: & Mondays 12:00 -- 14:00\\ |
42 Office Hours: & Thursdays 12:00 -- 14:00\\ |
42 & \alert{except next week: Tuesday} |
43 Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\ |
43 \end{tabular} |
44 \end{tabular} |
44 \end{center} |
45 \end{center} |
45 |
46 |
46 %\tiny |
47 %\tiny |
47 %developed since 2004 bv Martin Odersky |
48 %developed since 2004 bv Martin Odersky |
80 \end{tabular} |
81 \end{tabular} |
81 \end{textblock} |
82 \end{textblock} |
82 |
83 |
83 |
84 |
84 \begin{textblock}{6}(2,12) |
85 \begin{textblock}{6}(2,12) |
85 \begin{bubble}[9cm] |
86 \begin{bubble}[9.4cm] |
86 \small |
87 \small |
87 developed since 2004 by Martin Odersky\\ |
88 developed since 2004 by Martin Odersky |
88 (he was behind Generic Java which was included in Java 5 |
89 (he was behind Generic Java which was included in Java 5 |
89 \ldots I am using it maybe since 2008?) |
90 \ldots I am using Scala since maybe 2008?) |
90 \end{bubble} |
91 \end{bubble} |
91 \end{textblock} |
92 \end{textblock} |
92 |
93 |
93 \end{frame} |
94 \end{frame} |
94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
114 \begin{itemize} |
115 \begin{itemize} |
115 \item compiles to the JVM\\ |
116 \item compiles to the JVM\\ |
116 \textcolor{gray}{(also JavaScript, native X86 in the works)}\medskip |
117 \textcolor{gray}{(also JavaScript, native X86 in the works)}\medskip |
117 \item integrates seamlessly with Java\medskip |
118 \item integrates seamlessly with Java\medskip |
118 \item combines \underline{\bf functional} and {\bf object-oriented} programming\bigskip |
119 \item combines \underline{\bf functional} and {\bf object-oriented} programming\bigskip |
119 \item it is a bit on the ``mathematical'' side\\ |
120 \item it is a bit on the ``theory'' / ``mathematical'' side\\ |
120 \textcolor{gray}{(no pointers, no \texttt{null}, but expressions)} |
121 \textcolor{gray}{(no pointers, no \texttt{null}, but expressions)} |
121 |
122 |
122 \item often one can write very concise and elegant code |
123 \item often one can write very concise and elegant code |
123 \end{itemize}\bigskip\medskip |
124 \end{itemize}\bigskip\medskip |
124 |
125 |
125 \small |
126 %\small |
126 alternatives:\\ |
127 %alternatives:\\ |
127 Elm, Haskell, Ocaml, F$\sharp$, Erlang, ML, Lisp (Racket), \ldots |
128 %Elm, Haskell, Ocaml, F$\sharp$, Erlang, ML, Lisp (Racket), \ldots |
128 |
129 |
129 \end{frame} |
130 \end{frame} |
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
131 |
132 |
132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
133 \begin{frame}[c] |
134 \begin{frame}[t] |
134 \frametitle{Java vs Scala} |
135 \frametitle{Java vs Scala} |
135 |
136 |
136 {\lstset{language=java}\fontsize{12}{12}\selectfont |
137 {\lstset{language=java,numbers=right}\fontsize{12}{12}\selectfont |
137 \texttt{\lstinputlisting{Point.java}}} |
138 \texttt{\lstinputlisting{Point.java}}} |
138 |
139 |
139 \rule{11cm}{0.3mm}\\[-2mm] |
140 \rule{11cm}{0.3mm}\\[-3mm] |
140 |
141 |
141 {\lstset{language=scala}\fontsize{12}{12}\selectfont |
142 {\lstset{language=scala}\fontsize{12}{12}\selectfont |
142 \texttt{\lstinputlisting{Point.scala}}} |
143 \texttt{\lstinputlisting{Point.scala}}} |
143 |
144 |
144 \begin{textblock}{6}(13,3) |
145 \begin{textblock}{6}(13,3) |
145 \textbf{\large Java} |
146 \textbf{\large Java} |
146 \end{textblock} |
147 \end{textblock} |
147 |
148 |
148 \begin{textblock}{6}(13,13.6) |
149 \begin{textblock}{6}(13,14.3) |
149 \textbf{\large Scala} |
150 \textbf{\large Scala} |
150 \end{textblock} |
151 \end{textblock} |
151 |
152 |
152 \end{frame} |
153 \end{frame} |
153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
362 \end{textblock}} |
364 \end{textblock}} |
363 |
365 |
364 \only<3>{ |
366 \only<3>{ |
365 \begin{textblock}{14.2}(1,13.5) |
367 \begin{textblock}{14.2}(1,13.5) |
366 In FP: Once a variable is created, it is assigned a value and then |
368 In FP: Once a variable is created, it is assigned a value and then |
367 never changed again $\Rightarrow$ no synchronisation\smallskip\\ |
369 never changed again $\Rightarrow$ no synchronisation needed\smallskip\\ |
368 %%\small\textcolor{gray}{(Andrew's second favourite feature of C++)} |
370 %%\small\textcolor{gray}{(Andrew's second favourite feature of C++)} |
369 \end{textblock}} |
371 \end{textblock}} |
370 |
372 |
371 \end{frame} |
373 \end{frame} |
372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
460 \begin{frame}[c] |
462 \begin{frame}[c] |
461 \frametitle{Coursework} |
463 \frametitle{Coursework} |
462 |
464 |
463 \begin{itemize} |
465 \begin{itemize} |
464 \item Sorry, I might have been a bit wordy:\\ |
466 \item Sorry, I might have been a bit wordy:\\ |
465 CW description is 7 pages, but |
467 Part 6 of CW description is 7 pages, but |
466 I only needed \mbox{< 100} loc for \emph{all} the CW6.\bigskip |
468 I only needed \mbox{< 100} loc for \emph{all} Part 6.\bigskip |
467 |
469 |
468 \item there is email feedback when pushing code to github\medskip |
470 \item there is feedback when pushing code to github\medskip |
469 |
471 |
470 \item there are \texttt{jar}-files you can use to test my implementation\bigskip |
472 \item there are \texttt{jar}-files you can use to test my implementation\bigskip |
471 |
473 |
472 \item we want you to learn FP: \alert{\bf no vars}, no mutable |
474 \item we want you to learn FP!\\ \alert{\bf no vars}, no mutable |
473 data-structures, e.g.~no \texttt{Arrays}, no \texttt{ListBuffer} |
475 data-structures\\ e.g.~no \texttt{Arrays}, no \texttt{ListBuffer} |
474 \end{itemize} |
476 \end{itemize} |
475 \end{frame} |
477 \end{frame} |
476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
477 |
479 |
478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
487 |
489 |
488 {\small |
490 {\small |
489 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm] |
491 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm] |
490 val old_list = List(1, 2, 3, 5) |
492 val old_list = List(1, 2, 3, 5) |
491 val new_list = 0 :: old_list |
493 val new_list = 0 :: old_list |
|
494 // -> List(0, 1, 2, 3, 4, 5) |
492 \end{lstlisting}} |
495 \end{lstlisting}} |
493 |
496 |
494 \item You do not have to be defensive about who can access the data. |
497 \item You do not have to be defensive about who can access the data. |
495 |
498 |
496 \item You can look at your code in isolation. |
499 \item You can look at your code in isolation. |