num_pages: 336
description: Five Lines of Code teaches refactoring that's focused on concrete rules and getting any method down to five lines or less! Theres no jargon or tricky automated-testing skills required just easy guidelines and patterns illustrated by detailed code samples.In Five Lines of Code you will The signs of bad codeImproving code safely even when you dont understand itBalancing optimization and code generalityProper compiler practicesThe Extract method Introducing Strategy pattern and many other refactoring patternsWriting stable code that enables change-by-additionWriting code that needs no commentsReal-world practices for great refactoringImproving existing coderefactoringis one of the most common tasks youll face as a programmer. Five Lines of Code teaches you clear and actionable refactoring rules that you can apply without relying on intuitive judgements such as code smells. Following the authors expert perspectivethat refactoring and code smells can be learned by following a concrete set of principlesyoull learn when to refactor your code what patterns to apply to what problem and the code characteristics that indicate its time for a rework.Foreword by Robert C. Martin.Purchase of the print book includes a free eBook in PDF Kindle and ePub formats from Manning Publications.About the technologyEvery codebase includes mistakes and inefficiencies that you need to find and fix. Refactor the right way and your code becomes elegant easy to read and easy to maintain. In this book youll learn a unique approach to refactoring that implements any method in five lines or fewer. Youll also discover a secret most senior devs sometimes its quicker to hammer out code and fix it later!About the bookFive Lines of Code is a fresh look at refactoring for developers of all skill levels. In it youll master author Christian Clausens innovative approach learning concrete rules to get any method down to five linesor less! Youll learn when to refactor specific refactoring patterns that apply to most common problems and characteristics of code that should be deleted altogether.What's insideThe signs of bad codeImproving code safely even when you dont understand itBalancing optimization and code generalityProper compiler practicesAbout the readerFor developers of all skill levels. Examples use easy-to-read Typescript in the same style as Java and C#.About the authorChristian Clausen works as a Technical Agile Coach teaching teams how to refactor code.Table of Contents1 Refactoring refactoring2 Looking under the hood of refactoringPART 1 LEARN BY REFACTORING A COMPUTER GAME3 Shatter long function4 Make type codes work5 Fuse similar code together6 Defend the dataPART 2 TAKING WHAT YOU HAVE LEARNED INTO THE REAL WORLD7 Collaborate with the compiler8 Stay away from comments9 Love deleting code10 Never be afraid to add code11 Follow the structure in the code12 Avoid optimizations and generality13 Make bad code look bad14 Wrapping up
language: English
title: Five Lines of Code: How and when to refactor
publisher: Manning