重构 ruby版 英文原版 Refactoring Ruby Edition

5星(超过95%的资源)
所需积分/C币:19 2018-05-17 14:04:25 3.23MB PDF
21
收藏 收藏
举报

重构 ruby版 英文原版 Refactoring Ruby Edition 高清
Addison-Wesley Professional Ruby Series Obie Fernandez. Series Editor DESIGN DISTRIBUTED PROGRAMMING REFAC TORING PATTERNS WITH RUBY THE RAILS WAY IN RUBY SS OLSEN MARK BATES A Addison-Wesley Visit informit. com/ruby for a complete list of available products he Addison-Wesley Professional Ruby Series provides readers with practical, people-oriented, and in-depth information about applying the Ruby platform to create dynamic technology solutions The series is based on the premise that the need for expert reference books, written by experienced practitioners, will never be satisfied solely by blogs and the internet PEARSON AAddison-Wesley cisco Press EXAM CRAM BM Que prENTICE S/MS I Safari Refactoring Ruby edition Jay Fields Shane harvie Martin fowler with Kent black W Addison-Wesley Upper Saddle river,NJ· Boston· Indianapolis· San francisco New York· Toronto· Montreal· London· Munich· Paris· Madrid Cape Town· Sydney· Tokyo· Singapore· Mexico City Many of the designations used by manufacturers and sellers to Associate publisher distinguish their products are claimed as trademarks. Where those Mark taub designations appear in this book, and the publisher was aware of a Acquisitions Editor trademark claim, the designations have been printed with initial capital Greg Doench letters or in all capitals Managing Editor The authors and publisher have taken care in the preparation of this Krist book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed Project Editor for incidental or consequential damages in connection with or arising Andy beaster out of the use of the information or programs contained herein Copy editor The publisher offers excellent discounts on this book when ordered Genel breeze in quantity for bulk purchases or special sales, which may include Indexer electronic versions and/or custom covers and content particular to your Erika mille business, training goals, marketing focus, and branding interests. For Proofreader more information, please contact Jennifer gallant U.S. Corporate and government sales Technical reviewers (800)382-3419 Chad Fowler corpsales@pearsontechgroup.com Clinton Begin For sales outside the United States please contact Justin gehtland International sales Publishing international@pearson.com Coordinator Visit us on the Web: informit. com/aw Michelle housle Cover D Library of Congress Cataloging-in-Publication Data Chuti Prasertsith Fields, Jay, 1979- Compositor Refactoring/ Jay Fields, Shane Harvie, and Martin Fowler --Ruby ed Jake Mcfarland ISBN-13: 978-0-321-60350-0(hardback: alk. paper) ISBN-10: 0-321-60350-8(hardback alk paper) 1. Software refactoring. 2. Ruby(Computer program language) I. Harvie, Shane, 1980-II. Fowler, Martin, 1963-IIL. Title. QA7676.R42F542010 005.117-dc22 2009027577 ht o 2010 Pearson Education inc All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying recording, or likewise. For information regarding permissions, write to Pearson Education. Inc. Rights and Contracts Department 501 Boylston Str te900 Boston MA 02116 Fax(617)6713447 ISBN-13:978-0-321-60350-0 ISBN-10:0-321-60350-8 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana First printing october 2009 To Dana, the love of my life, thank you for your endless patience and support” Jay field "To Jan, my sounding board for many a bad idea and questionable opinion, thank you for never judging -Shane harvie For Cindy Martin fowle This page intentionally left blank Contents Foreword Pref Acknowledgments........ XX About the authors XXII Chapter 1: Refactoring a First Example The Starting Point..... 2 The First Step in refactoring Decomposing and redistributing the statement method Replacing the conditional logic on Price Code with polymorphism .. 32 Final Thoughts ,,,,,,,,50 Chapter 2: Principles in Refactoring 51 Where Did Refactoring Come From? 51 Defining Refactoring 52 Why Should You refactor? 54 When Should You refactor 57 Why Refactoring Works 60 What do i Tell my manager ,,,,61 Indirection and Refactoring 61 Problems with refactoring ,,,,,,,,,,,,,,,,,,,,63 Refactoring and design 67 It Takes a While to Create Nothing 69 Refactoring and Performance .70 Optimizing a payroll System ,71 CONTENTS Chapter 3 Bad Smells in Code............... 73 Duplicated code 74 Long method 4 Large cl 76 ong Parameter List ,.,,,,,,,,,76 Divergent Change Shotgun Surgery ......... Feature envy Data Clumps. 79 Primitive obsession 79 Case statements 80 Parallel inheritance hierarchies Lazy class. peculative generality. Temporary Field 82 Message Chains.... Middle man 83 Inappropriate Intimacy ,,,83 Alternative classes with different interfaces Incomplete Library class 84 Data class 84 Refu B 84 Comments.,,,,,,,,,,, 85 Metaprogramming Madness......... 86 Disjointed API 86 Repetitive boilerplate 86 Chapter 4: Building Tests 87 The Value of Self-Testing Code The Test: Unit Testing Framework 88 Developer and Quality Assurance Tests 91 Adding More Tests CoNTENTS Chapter 5: Toward a Catalog of refactorings 97 Format of the refactorings 97 Finding References.............. 9 Chapter 6: Composing Methods 101 Extract Method 102 Inline method ,108 Inline Temp...... 110 Replace Temp with Query. 111 Replace temp with chain 114 Introduce Explaining variable. 117 Split temporary variable ,121 Remove Assignments to Parameters 124 Replace method with Method Object ,127 Substitute algorithm 131 Replace loop with Collection Closure Method 133 Extract Surrounding method 135 Introduce class annotation ····· 139 Introduce named parameter 142 Remove Named Parameter 147 Remove Unused default parameter 150 Dynamic Method Definition 152 Replace dynamic Receptor with Dynamic Method Definition 158 Isolate dynamic receptor 160 Move Eval from Runtime to parse Time 165 Chapter 7: Moving Features between Objects......... 167 Move Method 167 Move Field 172 Extract class ,175 Inline class 179 Hide delegate 181 Remove Middle man 185

