Chapter 2 reviewed

This commit is contained in:
Sergio Pérez 2019-12-03 21:52:07 +00:00
parent fbd0f679b5
commit 566ed59a0e
2 changed files with 33 additions and 21 deletions

View file

@ -199,10 +199,18 @@ dependencies are \added{represented with }black \added{arcs}, data dependencies
\caption{A simple multiplication program, its CFG, PDG and SDG} \caption{A simple multiplication program, its CFG, PDG and SDG}
\label{fig:basic-graphs} \label{fig:basic-graphs}
\end{figure} \end{figure}
\sergio{nose si vale la pena poner la Figure~\ref{fig:basic-graphs} aqui, no hemos contado aun como se genera, sino que se genera y se supone que se cuenta mas adelante, tal vez sea mas util hacer referencia forward solo y no poner esta figura aqui, sino mas adelante. Plantearselo}
\subsection{Metrics} \subsection{Metrics}
\sergio{Metrics o slicing indicators/features? }
There are four relevant metrics considered when evaluating a slicing algorithm: There are four relevant metrics considered when evaluating a slicing algorithm:
\sergio{Se me hace muy escueto esto, yo meteria algo de bullshit como dice Tama.}
\sergio{PROPOSAL:}
\sergio{In the area of program slicing, there are many different slicing techniques and tools implementing them. This fact has created the necessity to classify them by defining a set of different metrics. These metrics are commonly associated to some features of the generated slices. In the following, we list the most relevant metrics considered when evaluating a program slice:}
\begin{description} \begin{description}
\item[Completeness.] The solution includes all the statements that affect \item[Completeness.] The solution includes all the statements that affect
@ -219,23 +227,25 @@ There are four relevant metrics considered when evaluating a slicing algorithm:
commercially available) for most popular programming languages, from C++ commercially available) for most popular programming languages, from C++
to Erlang. Some slicing techniques only cover a subset of the targeted to Erlang. Some slicing techniques only cover a subset of the targeted
language, and as such are less useful for commercial applications, but language, and as such are less useful for commercial applications, but
can be a stepping stone in the betterment of the field. can be a stepping stone in the betterment of the field.\sergio{Tambien estan las valen para todos los lenguajes, ORBS entraria en ese caso no Josep?}
\item[Speed.] Speed of graph generation and slice creation. As previously \item[Speed.] Speed of graph generation and slice creation. As previously
stated, slicing is a two-step process: building a graph and traversing it. stated, slicing is a two-step process: building a graph and traversing it \sergio{esta frase hace parece que hacer slicing es dibujo libre... darle algo de importancia hablando de traducir el codigo a una representacion en forma de grafo con un estructura de datos compleja bla bla bla...}.
The traversal is a linear two--pass analysis of a graph in most proposals, with small variations. The traversal is a linear two--pass analysis of a graph in most proposals, with small variations.
Graph generation tends to be a longer process, but it is not as Graph generation tends to be a longer process, but it is not as
relevant, because it is only done once (per program being analyzed), making this the least important metric. relevant, because it is only done once (per program being analyzed), making this the least important metric. \sergio{Puedes anyadir que aunque la metrica del proceso de generacion no se suele tener muy en cuenta, esta existe porque es donde hay que hacer el analisis mas costoso sobre el programa y tal... relleno a saco! Que parece que no tiene ni merito generar el grafo :(}
Only proposals that deviate from the aforementioned schema of building a graph and traversing it show a wider variation in speed. Only proposals that deviate from the aforementioned schema of building a graph and traversing it show a wider variation in speed.
\end{description} \end{description}
\subsection{Program slicing as a debugging technique} \subsection{Program slicing as a debugging technique}
Program slicing is first and foremost a debugging technique, having each \sergio{Soy pesado pero esto se me vuelve a hacer muy corto :/. Retoco esto un poco}
variation a different purpose:
\added{As stated before, there are many uses for program slicing: program specialization, software maintenance, code obfuscation... but there is no doubt that p}\deleted{P}rogram slicing is first and foremost a debugging technique\added{.} \deleted{, having e}\added{E}ach\deleted{variation}\added{configuration of different dimensions serves} a different purpose:
\begin{description} \begin{description}
\item[Backward static.] Used to obtain the lines that affect a statement, \item[Backward static.] Used to obtain the lines that affect a statement,
normally used on a line which outputs an incorrect value, to narrow down normally used on a line which outputs an incorrect value, to narrow\sergio{track?} down
the source of the bug. the source of the bug.
\item[Forward static.] Used to obtain the lines affected by a statement, \item[Forward static.] Used to obtain the lines affected by a statement,
used to identify dead code, to check the effects a line has on the rest used to identify dead code, to check the effects a line has on the rest
@ -246,7 +256,7 @@ variation a different purpose:
limits the slice to an execution log, only including statements that limits the slice to an execution log, only including statements that
have run in a specific execution. The slice produced is much smaller and have run in a specific execution. The slice produced is much smaller and
useful. useful.
\item[Quasi--static.] Some input values are given, and some are left \item[Quasi--static.] \added{In this slicing method s}\deleted{S}ome input values are given, and some are left
unspecified: the result is a slice between the small dynamic slice and unspecified: the result is a slice between the small dynamic slice and
the general but bigger static slice. It can be specially useful when the general but bigger static slice. It can be specially useful when
debugging a set of function calls which have a specific static input for debugging a set of function calls which have a specific static input for
@ -257,18 +267,19 @@ variation a different purpose:
source of the bug. source of the bug.
\item \item
\carlos{añadir más quizá???} \carlos{añadir más quizá???}
\sergio{a mi me parecen suficientes, puedes decir una frasecita de 2 o 3 lineas diciendo que hay mas y algun uso de alguno de los otros que queden asi a lo general, pero yo los veo suficientes.}
\end{description} \end{description}
\section{Exception handling in Java} \section{Exception handling in Java}
\label{sec:intro-exception} \label{sec:intro-exception}
Exception handling is common in most modern programming languages. In Java, it Exception handling is common in most modern programming languages. \added{Exception handling generally consists in a set of statements that modify the normal execution flow noticing the existence of an abnormal program behaviour (controlled or not), and can be handled manually by the programmer or automatically by the system, depending on the programming language. In our work we focus on the Java programming language, so in the following, we describe the elements that Java uses to represent and handle exceptions:} \deleted{In Java, it
consists of the following elements: consists of the following elements:}
\begin{description} \begin{description}
\item[Throwable.] An interface that encompasses all the exceptions or errors \item[Throwable.] An interface that encompasses all the exceptions or errors
that may be thrown. Its child classes are \texttt{Error} for internal errors in the Java Virtual Machine and \texttt{Exception} for normal errors. that may be thrown. Its child classes are \texttt{Error} for internal errors in the Java Virtual Machine and \texttt{Exception} for normal errors.
Exceptions can be classified as \textsl{unchecked} Exceptions can be classified as \textsl{unchecked}
(those that extend \texttt{RuntimeException} or \texttt{Error}) and (those that extend \texttt{RuntimeException}\sergio{se sale esto de la linea por el texttt} or \texttt{Error}) and
\textsl{checked} (all others, may inherit from \texttt{Throwable}, but typically they do so from \texttt{Exception}). The first kind may be thrown anywhere without warning, whereas \textsl{checked} (all others, may inherit from \texttt{Throwable}, but typically they do so from \texttt{Exception}). The first kind may be thrown anywhere without warning, whereas
the second, if thrown, must be either caught in the same method or declared in the method header. the second, if thrown, must be either caught in the same method or declared in the method header.
\item[throws.] A statement that activates an exception, altering the normal \item[throws.] A statement that activates an exception, altering the normal
@ -285,7 +296,7 @@ consists of the following elements:
catches. Optionally, after the \textsl{catch} clauses a \textsl{finally} catches. Optionally, after the \textsl{catch} clauses a \textsl{finally}
block may appear. block may appear.
\item[catch.] Contains two elements: a variable declaration (the type must \item[catch.] Contains two elements: a variable declaration (the type must
be an exception) and a block of statements to be executed when an be an exception \sergio{exception o exception type?}) and a block of statements to be executed when an
exception of the corresponding type (or a subtype) is thrown. exception of the corresponding type (or a subtype) is thrown.
\textsl{catch} clauses are processed sequentially, and if any matches \textsl{catch} clauses are processed sequentially, and if any matches
the type of the thrown exception, its block is executed, and the rest the type of the thrown exception, its block is executed, and the rest
@ -304,6 +315,7 @@ consists of the following elements:
the program will end. Otherwise, the execution continues in the next the program will end. Otherwise, the execution continues in the next
statement after the \textsl{try-catch-finally} block. statement after the \textsl{try-catch-finally} block.
\end{description} \end{description}
\sergio{Me han molao las explicaciones, se entiende muy bien como funciona Java, parece que sea hasta facil de usar :D}
\footnotetext{Introduced in Java 7, see \url{https://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html} for more details.} \footnotetext{Introduced in Java 7, see \url{https://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html} for more details.}
@ -320,7 +332,7 @@ Overflow\footnote{\url{https://stackoverflow.com}}. The survey contains a
question about the technologies used by professional developers in their work, question about the technologies used by professional developers in their work,
and from that list we have extracted those languages with more than $5\%$ usage and from that list we have extracted those languages with more than $5\%$ usage
in the industry. Table~\ref{tab:popular-languages} shows the list and its in the industry. Table~\ref{tab:popular-languages} shows the list and its
source. Except Bash, Assembly, VBA, C and G, the rest of the languages shown source. Except Bash, Assembly, VBA, C and G,\sergio{Bash y companyia no tienen mecanismo de exception handling? o no se parece al de Java? No queda claro en esta frase} the rest of the languages shown
feature an exception system similar to the one appearing in Java. feature an exception system similar to the one appearing in Java.
\begin{table} \begin{table}
@ -368,20 +380,19 @@ featuring a \texttt{throw} statement (\texttt{raise} in Python), try-catching
structure and most include a finally block that may be appended to try blocks. structure and most include a finally block that may be appended to try blocks.
The difference resides in the value passed by the exception, which in languages The difference resides in the value passed by the exception, which in languages
that feature inheritance it is a class descending from a generic error or that feature inheritance it is a class descending from a generic error or
exception, and in languages without it, it is an arbitrary value (e.g. exception, and in languages without it\sergio{este ``it" se refiere a inheritance? pon algun objeto y elimina algun it porque hay muchos y me lian xD}, it is an arbitrary value (e.g.
JavaScript, TypeScript). In object--oriented programming, the filtering is JavaScript, TypeScript). In object--oriented programming, the filtering is
performed by comparing if the exception is a subtype of the exception being performed by comparing if the exception is a subtype of the exception being
caught (Java, C++, C\#, PowerShell\footnotemark, etc.); and in languages with caught (Java, C++, C\#, PowerShell\footnotemark, etc.); and in languages with
arbitrary exception values, a boolean condition is specified, and the first arbitrary exception values, a boolean condition is specified, and the first
catch block that fulfills its condition is activated, in following a pattern catch block that fulfills its condition is activated, in following\sergio{in following o following?} a pattern
similar to that of \texttt{switch} statements (e.g. JavaScript). In both cases similar to that of \texttt{switch} statements (e.g. JavaScript). In both cases
there exists a way to indicate that all exceptions should be caught, regardless there exists a way to indicate that all exceptions should be caught, regardless
of type and content. of type and content.
\footnotetext{Only since version 2.0, released with Windows 7.} \footnotetext{Only since version 2.0, released with Windows 7.}
On the other hand, in the other languages there exist a variety of systems that On the other hand, in \deleted{the other languages } \sergio{``the other languages" es muy vago}\added{those languages that do not offer explicit exception handling mechanisms,} \deleted{there exist a variety of systems that emulate or replace exception handling:}\added{this feature is covered by a variety of systems that emulate or replace their behaviour:}
emulate or replace exception handling:
\begin{description} % bash, vba, C and Go exceptions explained \begin{description} % bash, vba, C and Go exceptions explained
\item[Bash.] The popular Bourne Again SHell features no exception system, apart \item[Bash.] The popular Bourne Again SHell features no exception system, apart
@ -454,11 +465,11 @@ double safe_sqrt(double x, int ref) {
function has ended or when a \texttt{panic} has been activated--- and function has ended or when a \texttt{panic} has been activated--- and
\texttt{recover} ---stops the panic state and retrieves its value. The \texttt{recover} ---stops the panic state and retrieves its value. The
\texttt{defer} statement doubles as catch and finally, and multiple \texttt{defer} statement doubles as catch and finally, and multiple
instances can be accumulated. When appropriate, they will run in LIFO order instances can be accumulated. When appropriate, they will run in LIFO\deleted{order}
(Last In--First Out). (Last In--First Out) \added{order}.
\item[Assembly.] Assembly is a representation of machine code, and each computer architecture has its own instruction set, which makes an analysis impossible. In general, though, no unified exception handling is provided. \carlos{complete with more info on kinds of error handling at the processor level or is this out of scope???} \item[Assembly.] Assembly is a representation of machine code, and each computer architecture has its own instruction set, which makes an analysis impossible. In general, though, no unified exception handling is provided. \carlos{complete with more info on kinds of error handling at the processor level or is this out of scope???}\sergio{Si metes una explicacion asi breve que se entienda bien, si va a ser muy tecnico yo pararia aqui. Diria que las excepciones se manejan a nivel de procesador o lo que sea asi por encima y matizao}
\end{description} \end{description}
\footnotetext{For more details on Go's design choices, see \url{https://golang.org/doc/faq\#exceptions}. \carlos{Possible transformation to citation???}} \footnotetext{For more details on Go's design choices, see \url{https://golang.org/doc/faq\#exceptions}. \carlos{Possible transformation to citation???}\sergio{No creo que nos vaya a hacer falta. Con el state of the art y la intro tendremos bastantes.}}
% vim: set noexpandtab:tabstop=2:shiftwidth=2:softtabstop=2:wrap % vim: set noexpandtab:tabstop=2:shiftwidth=2:softtabstop=2:wrap

View file

@ -5,6 +5,7 @@
\label{cha:incremental} \label{cha:incremental}
\carlos{Review if we want to call nodes ``Enter'' and ``Exit'' or ``Start'' and ``End'' (I'd prefer the first one).} \carlos{Review if we want to call nodes ``Enter'' and ``Exit'' or ``Start'' and ``End'' (I'd prefer the first one).}
\sergio{Enter o Entry?}
\section{First definition of the SDG} \section{First definition of the SDG}
\label{sec:first-def-sdg} \label{sec:first-def-sdg}