文件名称:
[Ruby最佳实践].(Ruby.Best.Practices).Gregory.T.Brown.文字版
开发工具:
文件大小: 2mb
下载次数: 0
上传时间: 2011-06-27
详细说明: Foreword Preface 1. Driving Code Through Tests A Quick Note on Testing Frameworks Designing for Testability Testing Fundamentals Well-Focused Examples Testing Exceptions Run the Whole Suite at Once Advanced Testing Techniques Using Mocks and Stubs Testing Complex Output Keeping Things Organized Embedding Tests in Library Files Test Helpers Custom Assertions Conclusions 2. Designing Beautiful APIs Designing for Convenience: Ruport’s Table( ) feature Ruby’s Secret Power: Flexible Argument Proc essing Standard Ordinal Arguments Ordinal Arguments with Optional Parameters Pseudo-Keyword Arguments Treating Arguments As an Array Ruby’s Other Secret Power: Code Blocks Working with Enumerable Using Blocks to Abstract Pre- and Postprocessing Blocks As Dynamic Callbacks Blocks for Interface Simplification Avoiding Surprises Use attr_reader, attr_writer, and attr_accessor Understand What method? and method! Mean Make Use of Custom Operators Conclusions 3. Mastering the Dynamic Toolkit BlankSlate: A BasicObject on Steroids Building Flexible Interfaces Making instance_eval( ) Optional Handling Messages with method_missing( ) and send( ) Dual-Purpose Accessors Implementing Per-Object Behavior Extending and Modifying Preexisting Code Adding New Functionality Modification via Aliasing Per-Object Modification Building Classes and Modules Programmatically Registering Hooks and Callbacks Detecting Newly Added Functionality Tracking Inheritance Tracking Mixins Conclusions 4. Text Processing and File Management Line-Based File Processing with State Tracking Regular Expressions Don’t Work Too Hard Anchors Are Your Friends Use Caution When Working with Quantifiers Working with Files Using Pathname and FileUtils The tempfile Standard Library Automatic Temporary Directory Handling Collision Avoidance Same Old I/O Operations Automatic Unlinking Text-Processing Strategies Advanced Line Processing Atomic Saves Conclusions 5. Functional Programming Techniques Laziness Can Be a Virtue (A Look at lazy.rb) Minimizing Mutable State and Reducing Side Effects Modular Code Organization Memoization Infinite Lists Higher-Order Procedures Conclusions 6. When Things Go Wrong A Process for Debugging Ruby Code Capturing the Essence of a Defect Scrutinizing Your Code Utilizing Reflection Improving inspect Output Finding Needles in a Haystack Working with Logger Conclusions 7. Reducing Cultural Barriers m17n by Example: A Look at Ruby’s CSV Standard Library Portable m17n Through UTF-8 Transcoding Source Encodings Working with Files Transcoding User Input in an Organized Fashion m17n in Standalone Scripts Inferring Encodings from Locale Customizing Encoding Defaults m17n-Safe Low-Level Text Processing Localizing Your Code Conclusions 8. Skillful Project Maintenance Exploring a Well-Organized Ruby Project (Haml) Conventions to Know About What Goes in a README Laying Out Your Library Executables Tests Examples API Documentation via RDoc Basic Documentation Techniques and Guidelines Controlling Output with RDoc Directives The RubyGems Package Manager Writing a Gem::Specification Working with Dependencies Rake: Ruby’s Built-in Build Utility Conclusions A. Writing Backward-Compatible Code B. Leveraging Ruby’s Standard Library C. Ruby Worst Practices Index ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.