Refactoring TypeScript : Keeping Your Code Healthy.
Refactoring TypeScript is an approachable look at getting your code into shape. Learn some of the causes of unhealthy code, how to identify them, techniques to cure them, and more.
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | Electrónico eBook |
Idioma: | Inglés |
Publicado: |
Birmingham :
Packt Publishing, Limited,
2019.
|
Temas: | |
Acceso en línea: | Texto completo |
Tabla de Contenidos:
- Cover; FM; Copyright; Table of Contents; Preface; 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 TypesNull 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 LogicBonus 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 ParametersThe 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 StepsCommands; 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!; Index