Prefactoring (Paperback)
暫譯: 預重構 (平裝本)

Ken Pugh

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

商品描述

Description:

More often than not, developers will stop a large project in the middle of the build stage to rethink and recode the software design so it's cleaner and more efficient. Known as "refactoring," this process eats up valuable time and money. To help offset refactoring, this book presents a new process called "prefactoring," the premise of which states that you're better off considering the best possible design patterns before you even begin your project.


Prefactoring, in essence, is the art of applying the insights gleaned from previous experience (whether yours or someone else's) when developing software to new projects. Doing so will likely save you from making costly design changes midstream--and maybe even save your job!


This practical, thought-provoking guide details prefactoring guidelines in design, code, and testing, each derived from the lessons of many developers over many years. With these guidelines, you're far more likely to create more readable and maintainable code before you reach the second-guessing stage.


To help communicate the many facets of this process, Prefactoring follows the example of a fictitious client, Sam, as he seeks to create a software system from beginning to implementation. Among the topics covered:

  • General development issues
  • Implementation classes
  • Object-oriented design
  • Creating reports via separation of concerns
  • Associations and states
  • Creating and testing interfaces


If you understand object-oriented design, and you want to save time and money by considering more efficient designs before you begin your project, Prefactoring will show you the way. It won't guarantee that you'll never need to refactor your design or code again, but you're sure to cut down on the amount of refactoring you do.

 

 

Table of Contents:

Preface

1. Introduction to Prefactoring

     What Is Prefactoring?

     The Three Extremes

     The Guidelines Explored

     The Context for This Book

2. The System in So Many Words

     Meet Sam

     Reinvention Avoidance

     What's in a Name?

     Splitters Versus Lumpers

     Clumping

     Abstracting

     Prototypes Are Worth a Thousand Words

3. General Development Issues

     Start with the Big Picture

     Interface Contracts

     Validation

     Code Communicates

     Consistency Is Simplicity

     A Prefactoring Attitude

     Don't Repeat Yourself

     Documentation of Assumptions and Decisions

     Dealing with Deviations and Errors

     Speeding

     The Spreadsheet Conundrum

     Tools Are Tools-Use Them Wisely

4. Getting the Big Picture

     The Rest of the Story

     Process

     The Initial Design

     Global Planning, Local Designing

     Testing Functionality

     Testing Quality

     Security

5. Got Class?

     Categories and Classes

     Declaration Versus Execution

     Appropriate Inheritance

     Communicate with Text

     More Than One

6. A Few Words on Classes

     Honor the Class Maxims

     Three Laws of Objects

     Need Determines Class

     Polymorphism

     One Little Job

     Policy Versus Implementation

     Extreme Naming

     Overloading Functions

7. Getting There

     Where We Are

     Separating Concerns

     Migrating to the New System

8. The First Release

     The Proof Is in the Pudding

     Retrospective Time

     The System as It Stands Now

     Operations Interface

     Abstract Data Types

     Configuration

     Testing

     Dealing with Deviations and Errors

     A Little Prefactoring

     The First Released Iteration

     Sometimes Practice Does Not Match Theory

     The Rest of the Classes

9. Associations and States

     Sam's New Requirement

     Who's in Charge?

     The State of an Object

10. Interfaces and Adaptation

     The Catalog Search Use Case

     Designing the Interface

     Interface Development

     Interface Testing

     Interface Splitting

     Something Working

11. Zip Codes and Interfaces

     Adaptation

     Pass the Buck

     Unwritten Code

     Indirection

     Logging

     Paradigm Mismatch

12. More Reports

     Fancy Reports

     Change Happens

     Exports

13. Invoices, Credit Cards, and Discounts

     The Next Step

     The Language of the Client

     Security and Privacy

14. Sam Is Expanding

     The Second Store

     A New Development

     The Third Store

     Goodbye Sam

     Generality

15. A Printserver Example

     Introduction

     The System

     The Message

     Testing

     Logging

     Still More Separation

     Epilogue

16. Antispam Example

     The Context

     Spam Checking

     The ReceivingMailServer

     ReceivedMailExaminer

     The Full Flow

17. Epilogue

a. Guidelines and Principles

b. Source Code

index

商品描述(中文翻譯)

**描述:**
開發人員經常會在大型專案的建置階段中途停止,重新思考並重新編碼軟體設計,以使其更乾淨且更有效率。這個過程稱為「重構」(refactoring),它消耗了寶貴的時間和金錢。為了幫助減少重構的需求,本書提出了一個新的過程,稱為「預重構」(prefactoring),其前提是,在開始專案之前,考慮最佳的設計模式會更有利。

預重構本質上是將從以往經驗中獲得的見解(無論是自己的還是他人的)應用於新專案的藝術。這樣做可能會讓你避免在進行中進行代價高昂的設計變更——甚至可能拯救你的工作!

這本實用且引人深思的指南詳細說明了設計、代碼和測試中的預重構指導方針,這些方針源自許多開發人員多年的經驗教訓。遵循這些指導方針,你更有可能在進入質疑階段之前創建出更具可讀性和可維護性的代碼。

為了幫助傳達這一過程的多個面向,《預重構》以虛構客戶山姆(Sam)的例子為主線,描述他從頭到尾創建一個軟體系統的過程。涵蓋的主題包括:
- 一般開發問題
- 實作類別
- 物件導向設計
- 通過關注點分離創建報告
- 關聯和狀態
- 創建和測試介面

如果你了解物件導向設計,並希望在開始專案之前考慮更有效的設計以節省時間和金錢,《預重構》將指引你前進。它不會保證你不再需要重構設計或代碼,但肯定會減少你進行重構的次數。

**目錄:**
**前言**
**1. 預重構介紹**
     什麼是預重構?
     三個極端
     指導方針探討
     本書的背景

**2. 系統的多種表述**
     認識山姆
     避免重造
     名稱的意義
     分割者與合併者
     聚合
     抽象化
     原型的價值

**3. 一般開發問題**
     從大局開始
     介面合約
     驗證
     代碼的溝通
     一致性即簡單性
     預重構的態度
     不要重複自己
     假設和決策的文檔
     處理偏差和錯誤
     加速
     電子表格的困境
     工具是工具——明智使用

**4. 獲得大局觀**
     故事的其餘部分
     過程
     初步設計
     全球規劃,本地設計
     功能測試
     質量測試
     安全性

**5. 有類別嗎?**
     類別與類
     宣告與執行
     適當的繼承
     用文本溝通
     不止一個

**6. 關於類別的幾句話**
     尊重類別的格言
     物件的三條法則
     需求決定類別
     多型
     一個小任務
     政策與實作
     極端命名
     函數重載

**7. 到達那裡**
     我們的位置
     分離關注點
     遷移到新系統

**8. 第一次發布**
     證明在於實踐
     回顧時間
     系統的現狀
     操作介面
     抽象數據類型
     配置
     測試
     處理偏差和錯誤
     小範圍的預重構
     第一次發布的迭代
     有時實踐不符合理論
     其餘的類別

**9. 關聯與狀態**
     山姆的新需求
     誰在掌控?
     物件的狀態

**10. 介面與適應**
     目錄搜索用例
     設計介面
     介面開發
     介面測試
     介面分割
     某些功能正常

**11. 郵遞區號與介面**
     適應
     推卸責任
     未書寫的代碼
     間接性
     日誌記錄
     範式不匹配

**12. 更多報告**
     華麗報告
     變化發生
     匯出

**13. 發票、信用卡與折扣**
     下一步
     客戶的語言
     安全與隱私

**14. 山姆正在擴展**
     第二家商店
     一個新的發展
     第三家商店
     再見,山姆
     一般性

**15. 列印伺服器範例**
     介紹
     系統
     訊息
     測試
     日誌記錄
     更多的分離
     結語

**16. 反垃圾郵件範例**
     背景
     垃圾郵件檢查
     接收郵件伺服器
     接收郵件檢查器
     完整流程

**17. 結語**
**a. 指導方針與原則**
**b. 原始碼**
**索引**

最後瀏覽商品 (20)