%--*- latex -*-----------------------------------------------------------------
%$Author: saulius $
%$Date: 2020-06-04 14:58:32 +0300 (Thu, 04 Jun 2020) $ 
%$Revision: 1524 $
%$URL: svn+ssh://saulius-grazulis.lt/home/saulius/svn-repositories/seminarai/2020-verifikacjos-seminarui/slides.tex $
%------------------------------------------------------------------------------

\documentclass[mathserif,aspectratio=169]{beamer}
\usetheme{Warwick}
\useoutertheme{infolines}
\setbeamertemplate{headline}{} % removes the headline the infolines inserts
%\setbeamertemplate{footline}[frame number]
\renewcommand\familydefault{\rmdefault}
% For XeLaTeX:
% https://tex.stackexchange.com/questions/452151/how-do-i-render-the-word-v%C7%ABlundarkvi%C3%B0a-with-bookman-and-xelatex
% "Use an OpenType clone of Bookman, for instance TeX Gyre Bonum":
\usepackage{fontspec}
\setmainfont{TeX Gyre Bonum}

\usepackage[style=authoryear,maxnames=1,doi=true,url=true,backend=biber]{biblatex}
\addbibresource{bibliography/citations.bib}
\newcommand{\mycite}{\parencite}


\usepackage{colordvi}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usepackage{verbatim}
\usepackage{listings}
\usepackage{chemfig}
\usepackage{listings}

\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  citecolor=blue,
  urlcolor=blue
}

% https://en.wikibooks.org/wiki/LaTeX/Algorithms
% http://mirror.datacenter.by/pub/mirrors/CTAN/macros/latex/contrib/algorithmicx/algorithmicx.pdf
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{amssymb}

\include{commands}

\newcommand{\RCSid}[1]{\fontsize{7pt}{7pt}\selectfont $#1$ \today}


%%BEGIN LANGUAGE en
\title{Ada design principles}
%%END LANGUAGE en

\author{Saulius Gražulis}

\date{Vilnius, \the\year}

\begin{document}

%------------------------------------------------------------------------------

\begin{frame}
    \titlepage

\input{affiliation}
    
    \begin{center}
      \mbox{}
      \hfill\hfill\hfill
      \includegraphics[height=1.5cm]{images/sp_VU_zenklas.eps}
      \hfill
      \includegraphics[height=1.5cm]{images/2019-05-02_Melynas_MIF-zenklas242x244.png}
      \hfill\hfill\hfill
      \mbox{}
    \end{center}

    \vfill

    %% \tiny
    %% \RCSid{
    %%   $Id: slides.tex 1524 2020-06-04 11:58:32Z saulius $
    %% }
    \begin{flushright}
      \begin{minipage}[c]{0.67\textwidth}
        \tiny\raggedright
        %%BEGIN LANGUAGE en
        This set of slides may be copied and used as specified in the
        %%END LANGUAGE en
        \myhref{http://creativecommons.org/licenses/by-sa/4.0/}{Attribution-ShareAlike
          4.0 International}
license
      \end{minipage}
      %%
      \begin{minipage}[c]{1.5cm}
        \myhref{http://creativecommons.org/licenses/by-sa/4.0/}{
          \includegraphics[width=1.5cm]{images/CC-BY-SA.eps}
        }
      \end{minipage}
    \end{flushright}

\end{frame}

%==============================================================================

\begin{frame}
\frametitle{What is Ada}

  %%BEGIN LANGUAGE en
  Ada is a programming language with toolchain and ecosystem, which:
  %%END LANGUAGE en


  \vfill
  \begin{itemize}
    %%BEGIN LANGUAGE en
  \item Offer a safe and secure programming language;
  \item Are designed for large, long-lived applications;
  \item Are used where reliability and efficiency are essential;
  \item Provide readability, maintainability, portability;
    %%END LANGUAGE en
  \end{itemize}

  \vfill
  \vfill
  \scriptsize {
    \url{https://www.adaic.org/},
accessed
    2026-01-01T13:39+02:00
  }
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Features of Ada}

  %%BEGIN LANGUAGE en
  Ada is a compiled multi-paradgm language, strongly supporting
  procedural style.
  %%END LANGUAGE en


  \vfill
  \begin{itemize}
    %%BEGIN LANGUAGE en
  \item Statically strictly typed language;
  \item Compiled and optimised;
  \item Rich type system: abstractions to fit program domain;
  \item Generic programming/templates;
  \item Exception handling;
    %%END LANGUAGE en
  \end{itemize}

  \vfill
  \vfill

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Unique features of Ada}

  %%BEGIN LANGUAGE en
  Not widely supported in other programming languages:
  %%END LANGUAGE en


  \vfill
  
  \begin{itemize}
    %%BEGIN LANGUAGE en
  \item Concurrent programming support on the language level;
  \item Especially rich type system;
  \item Support for formal program verification (SPARK subset);
  \item Compatibility and usability with other languages and
    libraries;
    %%END LANGUAGE en
  \end{itemize}

  \vfill
  
  %%BEGIN LANGUAGE en
  Closest alternavies: C++, Rust;
  %%END LANGUAGE en

  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Ada application areas}

  %%BEGIN LANGUAGE en
  Main application areas: embedded mission-critical systems,
  scientific and engineering programming.

  Ada users:
  %%END LANGUAGE en


  \vfill
  \begin{itemize}
  \item Air Traffic Control (EuroControl)
  \item Aviation (Commercial, Defence) (Airbus, Eurocopter)
  \item Communications, Satellites and Receivers (Inmarsat)
  \item Defense Related Projects (Raytheon)
  \item Rail Transportation (French High-Speed Rail System (TGV))
  \item Financial Applications (BNP Paribas)
  \item Science (Lawrence Livermore National Labs, National Ignition
    Facility)
  \end{itemize}

  \vfill
  \vfill
  \scriptsize {
    \url{https://www.adaic.org/advantages/projects/}
accessed
    2026-01-01T21:45+02:00
  }
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Ada drawbacks}

  %%BEGIN LANGUAGE en
  In engineering, nearly everything you do is a compromise. Ada
  designers made comprimises, too.
  %%END LANGUAGE en


  \vfill
  \begin{itemize}
    %%BEGIN LANGUAGE en
  \item Complicated compiler;
  \item Need to get right everything before trying out anything;
  \item Run-time checks can create overheads;
  \item No required garbage collector – need to think about memory
    management;
    %%END LANGUAGE en
  \end{itemize}

