diff --git a/Lectures/L24_SpecificationQuality/SpecificationQuality.pdf b/Lectures/L24_SpecificationQuality/SpecificationQuality.pdf index ed786ac0e49d96f66a22cf2b8630261db6816728..858cb629ddbefa0eb8ff9a1d62fe45b00a5e6cac 100644 Binary files a/Lectures/L24_SpecificationQuality/SpecificationQuality.pdf and b/Lectures/L24_SpecificationQuality/SpecificationQuality.pdf differ diff --git a/Lectures/L24_SpecificationQuality/SpecificationQuality.tex b/Lectures/L24_SpecificationQuality/SpecificationQuality.tex index 704fa43ec48e69a27eaa67a913a8f49935c714cd..e8a82456a78476ec017044c7164fc5eca8c61423 100755 --- a/Lectures/L24_SpecificationQuality/SpecificationQuality.tex +++ b/Lectures/L24_SpecificationQuality/SpecificationQuality.tex @@ -1,5 +1,5 @@ -%\documentclass[t,12pt,numbers,fleqn,handout]{beamer} -\documentclass[t,12pt,numbers,fleqn]{beamer} +\documentclass[t,12pt,numbers,fleqn,handout]{beamer} +%\documentclass[t,12pt,numbers,fleqn]{beamer} \usepackage{pgfpages} \usepackage{hyperref} @@ -107,6 +107,33 @@ TBD %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}[plain,fragile] +%\frametitle{Line Formatter Example} +%With different versions of MAXPOS +\begin{verbatim} +Lorem BL ipsum BL NL dolor BLBLBL sit BL amet, BL +consectetur.ET + +Lorem ipsum dolor sit +amet, consectetur.ET + +Lorem ipsum +dolor sit +amet, +consectetur.ET + +Lorem +ipsum +dolor +sit +amet, +consectetur.ET +\end{verbatim} + +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \begin{frame} \frametitle{Line Formatter} @@ -162,15 +189,43 @@ successive NL characters) \begin{frame} \frametitle{Abstract?} -\uncover<2->{ \bi -\item Not abstract! +\item \structure{Input} stream signalled with ET +\item Exactly one ET character in each input stream +\item \structure{Character} classifications: +\bi +\item Break character - BL (blank) and NL (new line) +\item Non Break Character - all others except ET +\item End of text indicator ET +\ei +\item \structure{Word} is a non-empty sequence of non break characters +\item \structure{Break} is a sequence of one or more break characters +\item \structure{Output} same sequence of words, except if there is an oversize + word +\bi +\item Oversize means more than MAXPOS characters, where MAXPOS is a positive + integer +\item If there is an oversize word +\bi +\item Set Alarm to TRUE +\item Exit the program +\ei +\ei +\ei +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Not Abstract} + +\bi \item Specifies an implementation for error handling (variable named Alarm) \item Do not have to name the variable Alarm \item Could use exception handling (or another approach) instead -\item ET is a machine dependent (program domain) concept +\item ET is a machine dependent (program domain) concept - abstractly, the input + is simply a finite sequence of characters \ei -} \end{frame} @@ -179,15 +234,34 @@ successive NL characters) \begin{frame} \frametitle{Correct?} -\uncover<2->{ \bi -\item The definition of line is incorrect! +\item Up to the point of an error, the program's output should have the + following properties +\bi +\item A new line should start only between words and at the beginning of the +output text, if any + +\item A break in the input is reduced to a single break character in the output + +\item As many words as possible should be placed on each line (i.e.\ between +successive NL characters) + +\item No line may contain more than MAXPOS characters (words and BLs) +\ei +\ei +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Incorrect!} + +\bi \item A line is defined as being between NLs, which ignores text before the first NL and after the last NL \item The output file does not contain ET, which is either a bug in the spec or a significant non-uniformity \ei -} \end{frame} @@ -196,12 +270,33 @@ successive NL characters) \begin{frame} \frametitle{Unambiguous?} -\uncover<2->{ \bi -\item Ambiguous! +\item Up to the point of an error, the program's output should have the + following properties +\bi +\item A new line should start only between words and at the beginning of the +output text, if any + +\item A break in the input is reduced to a single break character in the output + +\item As many words as possible should be placed on each line (i.e.\ between +successive NL characters) + +\item No line may contain more than MAXPOS characters (words and BLs) +\ei +\ei +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Ambiguous!} + +\bi +\item ``output text, if any'' \item ``point of error'' is not defined \item Output matches input to the last acceptable word, or the last acceptable character? -\item ``trailing blanks ending with ET'' is ambiguous +\item ``trailing blanks ending with ET'' is ambiguous (trailing means at the end!) \item The program's output should be the same sequence of words as in the input \bi \item But the input is not a sequence of words @@ -214,7 +309,6 @@ successive NL characters) \ei \ei \ei -} \end{frame} @@ -223,13 +317,41 @@ successive NL characters) \begin{frame} \frametitle{Complete?} -\uncover<2->{ \bi -\item Not complete! -\item Meaning of NL and its relation to the concept of line is left implicit +\item \structure{Input} stream signalled with ET +\item Exactly one ET character in each input stream +\item \structure{Character} classifications: +\bi +\item Break character - BL (blank) and NL (new line) +\item Non Break Character - all others except ET +\item End of text indicator ET +\ei +\item \structure{Word} is a non-empty sequence of non break characters +\item \structure{Break} is a sequence of one or more break characters +\item \structure{Output} same sequence of words, except if there is an oversize + word +\bi +\item Oversize means more than MAXPOS characters, where MAXPOS is a positive + integer +\item If there is an oversize word +\bi +\item Set Alarm to TRUE +\item Exit the program +\ei +\ei +\ei +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Not Complete} + +\bi +\item Meaning of NL and its relation to the concept of line is left implicit - + seem to expect that NL means carriage return on output, but they do not say this \item Alarm is not specified if MAXPOS is never exceeded \ei -} \end{frame} @@ -238,7 +360,36 @@ successive NL characters) \begin{frame} \frametitle{Consistent?} -\uncover<2->{ +\bi +\item \structure{Input} stream signalled with ET +\item Exactly one ET character in each input stream +\item \structure{Character} classifications: +\bi +\item Break character - BL (blank) and NL (new line) +\item Non Break Character - all others except ET +\item End of text indicator ET +\ei +\item \structure{Word} is a non-empty sequence of non break characters +\item \structure{Break} is a sequence of one or more break characters +\item \structure{Output} same sequence of words, except if there is an oversize + word +\bi +\item Oversize means more than MAXPOS characters, where MAXPOS is a positive + integer +\item If there is an oversize word +\bi +\item Set Alarm to TRUE +\item Exit the program +\ei +\ei +\ei +\end{frame} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{frame} +\frametitle{Not Consistent} + \bi \item Not consistent! \item ``non-empty'' and ``one or more'' (synonyms) @@ -246,7 +397,6 @@ successive NL characters) \item Is the input a ``stream of characters'' or a ``sequence of words separated by breaks''? -- sequence of T is not the same as sequence of sequence of T \ei -} \end{frame} @@ -269,7 +419,7 @@ successive NL characters) \frametitle{Advantages and Disadvantages?} \bi -\item \structure{Advantages and disadvantages of maintaining both +\item \structure<1>{Advantages and disadvantages of maintaining both formal and a natural language spec?} \ei @@ -300,9 +450,11 @@ successive NL characters) \begin{frame} \frametitle{English and Mathematics as Languages} -\begin{itemize} +See +\href{https://gitlab.cas.mcmaster.ca/smiths/se2aa4_cs2me3/blob/master/ReferenceMaterial/Baber2002.pdf} +{Baber2002}\\ -\item From Dr. Baber, add link +\begin{itemize} \item English is a language \item So is Mathematics \item Both have @@ -476,7 +628,8 @@ successive NL characters) \begin{itemize} -\item When writing in English or any other natural language, one pays careful attention to +\item When writing in English, or any other natural language, one pays careful + attention to \begin{itemize} \item Organization of the essay, report, etc. \item Style of expression