Take existing code and make it better—more readable, efficient, understandable, and updateable—with refactoring.
- Hi. I'm Simon Allardice and welcome to Foundations of Programming: Refactoring. This is a course on how to take existing code, in whatever programming language you have, and make that code better. Okay, that's a loaded word. What do I mean "better"? Well, I don't mean faster. I mean better structured, better built. Yes, more readable, and because of that more understandable. Your code is easier to work with, it's easier to add new features, easier to spot and fix bugs, and it's a way to stop your code gradually getting out of control.
But refactoring is not a vague command to just tidy your code up. No, this is a formalized approach, a series of independent bite-sized techniques, clues that will let you look at a block of code and identify how it can be improved, exactly what to look for and exactly how to fix it. And many of the most common programming IDEs, like Visual Studio, Xcode, and Eclipse, will actually help you do many of these techniques. After learning even a few of these refactoring techniques you'll find yourself naturally writing more modular code, better object-oriented code, of knowing the correct place to put a piece of functionality or a piece of data.
It's like having a step-by-step approach to adopt really good programming habits. So let's get started.
- What is refactoring?
- Recognizing common code smells
- Simplifying method calls
- Making conditions easier to read
- Using refactorings at the method, class, and application level