1 \documentclass[USenglish,9pt]{beamer}
2 \usepackage[utf8]{inputenc}
3 \usepackage[T1]{fontenc}
5 \usepackage{babel,textcomp}
6 \usepackage[style=alphabetic,backend=biber]{biblatex}
7 \usepackage{babel,textcomp,csquotes}
11 %\usepackage[hidelinks]{hyperref}
15 \usepackage{mathtools}
21 \usemintedstyle{default}
25 \theoremstyle{definition}
26 \newtheorem*{wordDef}{Definition}
27 \newtheorem*{mytheorem}{Theorem}
28 \newcommand{\mydefinition}[1]{\begin{wordDef}#1\end{wordDef}}
30 \newcommand{\citing}[1]{~\cite{#1}}
32 \newcommand{\code}[1]{\texttt{\textbf{#1}}}
33 \newcommand{\type}[1]{\code{#1}}
34 \newcommand{\method}[1]{\type{#1}}
35 \newcommand{\var}[1]{\type{#1}}
37 \newcommand{\name}[1]{#1}
38 \newcommand{\tit}[1]{\emph{#1}}
39 \newcommand{\refa}[1]{\emph{#1}}
40 \newcommand{\pattern}[1]{\emph{#1}}
41 \newcommand{\metr}[1]{\emph{#1}}
42 \newcommand{\ExtractMethod}{\refa{Extract Method}\xspace}
43 \newcommand{\MoveMethod}{\refa{Move Method}\xspace}
44 \newcommand{\ExtractAndMoveMethod}{\refa{Extract and Move Method}\xspace}
46 \def\thetitle{Automated Composition of Refactorings}
48 \author{Erlend Kristiansen}
50 \bibliography{bibliography/master-thesis-erlenkr-bibliography}
56 \frametitle{\thetitle}
62 \frametitle{Refactoring}
63 Martin Fowler, in his book on refactoring\citing{refactoring}, defines a
67 \emph{Refactoring} (noun): a change made to the internal structure
68 of software to make it easier to understand and cheaper to modify without
69 changing its observable behavior.~\cite[p.~53]{refactoring}
72 If we leave the motivation behind refactoring out of the definition, it could
73 be rephrased like this:
76 A \emph{refactoring} is a transformation
77 done to a program without altering its external behavior.
83 \frametitle{Composite Refactorings}
84 There are \emph{primitive refactorings}. These refactorings cannot be
85 expressed in terms of other refactorings. And there are \emph{composite
89 A \emph{composite refactoring} is a refactoring that can be expressed in
90 terms of two or more other refactorings.
96 \frametitle{The Extract and Move Method refactoring}
97 This thesis is concentrating on creating a composite refactoring of the
98 \ExtractMethod and \MoveMethod refactorings. The composition of the two is
99 called the \ExtractAndMoveMethod refactoring.
104 \begin{frame}[fragile]
105 \frametitle{The Extract Method refactoring}
106 The \refa{Extract Method} refactoring is used to extract a fragment of code
107 from its context and into a new method. A call to the new method is inlined
108 where the fragment was before. It is used to break code into logical units,
109 with names that explain their purpose
112 \begin{minted}[samepage]{java}
124 \begin{minted}[samepage]{java}
132 void extractedMethod() {
142 \begin{frame}[fragile]
143 \frametitle{The Move Method refactoring}
144 The \refa{Move Method} refactoring is used to move a method from one class to
145 another. This is useful if the method is using more features of another class
146 than of the class which it is currently defined.
149 \begin{minted}[samepage]{java}
155 void iBelongInX(X x) {
168 \begin{minted}[samepage]{java}
189 \begin{frame}[fragile]
190 \frametitle{The Composition}
193 \begin{minted}[samepage]{java}
210 % \begin{minted}[samepage]{java}
214 % x.extractedMethod();
219 % void extractedMethod() {
222 % void foo(){/*...*/}
223 % void bar(){/*...*/}
231 \begin{frame}[fragile]
232 \frametitle{The Composition}
235 \begin{minted}[samepage]{java}
242 void extractedMethod(X x) {
255 % \begin{minted}[samepage]{java}
259 % x.extractedMethod();
264 % void foo(){/*...*/}
265 % void bar(){/*...*/}
273 \begin{frame}[fragile]
274 \frametitle{The Composition}
277 \begin{minted}[samepage]{java}
294 \begin{minted}[samepage]{java}
304 void extractedMethod() {
317 \frametitle{Automation}
322 \item Project wide search and perform
329 \frametitle{Demonstration}
332 \code{LastStatementOfSelectionEndsInReturnOrThrow\-Checker.visit(IfStatement
335 \item Extract and Move on selection
336 \item Extract and Move, search based, on method
338 \item The \code{no.uio.ifi.refaktor} project
340 \item Extract and Move, search based, over whole project
347 \frametitle{What is left}
349 \item Write technical section
350 \item Write up argument for correctness
351 \item Define the final case study
352 \item Run unit tests before and after change
353 \item Make more examples
362 \frametitle{Bibliography}