Op werkdagen voor 23:00 besteld, morgen in huis Gratis verzending vanaf €20
, , , e.a.

Refactoring

Ruby Edition

E-book Engels 2021 9780321604187
Verwachte levertijd ongeveer 8 werkdagen

Samenvatting

Refactoring: Ruby Edition

 

The definitive refactoring guide, fully revamped for Ruby

 

With refactoring, programmers can transform even the most chaotic software into well-designed systems that are far easier to evolve and maintain. What’s more, they can do it one step at a time, through a series of simple, proven steps. Now, for the first time, there’s an authoritative, definitive guide to refactoring Ruby code. Based on the Martin Fowler book that invented refactoring, this book utilizes Ruby examples and idioms throughout — not code adapted from Java or any other environment.

The authors introduce a detailed catalog of more than 70 proven Ruby refactorings, with specific guidance on when to apply each of them, step-by-step instructions for using them, and example code illustrating how they work. Many of the authors’ refactorings use powerful Ruby-specific features, and all code samples are available for download.

Leveraging Fowler's original concepts, the authors show how to perform refactoring in a controlled, efficient, incremental manner, so you methodically improve your code’s structure without introducing new bugs. Whatever your role in writing or maintaining Ruby code, this book will be an indispensable resource.

 

This book will help you

 

·   Understand the core principles of refactoring, and the reasons for doing it

·   Recognize “bad smells” in your Ruby code

·   Rework bad designs into well-designed code, one step at a time

·   Build tests to make sure your refactorings work properly

·   Understand the challenges of refactoring and how they can be overcome

·   Compose methods to package code properly

·   Move features between objects to place responsibilities where they fit best

·   Organize data to make it easier to work with

·   Simplify conditional expressions and make more effective use of polymorphism

·   Create interfaces that are easier to understand and use

·   Generalize more effectively

·   Perform larger refactorings that transform entire software systems, and may take months or years

·   Successfully refactor Ruby on Rails code

Specificaties

ISBN13:9780321604187
Taal:Engels
Bindwijze:e-book
Uitgever:Pearson Education
Hoofdrubriek:

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Geef uw waardering

Zeer goed Goed Voldoende Matig Slecht

Inhoudsopgave

