Introducing refactoring
Refactoring is one of those words that doesn’t make a lot of sense to newer programmers, but here’s a simple definition:
Refactoring is the act of changing the shape or form of code without changing its functionality or behavior.
There are two key concepts here:
- The first concept is that refactoring is an effort to improve the maintainability of existing code. Sometimes, restructuring means introducing a new variable, method, or class. Other times, refactoring simply changes how individual lines of code are arranged or which language features are used. Even something as simple as renaming a variable could be considered a small act of refactoring.
- The second concept in this definition is that refactoring does not alter the behavior of the code in question. Refactoring is a structural change done to bring some piece of technical merit without altering the existing behavior of your code. If a method typically returned a certain value...