Below you will find pages that utilize the taxonomy term “refactoring”
Posts
Javascript Refactoring Series: Inline Temp
Table of Contents Inline Temp Motivation Mechanics Declare the temp as const if it isn’t already, and compile. Find all references to the temp and replace them with the right-hand side of the assignment. Compile and test after each change. Remove the declaration and the assignment of the temp. Compile and test. Inline Temp You have a temp that is assigned to once with a simple expression, and the temp is getting in the way of other refactorings.
Posts
Javascript Refactoring Series: Inline Function
In this article we take a look at one of the refactoring techniques named as Inline Function originally known as Inline Method. We will see how to apply these techniques in Javascript code since the original methodology is language agnostic. This is second in the series of articles exploring various refactoring techniques by Martin Fowler.
Table of Contents Javascript Refactoring Series: Inline Function Motivation Mechanics Check that the function is not polymorphic Find all calls to the function Replace each call with the function body.
Posts
Javascript Refactoring Series: Extract Function
In this article we take a look at one of the refactoring techniques named as Extract Function originally known as Extract Method. We will see how to apply these techniques in Javascript code since the original methodology is language agnostic. This is first in the series of articles exploring various refactoring techniques by Martin Fowler. Table of Contents Extract Function (aka Extract Method) Motivation Example: No local variables Example: Using Local Variables Example: Reassigning a Local Variable Extract Function (aka Extract Method) You have a code fragment that can be grouped together.
Posts
Refactoring a simple loop into a pipeline in Javascript
The loop is the typical way of processing collections, but with the greater adoption of first-class functions in Javascript the collection pipeline is an appealing alternative. In this article we look at refactoring loops to collection pipelines with a small example.
Table of Contents Refactoring a simple loop into a pipeline in Javascript Defining our Author data type Simple and plain For loop Using ES5 forEach Using a Collection Pipeline Refactor - Moving filter before map Refactor - Combine filters Reference Credits Refactoring a simple loop into a pipeline in Javascript The loop is the typical way of processing collections, but with the greater adoption of first-class functions in Javascript the collection pipeline is an appealing alternative.
Posts
Refactor your Javascript like a Pro with js2-refactor
In this article i will show you how to use the js2-refactor tool in Spacemacs which is a community built version of Emacs using Space key as the leader key. Table of Contents 1. Refactor your Javascript like a Pro with js2-refactor 1.1. Installation - Emacs 1.2. Installation - Spacemacs 1.3. Usage 1.4. Refactorings 1.4.1. js2r-expand-array 1.4.2. js2r-expand-object 1.4.3. js2r-expand-function 1.4.4. js2r-extract-function 1.4.5. js2r-extract-method 1.4.6. js2r-extract-var 1.4.7. js2r-contract-array 1.