Forgive the code you have now, and the developers who made it.
Learn repeatable, memorable, and time-saving refactoring techniques.
Apply these techniques as you work, fixing things along the way.
Internalize these techniques, and avoid writing as much problematic code to begin with.
Bad code doesn’t have to stay that way. And making it better doesn’t have to be intimidating or unreasonably expensive.
Chapter 1What Is Refactoring?
How Can You Guarantee Behavior Doesn’t Change?
What Is the Point of Refactoring if Behavior Doesn’t Change?
What Is and Isn’t Refactoring
Versions and Specifications
Platforms and Implementations
The Many Whys of Testing
The Many Ways of Testing
Tools and Processes
Chapter 4Testing in Action
New Code from Scratch
New Code from Scratch with TDD
Untested Code and Characterization Tests
Debugging and Regression Tests
Chapter 5Basic Refactoring Goals
Context Part 1: The Implicit Input
Context Part 2: Privacy
Chapter 6Refactoring Simple Structures
Our Strategy for Confidence
Working with Arrays: Loops, forEach, map
Chapter 7Refactoring Functions and Objects
The Code (Improved)
Array and Object Alternatives
Testing What We Have
Streamlining the API with One Global Object
Chapter 8Refactoring Within a Hierarchy
About “CRUD Apps” and Frameworks
Let’s Build a Hierarchy
Let’s Wreck Our Hierarchy
Inheritance and Architecture
Chapter 9Refactoring to OOP Patterns
Wrapper (Decorator and Adapter)
Chapter 10Asynchronous Refactoring
Fixing the Pyramid of Doom
Callbacks and Testing
Chapter 11Functional Refactoring
The Restrictions and Benefits of Functional Programming
Evan Burchard is a Web Development Consultant and the author of The Web Game Developer’s Cookbook. Offline, he has designed an award-winning kinetic game involving stacking real ice cubes, and periodically picks up his project to walk across the U.S.
The desman is functionally blind, but its distinctive two-lobed snout is packed with specialized dermal bumps (known as Eimer's organs, which are also found in moles). These organs are highly sensitive to touch and are the animal's primary source of sensory input. The desman also uses its long nose like a periscope, to breathe and sniff for threats above the surface of the water. Desmans are adept swimmers, with webbed hind feet and laterally flat tails (which help steer like a ship's rudder). And indeed, though they dig dens on land in which to sleep and raise their young, desmans spend much of their time in the water; their dens even have underwater entrances. Their diet is made up of insects, larvae, amphibians, and small fish, most of which they catch underwater.
Unfortunately, the Russian desman is endangered. Its soft, thick pelt—ideal for life in cold water—made it highly sought after in the fur trade of the early 20th century and the species was greatly overhunted. In 1957, the Soviet government established a complete ban on hunting desmans. Despite this, other factors like logging, water pollution, and wetland drainage have continued to cause a steep population decline as viable habitat disappears. Recent conservation efforts have had some success in establishing a healthy desman population within wildlife reserves.
The cover image is from Natural History of Animals.