Skip to content
Snippets Groups Projects
Commit d4f5838d authored by W. Spencer Smith's avatar W. Spencer Smith
Browse files

Changes to T4 slides to fix some of the specification syntax

parent 44b43f5b
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -130,8 +130,8 @@ McMaster University\\ } ...@@ -130,8 +130,8 @@ McMaster University\\ }
\frametitle{What is a MIS?} \frametitle{What is a MIS?}
\begin{itemize} \item Module Interface Specification \begin{itemize} \item Module Interface Specification
\item Specifices externally observable behaviour of a module \item Specifices externally observable behaviour of a module
\item Not in language of implementation, but uses mathematical and application language \item Not in language of implementation, uses mathematical language
\item Internal implementations are not included in a MIS \item Implementation details are not included in the MIS
\end{itemize} \end{itemize}
\end{frame} \end{frame}
...@@ -193,7 +193,7 @@ McMaster University\\ } ...@@ -193,7 +193,7 @@ McMaster University\\ }
Consider the following triangle: Consider the following triangle:
\begin{figure}[h] \begin{figure}[h]
\centering \centering
\includegraphics[width=0.5\textwidth]{triangle.png} % \includegraphics[width=0.5\textwidth]{triangle.png}
\end{figure} \end{figure}
We are using the following inequality which is called inequality equation to know the possibility of having triangle with three points A, B and C: We are using the following inequality which is called inequality equation to know the possibility of having triangle with three points A, B and C:
...@@ -233,7 +233,7 @@ N/A ...@@ -233,7 +233,7 @@ N/A
\textbf{Syntax}\\ \textbf{Syntax}\\
Exported Types: Exported Types:
\newline \newline
pointT = ? PointT = ?
\end{frame} \end{frame}
...@@ -248,13 +248,13 @@ pointT = ? ...@@ -248,13 +248,13 @@ pointT = ?
\hline \hline
\textbf{Routine name} & \textbf{In} & \textbf{Out} & \textbf{Exceptions}\\ \textbf{Routine name} & \textbf{In} & \textbf{Out} & \textbf{Exceptions}\\
\hline \hline
init & real, real & pointT & ~\\ new PointT & real, real & PointT & ~\\
\hline \hline
xcoord & ~ & real & ~\\ xcoord & ~ & real & ~\\
\hline \hline
ycoord & ~ & real & ~\\ ycoord & ~ & real & ~\\
\hline \hline
dist & pointT & real & ~\\ dist & PointT & real & ~\\
\hline \hline
\end{tabular} \end{tabular}
...@@ -277,10 +277,7 @@ None ...@@ -277,10 +277,7 @@ None
~\newline ~\newline
\textbf{Assumptions} \textbf{Assumptions}
init() is called for each abstract object before any other access routine is called for that object None
\end{frame} \end{frame}
...@@ -294,7 +291,7 @@ init() is called for each abstract object before any other access routine is cal ...@@ -294,7 +291,7 @@ init() is called for each abstract object before any other access routine is cal
\textbf{Access Routine Semantics}\\ \textbf{Access Routine Semantics}\\
init($x, y$): PointT($x, y$):
\begin{itemize} \begin{itemize}
\item transition: $xc, yc := x, y$ \item transition: $xc, yc := x, y$
\item output: $out := \mathit{self}$ \item output: $out := \mathit{self}$
...@@ -319,17 +316,11 @@ init($x, y$): ...@@ -319,17 +316,11 @@ init($x, y$):
\item exception: none \item exception: none
\end{itemize} \end{itemize}
\end{frame} \end{frame}
% -------------------------------------------------- % --------------------------------------------------
\begin{frame}[fragile] \begin{frame}[fragile]
\frametitle{MIS Interface} \frametitle{MIS Interface}
...@@ -369,16 +360,6 @@ From the MIS we can deduce the interface of the code will look like: ...@@ -369,16 +360,6 @@ From the MIS we can deduce the interface of the code will look like:
% -------------------------------------------------- % --------------------------------------------------
%
%
%
%
%
%
% --------------------------------------------------
\subsection{TriangleADT Module } \subsection{TriangleADT Module }
\begin{frame} \begin{frame}
\frametitle{TriangleADT } \frametitle{TriangleADT }
...@@ -406,13 +387,13 @@ TriangleADT = ?\\ ...@@ -406,13 +387,13 @@ TriangleADT = ?\\
\tabcolsep=0.09cm \tabcolsep=0.09cm
\begin{tabular}{| l | l | l | l |} \begin{tabular}{| l | l | l | l |}
\hline \hline
\textbf{Routine name} & \textbf{In} & \textbf{Out} & \textbf{Exceptions}\\ \textbf{Routine name} & \textbf{In} & \textbf{Out} & \textbf{Except.}\\
%\hline %\hline
%init & \multirow{2}{*}{Note 1} & Triangle & \\ \cline{1-3} %init & \multirow{2}{*}{Note 1} & Triangle & \\ \cline{1-3}
\hline \hline
init & pointT,pointT,pointT&TriangleADT & ~\\ new TriangleT & PointT, PointT, PointT&TriangleADT & ~\\
\hline \hline
sides & & &~\\ sides & & seq[3] of real &~\\
\hline \hline
inequality\char`_theorem & ~ & boolean & LINE~\\ inequality\char`_theorem & ~ & boolean & LINE~\\
\hline \hline
...@@ -432,97 +413,82 @@ area\char`_of\char`_triangle & & real & LINE ~\\ ...@@ -432,97 +413,82 @@ area\char`_of\char`_triangle & & real & LINE ~\\
State Variables: State Variables:
$p1$: pointT\\ $p1$: PointT\\
$p2$: pointT\\ $p2$: PointT\\
$p3$: pointT\\ $p3$: PointT\\
$AB$: real\\
$AC$ : real\\
$BC$ : real\\
~\newline ~\newline
\textbf{State Invariant} \textbf{State Invariant}
None None
~\newline ~\newline
\textbf{Assumptions} \textbf{Assumptions}
init() is called for each abstract object before any other access routine is called for that object None
\end{frame} \end{frame}
% -------------------------------------------------- % --------------------------------------------------
\begin{frame} \begin{frame}
\textbf{Access Routine Semantics}\\ \textbf{Access Routine Semantics}\\
init($p1, p2, p3$): new TriangleT($a, b, c$):
\begin{itemize} \begin{itemize}
\item transition: $a, b, c := p1, p2, p3$ \item transition: $p1, p2, p3 := a, b, c$
\item output: $out := \mathit{self}$ \item output: $out := \mathit{self}$
\item exception: none \item exception: none
\end{itemize} \end{itemize}
\noindent sides(): \noindent sides():
\begin{itemize} \begin{itemize}
\item transition: $AB, AC, BC := pointT.dist(self.a,self.b),$ \item output: $out := [p1.dist(p2), p1.dist(p3), p2.dist(p3)]$
\\ $pointT.dist(slef.a,self.c), pointT.dist(self.b,self.c)$
\item output: $out := \mathit{self}$
\item exception: none \item exception: none
\end{itemize} \end{itemize}
\end {frame} \end {frame}
% --------------------------------------------------
\begin {frame} \begin {frame}
\noindent inequality theorem(): \noindent inequality\_theorem():
\begin{itemize} \begin{itemize}
\item output: $$out := \mathrm {(self.AB +self.AC > self.BC\quad and \quad self.AB+self.BC }$$ \item output:
$$ \mathrm {> self.AC\quad and\quad self.AC+self.BC >self.AB)}$$ $out := ((self.sides[0] + self.slide[1]) > self.sides[2]$
$\wedge (self.sides[1] + self.slide[2]) > self.sides[0]$
$\wedge (self.sides[0] + self.slide[2]) > self.sides[1]$)
\item exception: \item exception:
\\ ex := ((self.a.xcoord()==self.b.xcoord() ==self.c.xcoord() or \\ ex := ((p1.xcoord()==p2.xcoord() ==p3.xcoord() $\vee$
\\ self.a.ycoord()==self.b.ycoord() ==self.c.ycoord()) $\Rightarrow \mbox{LINE})$ \\ p1.ycoord()==p2.ycoord() ==p3.ycoord()) $\Rightarrow \mbox{LINE})$
\end{itemize} \end{itemize}
\end{frame} \end{frame}
% -------------------------------------------------- % --------------------------------------------------
\begin{frame} \begin{frame}
\noindent perimeter of triangle($ $): \noindent perimeter\_of\_triangle($ $):
\begin{itemize} \begin{itemize}
\item output: $$out := \mathrm{self.AB+self.AC+self.BC}$$ \item output: $$out := self.sides[0]+self.sides[1]+self.sides[2]$$
\item exception: \item exception:
\\ ex := ((self.a.xcoord()==self.b.xcoord() ==self.c.xcoord() or \\ ex := ((p1.xcoord()==p2.xcoord() ==p3.xcoord() $\vee$
\\ self.a.ycoord()==self.b.ycoord() ==self.c.ycoord()) $\Rightarrow \mbox{LINE})$ \\ p1.ycoord()==p2.ycoord() ==p3.ycoord()) $\Rightarrow \mbox{LINE})$
\end{itemize} \end{itemize}
\noindent area of triangle($ $): \noindent area of triangle($ $):
\begin{itemize} \begin{itemize}
\item output : $$out :=\mathit {\sqrt[2]{P/2(P/2-self.AB)(P/2-self.AC)(P/2-self.BC)}}$$ \item output : $out :=$
${\sqrt[2]{P/2(P/2-self.sides[0])(P/2-self.sides[1])(P/2-self.sides[2])}}$
\item exception: \item exception:
\\ ex := ((self.a.xcoord()==self.b.xcoord() ==self.c.xcoord() or \\ ex := ((p1.xcoord()==p2.xcoord() ==p3.xcoord() $\vee$
\\ self.a.ycoord()==self.b.ycoord() ==self.c.ycoord()) $\Rightarrow \mbox{LINE})$ \\ p1.ycoord()==p2.ycoord() ==p3.ycoord()) $\Rightarrow \mbox{LINE})$
\end{itemize} \end{itemize}
\textbf{Local Constants}\\ \textbf{Local Function}\\
P := self.AB+self.AC+self.BC P := perimeter\_of\_triangle( )
\end{frame} \end{frame}
% -------------------------------------------------- % --------------------------------------------------
\begin{frame}[fragile] \begin{frame}[fragile]
\frametitle{MIS Interface} \frametitle{MIS Interface}
...@@ -548,7 +514,6 @@ From the MIS we can deduce the interface of the code will look like: ...@@ -548,7 +514,6 @@ From the MIS we can deduce the interface of the code will look like:
\end{lstlisting} \end{lstlisting}
\end{frame} \end{frame}
% -------------------------------------------------- % --------------------------------------------------
...@@ -559,14 +524,10 @@ From the MIS we can deduce the interface of the code will look like: ...@@ -559,14 +524,10 @@ From the MIS we can deduce the interface of the code will look like:
\textbf{See TriangleADT for implementation.}\\ \textbf{See TriangleADT for implementation.}\\
\end{center} \end{center}
\end{frame} \end{frame}
% -------------------------------------------------- % --------------------------------------------------
% -----------------------------------------------------
\begin{frame} \begin{frame}
\frametitle{Implementation files} \frametitle{Implementation files}
\begin{itemize} \begin{itemize}
...@@ -575,6 +536,4 @@ From the MIS we can deduce the interface of the code will look like: ...@@ -575,6 +536,4 @@ From the MIS we can deduce the interface of the code will look like:
\end{frame} \end{frame}
\end{document} \end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment