Five Lines of Code MEAP V07 cover
Welcome to liveBook!

This is an online version of the Manning book Five Lines of Code . With liveBook you can access Manning books in-browser — anytime, anywhere.


Thank you for purchasing Five Lines of Code in MEAP.

This book is written to be a first look into refactoring, and is therefore suited for junior programmers. To get the most out of this book you should be comfortable with programming in an object-oriented language, including loops, methods, classes, and interfaces.

We all know the excitement of starting a new project, we open an empty file and start typing, and we don't stop. Our fingers are constantly typing because there is no need to slow down. We can keep the whole codebase in our head, no need to stop and investigate what some other code is doing.

The most productive we can be is when there is no other code to distract us. Sadly in many projects this quickly dissipates, as the codebase gets large and tangled. Changing something in one place breaks something in a completely separate place. We lose the overview, we have to be careful, and it starts sucking the fun out of programming.

Refactoring is the process of improving code without affecting what it does. It makes the code more readable, more flexible and more stable. This book teaches you not only how to refactor, but just as importantly what code to refactor to get the biggest benefits fastest.

In the first part we learn the concrete rules and refactoring patterns through refactoring the codebase of a 2d puzzle game written in a realistic style. In the second part we look at real-world practices that enable great refactoring.