\end{frame}

%------------------------------------------------------------------------------

\lstset{
  % Documentation:
  %
  % [1] https://www.overleaf.com/learn/latex/XeLaTeX [2026-01-01T19:47+02:00]
  %
  % [2] https://texdoc.org/serve/fontspec/0 [2026-01-01T19:48+02:00]
  %
  % [3] https://tug.org/FontCatalogue/luximono/ [2026-01-01T19:50+02:00]
  %
  % [4] https://www.latex-project.org/help/documentation/fntguide.pdf [2026-01-01T20:03+02:00]
  language=Ada,
  basicstyle=\footnotesize\ttfamily,
  % All of the followint lines worked:
  %% basicstyle=\setmainfont{Luxi Mono}
  %% keywordstyle=\setmainfont{Luxi Mono Bold},
  keywordstyle=\setmainfont{Luxi Mono}\fontsize{7.5}{7.5}\bfseries,
  %% keywordstyle=\setmainfont{Courier}\bfseries
  %% keywordstyle=\setmainfont{Courier New}\bfseries
}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Ada example}

  %%BEGIN LANGUAGE en
  A ``Hello, world'' in Ada:
  %%END LANGUAGE en


  \lstinputlisting[language=Ada]{examples/hello_world/ada_hello_world.adb}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{A slighly more interesting example}

  %%BEGIN LANGUAGE en
  A ``Hello, world'' in Ada with date and time:
  %%END LANGUAGE en


  \lstinputlisting[language=Ada]{examples/hello_world/ada_hello_date_time.adb}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Runtime checks}

  %%BEGIN LANGUAGE en
  Unlike C, Ada checks numeric overflows and numerous other conditions:
  %%END LANGUAGE en


  \only<1> {
    \lstinputlisting[language=Ada,linerange={1-17}]{examples/aliquot_sequences/ada_aliquot_sequence.adb}
  }
  \only<2> {
    \lstinputlisting[language=C,linerange={1-15}]{examples/aliquot_sequences/c_aliquot_sequence.c}
  }
  \only<3> {
    \lstinputlisting[language=Ada,linerange={30-42}]{examples/aliquot_sequences/ada_aliquot_sequence.adb}
  }
  \only<4> {
    \lstinputlisting[language=C,linerange={32-40}]{examples/aliquot_sequences/c_aliquot_sequence.c}
  }

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Run time behaviour}

  %%BEGIN LANGUAGE en
  \only<1-6>{
    C and Ada give identical answers, untill...
  }
  \only<7-8>{
    But wait, what's that? How come the sum becomes negative?
  }  
  %%END LANGUAGE en


  \only<1> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/c_aliquot_sequence_8.log}
  }
  \only<2> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/ada_aliquot_sequence_8.log}
  }
  \only<3> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/c_aliquot_sequence_15.log}
  }
  \only<4> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/ada_aliquot_sequence_24.log}
  }
  \only<5> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/ada_aliquot_sequence_28.log}
  }
  \only<6> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/ada_aliquot_sequence_30.log}
  }
  \only<7-8> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/c_aliquot_sequence_276.log}
  }
  \only<8-9> {
    \lstinputlisting[language=bash]{examples/aliquot_sequences/ada_aliquot_sequence_276.log}
  }
  \only<9> {
    \vspace{-0.5\baselineskip}
    \begin{center}
      \begin{minipage}{0.7\textwidth}
        \lstinputlisting[language=Ada,linerange={8-17},numbers=left,firstnumber=8,basicstyle=\scriptsize\tt]{examples/aliquot_sequences/ada_aliquot_sequence.adb}
      \end{minipage}
    \end{center}
  }  
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Consequences are not always bening}

  %%BEGIN LANGUAGE en
  %%END LANGUAGE en


  \begin{minipage}{0.55\textwidth}
    \includegraphics[width=\linewidth]{images/Explosion_of_first_Ariane_5_flight_June_4_1996.jpg}
  \end{minipage}
  \hspace{1ex}
  \begin{minipage}{0.4\textwidth}
    \raggedright
    %%BEGIN LANGUAGE en
    Integer overflow lead to an exception on Ariane 5...
    %%END LANGUAGE en

    \rule{0pt}{2cm}

    %%BEGIN LANGUAGE en
    (Despite this setback, Arian is one of the most reliable carriers)
    %%END LANGUAGE en
  \end{minipage}
  
  \vfill

  {
    \scriptsize \url{https://www.esa.int/ESA_Multimedia/Images/2009/09/Explosion_of_first_Ariane_5_flight_June_4_1996}
  }
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Useful links}

  \footnotesize

