售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Preface
About the Book
About the Author
Learning Objectives
Audience
Approach
Chapter 1
Introduction
About TypeScript
What Is It?
What's All the Fuss About?
TypeScript versus JavaScript
Why I Chose TypeScript for This Book
What Is Refactoring?
Let's Define It
Our Approach
Design Patterns
Why Refactor at All?
Slow Development
Saving Money
Navy SEALS Get It
Being a Craftsman
Case Study #1
Case Study #2
When Should I Refactor?
The Boy Scout Rule
Repetitive Work
Difficulty Adding Features
In the End
Chapter 2
Null Checks Everywhere!
Identification
Billion-Dollar Mistake
Example
Is It That Bad?
Non-Nullable Types
Null Object Pattern
Empty Collections
Fixing It Up
Take 2
What About Objects?
Special Case Pattern
Situation
An Order Class That Needs to Be Refactored
Refactoring the Order Class
Chapter 3
Wordy Conditionals
Identification
A Little Bit of This, a Little Bit of That
Misbehaving Conditionals
Combining Conditionals
Situation
The Code
Guideline
Extracting Methods from Conditionals
What's Wrong Here?
The Fix
Extracting Conditional Logic to Explicit Classes
Let's Get Classy
SRP
Using It
Pipe Classes
Your Classes Might Be Doing Too Much...
Piping Our Logic
Bonus Refactor
Chapter 4
Nested Conditionals
Identification
A Monster
A Closer Look
Guard Clauses
Scenario
Fail Fast
Fixing It Up
Gate Classes
Scenario
Gate Classes to the Rescue
Useful for Web APIs
Chapter 5
Primitive Overuse
Identification
What's Wrong Here?
Value Objects
Scenario
Initial Refactor
Addressing Primitives
Creating Our Object
Moving Along
Immediate Validation
Deceptive Booleans
Scenario
New Business Rules
More Rules...
Is It Really That Bad?
Just Use Enums
Strategy Pattern
Chapter 6
Lengthy Method Signatures
Identification
The Slippery Slope of Optional Parameters
The Issue
Guidelines
Creating a Reusable Private Method
A Simple Example
Creating Semantically Meaningful Methods
A Brief Look at Some Advanced Solutions
Extracting Data Objects
Extraction
Chapter 7
Methods That Never End
Identification
When Is a Method Too Long?
Give It a Name
Being Strategic
Chapter 8
Dumping Grounds
Identification
Object-Oriented?
The Great Debate
Coupling
Warning Sign
One of These Things Is Not Like The Others
You Have Mail
Breaking It Up
Keep Separate Things Separate
Speak or Listen
CQRS
Read and Write
Next Steps
Commands
Queries
Conclusion
A Word of Caution
Chapter 9
Messy Object Creation
Identification
Factory Functions
Functions versus Static Methods
Combining Refactoring Techniques
Complexity Remains...
Building It
The Builder Pattern
One Last Improvement
Chapter 10
Conclusion
This Is Just The Beginning!
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