wip on state pattern
This commit is contained in:
parent
b0b86d61e8
commit
69017acbb5
2 changed files with 40 additions and 13 deletions
BIN
report.pdf
BIN
report.pdf
Binary file not shown.
51
report.tex
51
report.tex
|
@ -1,14 +1,19 @@
|
|||
% vim: set ts=2 sw=2 et tw=80:
|
||||
|
||||
\documentclass[12pt,a4paper]{scrartcl}
|
||||
\documentclass[10pt,a4paper]{scrartcl}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[margin=2.5cm]{geometry}
|
||||
\usepackage[margin=2.25cm]{geometry}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{listings}
|
||||
\usepackage{xcolor}
|
||||
\usepackage{lmodern}
|
||||
\usepackage{listings}
|
||||
\setlength{\parindent}{0cm}
|
||||
\setlength{\parskip}{0.3em}
|
||||
\hypersetup{pdfborder={0 0 0}}
|
||||
\usepackage[nomessages]{fp}
|
||||
|
||||
\renewcommand*{\titlepagestyle}{empty}
|
||||
|
||||
\lstset{
|
||||
basicstyle=\small\ttfamily,
|
||||
|
@ -30,9 +35,15 @@
|
|||
\author{Volodymyr Karpenko \and Claudio Maggioni}
|
||||
|
||||
\begin{document}
|
||||
\begin{titlepage}
|
||||
\maketitle
|
||||
\pagenumbering{roman}
|
||||
\tableofcontents
|
||||
\lstlistoflistings
|
||||
\end{titlepage}
|
||||
|
||||
\section{Project selection process}
|
||||
\pagenumbering{arabic}
|
||||
|
||||
We need to find a project that is a single unit in terms of compilation
|
||||
modules\footnote{A problem for Pattern4J as compiled \texttt{.class} files are
|
||||
|
@ -72,7 +83,7 @@ interfaces to allow other modules to be plugged-in. Additionally, the
|
|||
\textit{core} module implements the tokenizer and low-level abstractions to work
|
||||
with the JSON format.
|
||||
|
||||
We chose to analyze version 2.13.4 of the module (corresponding to the code
|
||||
We chose to analyze version 2.13.4 of the module (i.e.\ the code
|
||||
under the git tag \texttt{jackson-core-2.13.4}) because it is the latest stable
|
||||
version available at the time of writing.
|
||||
|
||||
|
@ -156,6 +167,7 @@ produced the following results:
|
|||
bitmask \texttt{protected int} fields, which are then directly accessed by
|
||||
the constructor of the \textbf{TokenStreamFactory} concrete implementation
|
||||
to build;
|
||||
\marginpar[right text]{\color{white}\url{https://youtu.be/72b2nH-kdbU}}
|
||||
\item[JsonFactoryBuilder] an concrete factory implementation of
|
||||
\textbf{TSFBuilder} that builds \textbf{JsonFactory} instances;
|
||||
\item[util.ByteArrayBuilder] provides facilities to build \texttt{byte[]} objects
|
||||
|
@ -171,27 +183,43 @@ produced the following results:
|
|||
\subsection{Adapter Pattern}
|
||||
TBD
|
||||
|
||||
|
||||
\subsection{Decorator Pattern}
|
||||
Only in Pattern4j
|
||||
|
||||
\subsection{Bridge Pattern}
|
||||
TBD
|
||||
|
||||
\subsection{Composite Pattern}
|
||||
TBD
|
||||
None found
|
||||
|
||||
\subsection{Facade Pattern}
|
||||
TBD
|
||||
TBD -- \textit{Pattern4} does not detect this pattern
|
||||
|
||||
\subsection{Proxy Pattern}
|
||||
TBD
|
||||
None found
|
||||
|
||||
\section{Behavioral Patterns}
|
||||
\subsection{Command Pattern}
|
||||
TBD
|
||||
None found
|
||||
|
||||
\subsection{Observer Pattern}
|
||||
TBD
|
||||
None found
|
||||
|
||||
\subsection{Strategy Pattern}
|
||||
TBD
|
||||
None found
|
||||
|
||||
\subsection{State Pattern}
|
||||
Among the design patterns \textit{Pattern4} detects, the state pattern is
|
||||
detected in 5 classes. The state pattern is a variation of the strategy pattern
|
||||
where the concrete strategy used by the matching context is determined by the
|
||||
state of a finite state machine the context class implements. In other words,
|
||||
the state pattern chooses the concrete strategy to use through the state of the
|
||||
context.
|
||||
|
||||
util.DefaultPrettyPrinter delegate pattern maybe, but no state
|
||||
|
||||
TBD instances and examples
|
||||
|
||||
\subsection{Template Method Pattern}
|
||||
Due to the extendibility of Jackson, it is of no surprise that the template
|
||||
|
@ -202,7 +230,7 @@ correctly detects several instances of the pattern, namely
|
|||
\textbf{JsonParser}, \textbf{base.ParserBase}, \textbf{base.GeneratorBase},
|
||||
\textbf{base.ParserMinimalBase}. All these classes implement several concrete
|
||||
\texttt{public} methods throwgh the use of \texttt{protected abstract} methods.
|
||||
Although the concrete (i.e. the template) methods are usually not vary complex
|
||||
Although the concrete (i.e.\ the template) methods are usually not vary complex
|
||||
(as the pattern example shown in class), they still follow the principles of the
|
||||
template method pattern. We show as an example some template methods found in
|
||||
\textbf{base.ParserBase}:
|
||||
|
@ -238,9 +266,8 @@ Here the pattern is slightly modified by providing a default implementation of
|
|||
override the method with a body first calling \texttt{super()} and then adding
|
||||
additional buffer release code after.
|
||||
|
||||
|
||||
\subsection{Visitor Pattern}
|
||||
TBD
|
||||
None found
|
||||
|
||||
\end{document}
|
||||
|
||||
|
|
Reference in a new issue