Ada books:
  \url{https://bookauthority.org/books/best-ada-books}
  
  \vfill
Open-access Ada books from AdaCore:
  \url{https://learn.adacore.com/}

  \vfill
  \begin{center}
    \includegraphics[height=0.5\textheight]{images/ada-books.png}
  \end{center}
  
\end{frame}

%------------------------------------------------------------------------------

\setbeamertemplate{footline}{
  \tiny
  \rule[-0.4\baselineskip]{0pt}{1.2\baselineskip}
  \hspace{1ex}
  {\em
    A path to freedom: 
    GNU $\rightarrow$
    Linux $\rightarrow$
    Ubuntu $\rightarrow$
    MySQL $\rightarrow$
    R $\rightarrow$
    \LaTeX $\rightarrow$
    TikZ $\rightarrow$
    Dia $\rightarrow$
    Beamer
  }
}
  
\begin{frame}

\centerline{\Large Questions?}

  \vfill

  \begin{centering}
    %% \includegraphics[height=3cm]{images/Sphalerite-Quartz-261762.eps.gz}
      \begin{tabbing}
        \hspace{8mm} \=
        \includegraphics[width=4cm]{images/topaz-picture.png} \=
        \hspace{1cm} \=
        \includegraphics[width=5cm]{images/topaz-structure.png} \\
        \>
        \tiny
        \mywebref{http://en.wikipedia.org/wiki/Topaz} \> \>
        \tiny
        \mywebref{http://www.crystallography.net/2207377.html} \\
      \end{tabbing}
  \end{centering}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}%%[allowframebreaks]
\frametitle{References}

  %%\scriptsize
  %%\bibliographystyle{plain}

  %%\bibliographystyle{apalike}
  %%\bibliography{bibliography/citations}
  \renewcommand{\bibfont}{\scriptsize}
  \printbibliography

\end{frame}

%------------------------------------------------------------------------------

\end{document}
% 2026-01-10 16:59:50 EET