<p style="MARGIN: 0px">Foreword . . . xiii</p> <p style="MARGIN: 0px">Preface . . . xv</p> <p style="MARGIN: 0px">Acknowledgments . . . xx</p> <p style="MARGIN: 0px">About the Authors . . . xxii</p> <p style="MARGIN: 0px">Chapter 1: Refactoring, a First Example . . . 1</p> <p style="MARGIN: 0px">The Starting Point . . . 2</p> <p style="MARGIN: 0px">The First Step in Refactoring . . . 6</p> <p style="MARGIN: 0px">Decomposing and Redistributing the Statement Method . . . 7</p> <p style="MARGIN: 0px">Replacing the Conditional Logic on Price Code with Polymorphism . . . 32</p> <p style="MARGIN: 0px">Final Thoughts . . . 50</p> <p style="MARGIN: 0px">Chapter 2: Principles in Refactoring . . . 51</p> <p style="MARGIN: 0px">Where Did Refactoring Come From? . . . 51</p> <p style="MARGIN: 0px">Defining Refactoring . . . 52</p> <p style="MARGIN: 0px">Why Should You Refactor? . . . 54</p> <p style="MARGIN: 0px">When Should You Refactor? . . . 57</p> <p style="MARGIN: 0px">Why Refactoring Works . . . 60</p> <p style="MARGIN: 0px">What Do I Tell My Manager? . . . 61</p> <p style="MARGIN: 0px">Indirection and Refactoring . . . 61</p> <p style="MARGIN: 0px">Problems with Refactoring . . . 63</p> <p style="MARGIN: 0px">Refactoring and Design. . . . 67</p> <p style="MARGIN: 0px">It Takes A While to Create Nothing . . . 69</p> <p style="MARGIN: 0px">Refactoring and Performance . . . 70</p> <p style="MARGIN: 0px">Optimizing a Payroll System . . . 71</p> <p style="MARGIN: 0px">Chapter 3: Bad Smells in Code . . . 73</p> <p style="MARGIN: 0px">Duplicated Code . . . 74</p> <p style="MARGIN: 0px">Long Method . . . 74</p> <p style="MARGIN: 0px">Large Class . . . 76</p> <p style="MARGIN: 0px">Long Parameter List . . . 76</p> <p style="MARGIN: 0px">Divergent Change . . . 77</p> <p style="MARGIN: 0px">Shotgun Surgery . . . 78</p> <p style="MARGIN: 0px">Feature Envy . . . 78</p> <p style="MARGIN: 0px">Data Clumps . . . 79</p> <p style="MARGIN: 0px">Primitive Obsession . . . 79</p> <p style="MARGIN: 0px">Case Statements . . . 80</p> <p style="MARGIN: 0px">Parallel Inheritance Hierarchies . . . 81</p> <p style="MARGIN: 0px">Lazy Class . . . 81</p> <p style="MARGIN: 0px">Speculative Generality . . . 81</p> <p style="MARGIN: 0px">Temporary Field . . . 82</p> <p style="MARGIN: 0px">Message Chains . . . 82</p> <p style="MARGIN: 0px">Middle Man . . . 83</p> <p style="MARGIN: 0px">Inappropriate Intimacy . . . 83</p> <p style="MARGIN: 0px">Alternative Classes with Different Interfaces . . . 83</p> <p style="MARGIN: 0px">Incomplete Library Class . . . 84</p> <p style="MARGIN: 0px">Data Class . . . 84</p> <p style="MARGIN: 0px">Refused Bequest . . . 84</p> <p style="MARGIN: 0px">Comments . . . 85</p> <p style="MARGIN: 0px">Metaprogramming Madness . . . 86</p> <p style="MARGIN: 0px">Disjointed API . . . 86</p> <p style="MARGIN: 0px">Repetitive Boilerplate . . . 86</p> <p style="MARGIN: 0px">Chapter 4: Building Tests . . . 87</p> <p style="MARGIN: 0px">The Value of Self-Testing Code . . . 87</p> <p style="MARGIN: 0px">The Test::Unit Testing Framework . . . 88</p> <p style="MARGIN: 0px">Developer and Quality Assurance Tests . . . 91</p> <p style="MARGIN: 0px">Adding More Tests . . . 92</p> <p style="MARGIN: 0px">Chapter 5: Toward a Catalog of Refactorings . . . 97</p> <p style="MARGIN: 0px">Format of the Refactorings . . . 97</p> <p style="MARGIN: 0px">Finding References . . . 99</p> <p style="MARGIN: 0px">Chapter 6: Composing Methods . . . 101</p> <p style="MARGIN: 0px">Extract Method . . . 102</p> <p style="MARGIN: 0px">Inline Method . . . 108</p> <p style="MARGIN: 0px">Inline Temp . . . 110</p> <p style="MARGIN: 0px">Replace Temp with Query. . . 111</p> <p style="MARGIN: 0px">Replace Temp with Chain . . . 114</p> <p style="MARGIN: 0px">Introduce Explaining Variable . . . 117</p> <p style="MARGIN: 0px">Split Temporary Variable . . . 121</p> <p style="MARGIN: 0px">Remove Assignments to Parameters . . . 124</p> <p style="MARGIN: 0px">Replace Method with Method Object . . . 127</p> <p style="MARGIN: 0px">Substitute Algorithm . . . 131</p> <p style="MARGIN: 0px">Replace Loop with Collection Closure Method . . . 133</p> <p style="MARGIN: 0px">Extract Surrounding Method . . . 135</p> <p style="MARGIN: 0px">Introduce Class Annotation . . . 139</p> <p style="MARGIN: 0px">Introduce Named Parameter . . . 142</p> <p style="MARGIN: 0px">Remove Named Parameter . . . 147</p> <p style="MARGIN: 0px">Remove Unused Default Parameter . . . 150</p> <p style="MARGIN: 0px">Dynamic Method Definition . . . 152</p> <p style="MARGIN: 0px">Replace Dynamic Receptor with Dynamic Method Definition . . . 158</p> <p style="MARGIN: 0px">Isolate Dynamic Receptor . . . 160</p> <p style="MARGIN: 0px">Move Eval from Runtime to Parse Time . . . 165</p> <p style="MARGIN: 0px">Chapter 7: Moving Features Between Objects . . . 167</p> <p style="MARGIN: 0px">Move Method . . . 167</p> <p style="MARGIN: 0px">Move Field . . . 172</p> <p style="MARGIN: 0px">Extract Class . . . 175</p> <p style="MARGIN: 0px">Inline Class . . . 179</p> <p style="MARGIN: 0px">Hide Delegate . . . 181</p> <p style="MARGIN: 0px">Remove Middle Man . . . 185</p> <p style="MARGIN: 0px">Chapter 8: Organizing Data . . . 187</p> <p style="MARGIN: 0px">Self Encapsulate Field . . . 188</p> <p style="MARGIN: 0px">Replace Data Value with Object . . . 191</p> <p style="MARGIN: 0px">Change Value to Reference . . . 194</p> <p style="MARGIN: 0px">Change Reference to Value . . . 198</p> <p style="MARGIN: 0px">Replace Array with Object . . . 201</p> <p style="MARGIN: 0px">Replace Hash with Object . . . 206</p> <p style="MARGIN: 0px">Change Unidirectional Association to Bidirectional . . . 210</p> <p style="MARGIN: 0px">Change Bidirectional Association to Unidirectional . . . 213</p> <p style="MARGIN: 0px">Replace Magic Number with Symbolic Constant . . . 217</p> <p style="MARGIN: 0px">Encapsulate Collection . . . 219</p> <p style="MARGIN: 0px">Replace Record with Data Class . . . 224</p> <p style="MARGIN: 0px">Replace Type Code with Polymorphism . . . 225</p> <p style="MARGIN: 0px">Replace Type Code with Module Extension . . . 232</p> <p style="MARGIN: 0px">Replace Type Code with State/Strategy . . . 239</p> <p style="MARGIN: 0px">Replace Subclass with Fields . . . 251</p> <p style="MARGIN: 0px">Lazily Initialized Attribute . . . 255</p> <p style="MARGIN: 0px">Eagerly Initialized Attribute . . . 257</p> <p style="MARGIN: 0px">Chapter 9: Simplifying Conditional Expressions . . . 261</p> <p style="MARGIN: 0px">Decompose Conditional . . . 261</p> <p style="MARGIN: 0px">Recompose Conditional . . . 264</p> <p style="MARGIN: 0px">Consolidate Conditional Expression . . . 265</p> <p style="MARGIN: 0px">Consolidate Duplicate Conditional Fragments . . . 268</p> <p style="MARGIN: 0px">Remove Control Flag . . . 269</p> <p style="MARGIN: 0px">Replace Nested Conditional with Guard Clauses . . . 274</p> <p style="MARGIN: 0px">Replace Conditional with Polymorphism . . . 279</p> <p style="MARGIN: 0px">Introduce Null Object . . . 284</p> <p style="MARGIN: 0px">Introduce Assertion . . . 292</p> <p style="MARGIN: 0px">Chapter 10: Making Method Calls Simpler . . . 297</p> <p style="MARGIN: 0px">Rename Method . . . 298</p> <p style="MARGIN: 0px">Add Parameter . . . 300</p> <p style="MARGIN: 0px">Remove Parameter . . . 302</p> <p style="MARGIN: 0px">Separate Query from Modifier . . . 303</p> <p style="MARGIN: 0px">Parameterize Method . . . 307</p> <p style="MARGIN: 0px">Replace Parameter with Explicit Methods . . . 310</p> <p style="MARGIN: 0px">Preserve Whole Object . . . 313</p> <p style="MARGIN: 0px">Replace Parameter with Method . . . 317</p> <p style="MARGIN: 0px">Introduce Parameter Object . . . 320</p> <p style="MARGIN: 0px">Remove Setting Method . . . 324</p> <p style="MARGIN: 0px">Hide Method . . . 327</p> <p style="MARGIN: 0px">Replace Constructor with Factory Method . . . 328</p> <p style="MARGIN: 0px">Replace Error Code with Exception . . . 332</p> <p style="MARGIN: 0px">Replace Exception with Test . . . 337</p> <p style="MARGIN: 0px">Introduce Gateway . . . 341</p> <p style="MARGIN: 0px">Introduce Expression Builder . . . 346</p> <p style="MARGIN: 0px">Chapter 11: Dealing with Generalization . . . 353</p> <p style="MARGIN: 0px">Pull Up Method . . . 353</p> <p style="MARGIN: 0px">Push Down Method . . . 356</p> <p style="MARGIN: 0px">Extract Module . . . 357</p> <p style="MARGIN: 0px">Inline Module . . . 362</p> <p style="MARGIN: 0px">Extract Subclass . . . 363</p> <p style="MARGIN: 0px">Introduce Inheritance . . . 368</p> <p style="MARGIN: 0px">Collapse Heirarchy . . . 371</p> <p style="MARGIN: 0px">Form Template Method . . . 372</p> <p style="MARGIN: 0px">Replace Inheritance with Delegation . . . 386</p> <p style="MARGIN: 0px">Replace Delegation with Hierarchy . . . 389</p> <p style="MARGIN: 0px">Replace Abstract Superclass with Module . . . 392</p> <p style="MARGIN: 0px">Chapter 12: Big Refactorings . . . 397</p> <p style="MARGIN: 0px">The Nature of the Game . . . 397</p> <p style="MARGIN: 0px">Why Big Refactorings Are Important . . . 398</p> <p style="MARGIN: 0px">Four Big Refactorings . . . 398</p> <p style="MARGIN: 0px">Tease Apart Inheritance . . . 399</p> <p style="MARGIN: 0px">Convert Procedural Design to Objects . . . 405</p> <p style="MARGIN: 0px">Separate Domain from Presentation . . . 406</p> <p style="MARGIN: 0px">Extract Hierarchy . . . 412</p> <p style="MARGIN: 0px">Chapter 13: Putting It All Together . . . 417</p> <p style="MARGIN: 0px">References . . . 421</p> <p style="MARGIN: 0px">Index . . . 423</p>

Managementboek Top 100

Rubrieken

Populaire producten

    Personen

      Trefwoorden

        Refactoring