...展开详情
试读 127P 重构 ruby版 英文原版 Refactoring Ruby Edition
立即下载 低至0.43元/次 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
gnuser 资源不错,清晰
2020-06-04
回复
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
关注 私信
上传资源赚钱or赚积分
最新推荐
重构 ruby版 英文原版 Refactoring Ruby Edition 19积分/C币 立即下载
1/127
重构 ruby版 英文原版 Refactoring Ruby Edition第1页
重构 ruby版 英文原版 Refactoring Ruby Edition第2页
重构 ruby版 英文原版 Refactoring Ruby Edition第3页
重构 ruby版 英文原版 Refactoring Ruby Edition第4页
重构 ruby版 英文原版 Refactoring Ruby Edition第5页
重构 ruby版 英文原版 Refactoring Ruby Edition第6页
重构 ruby版 英文原版 Refactoring Ruby Edition第7页
重构 ruby版 英文原版 Refactoring Ruby Edition第8页
重构 ruby版 英文原版 Refactoring Ruby Edition第9页
重构 ruby版 英文原版 Refactoring Ruby Edition第10页
重构 ruby版 英文原版 Refactoring Ruby Edition第11页
重构 ruby版 英文原版 Refactoring Ruby Edition第12页
重构 ruby版 英文原版 Refactoring Ruby Edition第13页
重构 ruby版 英文原版 Refactoring Ruby Edition第14页
重构 ruby版 英文原版 Refactoring Ruby Edition第15页
重构 ruby版 英文原版 Refactoring Ruby Edition第16页
重构 ruby版 英文原版 Refactoring Ruby Edition第17页
重构 ruby版 英文原版 Refactoring Ruby Edition第18页
重构 ruby版 英文原版 Refactoring Ruby Edition第19页
重构 ruby版 英文原版 Refactoring Ruby Edition第20页

试读结束, 可继续阅读

19积分/C币 立即下载 >