Five Lines of Code: How and When to Refactor (Paperback)

Clausen, Christian

買這商品的人也買了...

相關主題

商品描述

Five Lines of Code teaches refactoring that's focused on concrete rules and getting any method down to five lines or less! There's 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 learn:

The signs of bad code
Improving code safely, even when you don't understand it
Balancing optimization and code generality
Proper compiler practices
The Extract method, Introducing Strategy pattern, and many other refactoring patterns
Writing stable code that enables change-by-addition
Writing code that needs no comments
Real-world practices for great refactoring

Improving existing code--refactoring--is one of the most common tasks you'll 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 author's expert perspective--that refactoring and code smells can be learned by following a concrete set of principles--you'll learn when to refactor your code, what patterns to apply to what problem, and the code characteristics that indicate it's time for a rework.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the technology
Every 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, you'll learn a unique approach to refactoring that implements any method in five lines or fewer. You'll also discover a secret most senior devs know: sometimes it's quicker to hammer out code and fix it later!

About the book
Five Lines of Code is a fresh look at refactoring for developers of all skill levels. In it, you'll master author Christian Clausen's innovative approach, learning concrete rules to get any method down to five lines--or less! You'll learn when to refactor, specific refactoring patterns that apply to most common problems, and characteristics of code that should be deleted altogether.

What's inside

The signs of bad code
Improving code safely, even when you don't understand it
Balancing optimization and code generality
Proper compiler practices

About the reader
For developers of all skill levels. Examples use easy-to-read Typescript, in the same style as Java and C#.

About the author
Christian Clausen works as a Technical Agile Coach, teaching teams how to refactor code.

Table of Contents
1 Refactoring refactoring
2 Looking under the hood of refactoring
PART 1 LEARN BY REFACTORING A COMPUTER GAME
3 Shatter long function
4 Make type codes work
5 Fuse similar code together
6 Defend the data
PART 2 TAKING WHAT YOU HAVE LEARNED INTO THE REAL WORLD
7 Collaborate with the compiler
8 Stay away from comments
9 Love deleting code
10 Never be afraid to add code
11 Follow the structure in the code
12 Avoid optimizations and generality
13 Make bad code look bad
14 Wrapping up

商品描述(中文翻譯)

《五行程式碼》教授以具體規則為重點的重構技巧,將任何方法簡化為五行或更少!無需專業術語或繁瑣的自動化測試技巧,只需簡單的指導方針和以詳細程式碼示例說明的模式。

在《五行程式碼》中,您將學到:

- 糟糕程式碼的特徵
- 即使不理解程式碼,也能安全改進程式碼
- 平衡優化和程式碼的普遍性
- 正確的編譯器實踐
- 提取方法、引入策略模式和其他重構模式
- 編寫穩定的程式碼,以實現增量變更
- 編寫不需要註解的程式碼
- 優秀重構的實踐方法

改進現有程式碼(重構)是程式設計師最常面臨的任務之一。《五行程式碼》教授您清晰且可行的重構規則,您可以在不依賴於直覺判斷(如「程式碼氣味」)的情況下應用這些規則。遵循作者的專業觀點,即通過遵循一套具體原則來學習重構和程式碼氣味,您將學會何時重構程式碼,將哪些模式應用於哪些問題,以及指示需要重新工作的程式碼特徵。

購買印刷版書籍將包含Manning Publications提供的PDF、Kindle和ePub格式的免費電子書。

關於技術:
每個程式庫都包含錯誤和效率低下的問題,您需要找到並修復這些問題。正確地進行重構,您的程式碼將變得優雅、易於閱讀和維護。在本書中,您將學習一種獨特的重構方法,將任何方法簡化為五行或更少。您還將發現大多數資深開發人員所知道的秘密:有時候,快速編寫程式碼並稍後修復它更快!

關於本書:
《五行程式碼》是對所有技能水平的開發人員進行重構的新視角。在本書中,您將掌握作者Christian Clausen創新方法,學習具體的規則,將任何方法簡化為五行或更少!您將學習何時進行重構,適用於大多數常見問題的特定重構模式,以及應該完全刪除的程式碼特徵。

內容簡介:
- 糟糕程式碼的特徵
- 即使不理解程式碼,也能安全改進程式碼
- 平衡優化和程式碼的普遍性
- 正確的編譯器實踐

讀者對象:
適合所有技能水平的開發人員。示例使用易於閱讀的TypeScript,與Java和C#相似的風格。

關於作者:
Christian Clausen是一位技術敏捷教練,教導團隊如何重構程式碼。

目錄:
1. 重構重構
2. 深入了解重構的內幕
第一部分 通過重構電腦遊戲學習
3. 分解長函數
4. 使類型代碼正常工作
5. 將相似的程式碼合併在一起
6. 保護數據
第二部分 將您所學應用於現實世界
7. 與編譯器合作
8. 遠離註解
9. 熱愛刪除程式碼
10. 永不害怕添加程式碼
11. 遵循程式碼結構
12. 避免優化和普遍性
13. 讓糟糕的程式碼看起來糟糕
14. 總結

作者簡介

Christian Clausen works as a Technical Agile Coach teaching teams how to properly refactor their code. Previously he worked as a software engineer on the Coccinelle semantic patching project, an automated refactoring tool. He has an MSc in computer science, and five years' experience teaching software quality at a university level.

作者簡介(中文翻譯)

Christian Clausen 是一位技術敏捷教練,教導團隊如何正確地重構程式碼。在此之前,他曾在 Coccinelle 語義修補專案中擔任軟體工程師,該專案是一個自動化重構工具。他擁有計算機科學碩士學位,並在大學層面教授軟體品質已有五年的經驗。