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

商品描述(中文翻譯)

描述:



開發人員在建構軟體的過程中,往往會在中途停下來重新思考和重新編碼軟體設計,以使其更加乾淨和高效。這個過程被稱為「重構」,它耗費了寶貴的時間和金錢。為了幫助減少重構的需求,本書提出了一個新的過程,稱為「預先重構」,其基本理念是在開始項目之前,先考慮最佳的設計模式。



預先重構本質上是將從以前的經驗中獲得的洞察力(無論是你自己的還是別人的)應用於新項目的軟體開發中。這樣做很可能會避免你在中途進行昂貴的設計更改,甚至可能保住你的工作!



這本實用而發人深省的指南詳細介紹了在設計、編碼和測試中的預先重構指南,這些指南是從多年來許多開發人員的經驗教訓中得出的。有了這些指南,你在進入猶豫不決的階段之前,更有可能創建出更易讀和易於維護的代碼。



為了幫助傳達這個過程的多個方面,《預先重構》以一個虛構的客戶Sam為例,他試圖從頭到尾創建一個軟體系統。其中涵蓋的主題包括:



  • 一般開發問題


  • 實現類


  • 面向對象設計


  • 通過關注點分離創建報告


  • 關聯和狀態


  • 創建和測試接口



如果你了解面向對象設計,並且希望通過在項目開始之前考慮更高效的設計來節省時間和金錢,《預先重構》將為你指引方向。它不能保證你永遠不需要重構你的設計或代碼,但肯定能減少你需要進行重構的次數。


 

 



目錄:



前言


1. 預先重構入門


     什麼是預先重構?

   
 三個極端

     探索指南

   
 本書的背景


2. 用言語描述系統


     遇見Sam

   
 避免重新發明

     名字的重要性

   
 分割與合併

     聚合

   
 抽象化

     原型的價值


3. 一般開發問題


     從大局出發

 
   接口契約

     驗證

   
 代碼溝通

     一致性即簡潔

   
 預先重構的態度

     不要重複自己

 
   記錄假設和決策

     處理偏差和錯誤

   
 加速

     試算表困境

&n```