\section{The problem statement}
\todoin{write/move}
-\section{The refactorings}
+\section{The primitive refactorings}
+The refactorings presented here are the primitive refactorings used in this
+project. They are the abstract building blocks used by the \ExtractAndMoveMethod
+refactoring.
\subsection{The Extract Method refactoring}
The \refa{Extract Method} refactoring is used to extract a fragment of code
\myref{lst:extractMethodRefactoring}. It shows a method containing calls to the
methods \method{foo} and \method{bar} of a type \type{X}. These statements are
then extracted into the new method \method{fooBar}.
-\todoin{Refine}
-\begin{listing}
+\begin{listing}[h]
\begin{multicols}{2}
\begin{minted}[samepage]{java}
// Before
\Myref{lst:moveMethodRefactoring} shows an example of this refactoring. Here a
method \method{fooBar} is moved from the class \type{C} to the class \type{X}.
-\todoin{Refine}
-
-\begin{listing}
+\begin{listing}[h]
\begin{multicols}{2}
\begin{minted}[samepage]{java}
// Before
\label{lst:moveMethodRefactoring}
\end{listing}
-\subsection{The Extract and Move Method refactoring}
-\todoin{Write}
-\missingfigure{Explaining the Extract and Move Method refactoring}
+\section{The Extract and Move Method refactoring}
+The \ExtractAndMoveMethod refactoring is a composite refactoring composed of the
+primitive \ExtractMethod and \MoveMethod refactorings. The effect of this
+refactoring on source code is the same as when extracting a method and moving it
+to another class. Conseptually, this is done without an intermediate step. In
+practice, as we shall see later, an intermediate step may be necessary.
+An example of this composite refactoring is shown in
+\myref{lst:extractAndMoveMethodRefactoring}. The example joins the examples from
+\cref{lst:extractMethodRefactoring} and \cref{lst:moveMethodRefactoring}. This
+means that the selection consisting of the consecutive calls to the methods
+\method{foo} and \method{bar}, is extracted into a new method \method{fooBar}
+located in the class \type{X}.
+
+\begin{listing}[h]
+ \begin{multicols}{2}
+ \begin{minted}[samepage]{java}
+ // Before
+ class C {
+ void method() {
+ X x = new X();
+ x.foo(); x.bar();
+ }
+ }
+
+ class X {
+ void foo(){/*...*/}
+ void bar(){/*...*/}
+ }
+ \end{minted}
+
+ \columnbreak
+
+ \begin{minted}[samepage]{java}
+ // After
+ class C {
+ void method() {
+ X x = new X();
+ x.fooBar();
+ }
+ }
+
+ class X {
+ void fooBar() {
+ foo(); bar();
+ }
+ void foo(){/*...*/}
+ void bar(){/*...*/}
+ }
+ \end{minted}
+ \end{multicols}
+ \caption{An example of the \ExtractAndMoveMethod refactoring.}
+ \label{lst:extractAndMoveMethodRefactoring}
+\end{listing}
\section{Choosing the target language}
Choosing which programming language the code that shall be manipulated shall be
represents a text selection.}
\label{lst:textSelectionsExample}
\end{listing}
-\todoin{fix \myref{lst:textSelectionsExample}?}
+\todoin{fix \myref{lst:textSelectionsExample}? Text only? All
+sub-sequences\ldots}
\paragraph{Finding the candidate} for the refactoring is done by analyzing all
the generated text selection with the \type{ExtractAndMoveMethodAnalyzer}