The goal of software development is to meet the needs of users with the least possible effort. Software that doesn't serve the needs of its users, simply isn't good software. And since the needs of our users changes often, it's important to make sure that software was designed in order to be changed.
Refactoring the code will help us achieve this goal.
Refactoring is a way of removing or decreasing technical debt and improving the internal structure of our software system.
- How? - Improve code structure, readability and scalability from a software system
- Condition - Do not alter the external behavior of the code
- Why? - Improve internal structure
- Consequences - Minimize new bugs due to changes in the code, introduce new features and modify existing ones with ease
Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written.
Ideally, a software system should be flexible, maintainable and scalable.
Flexible: we could alter the code behavior easily without creating side effects.
Maintainable: we could apply refactors easily to improve code structure.
Scalable: we could add new features with less effort.