《Confident Ruby》

《Confident Ruby》 《Confident Ruby》

  • 书名:《Confident Ruby》:32 Patterns for Joyful Coding
  • 分类:编程
  • 作者:Avdi Grimm
  • 出版年:2013-10-22
  • 售价:USD 35.00
  • 装订:PDF/EPUB
  • 页码:282

《Confident Ruby》 内容介绍:

For many programmers, discovering Ruby is a revelation. They are overjoyed by how elegantly and succinctly they can state problems in the language. But then the real world creeps in, and that joy gradually wanes as the code becomes cluttered with distracting edge case scenarios, error handling, and checks for nil. Confident Ruby is a guide to recapturing the joy of writing Ruby by employing small patterns and stylistic choices to make each method tell a coherent story. Over the course of 32 patterns, you’ll learn how to isolate uncertainty at the borders of your code; how to avoid repetitive conditionals; and how to liberate your code from the chore of nil-checking. You’ll discover the four parts of a method, and how to use those parts to construct a narrative. Following along with real-world refactoring sessions, you’ll learn how to apply these lessons to legacy code. Whether you are a novice or an experienced Ruby hacker, this book will help you become a more confident and joyful programmer.

作者Avdi Grimm介绍:

Avdi Grimm has been hacking Ruby code for over 10 years, and is still loving it. He is chief aeronaut at ShipRise, head chef at RubyTapas.com, and a co-host of the Ruby Rogues podcast. He lives in southern Pennsylvania with his wife and five children.

《Confident Ruby》 目录大纲:

Introduction
- Ruby meets the real world
- Confident code
- A good story, poorly told
- Code as narrative
- The four parts of a method
- 3.times { rejoice! }
- Collecting Input
Sending a strong message
- Conditionally call conversion methods
- Define your own conversion protocols
- Define conversions to user-defined types
- Use built-in conversion functions
- Use the Array() conversion function to array-ify inputs
- Define conversion functions
- Replace “string typing” with classes
- Wrap collaborators in Adapters
- Use transparent adapters to gradually introduce abstraction
- Reject unworkable values with preconditions
- Use #fetch to assert the presence of Hash keys
- Document assumptions with assertions
- Handle special cases with a Guard Clause
- Represent special cases as objects
- Represent do-nothing cases as null objects
- Substitute a benign value for =nil=
- Use #fetch for defaults
- Use symbols as placeholder objects
- Bundle arguments into parameter objects
- Yield a parameter builder object
- Receive policies instead of data
Delivering Output
- Write total functions
- Call back instead of returning
- Represent failure with a benign value
- Represent failure with a special case object
- Return a status object
- Yield a status object
- Signal early termination with =throw=
Handling Failure
- Prefer top-level rescue clause
- Use checked methods for risky operations
- Use bouncer methods
Refactoring for Confidence
- MetricFu
- Stringer
- Parting Words


微信扫一扫关注公众号

0 个评论

要评论图书请先登录注册

你也许想看:

C语言解惑

《C语言解惑》

Alan R.Feuer.人民邮电出版社.2007

“本书脱胎于作者在C语言的摇篮——贝尔实验室教授C语言的讲稿,几乎涵盖了C语言各个方面的难点,并包含了一些其他书籍很少分析...”

The Past, Present, and Future of JavaScript

《The Past, Present, and Future of JavaScript》

Axel Rauschmayer.O’Reilly Media, Inc..2012-7-20

“Over recent years, JavaScript has seen an impressive rise in...”

Java夜未眠

《Java夜未眠》

蔡学镛.电子工业出版社.2003-4

“本书是一本散文集。作为一名资深程序设计师,作者走笔清新面独特,简练俏皮的文字下,是作者对工作,对人生的理性思考。书中收录...”

CSS揭秘

《CSS揭秘》

[希] Lea Verou.人民邮电出版社.2016-4

“本书是一本注重实践的教程,作者为我们揭示了 47 个鲜为人知的 CSS 技巧,主要内容包括背景与边框、形状、 视觉效果、...”

学习Python(第5版)(影印版)

《学习Python(第5版)(影印版)》

Mark Lutz.东南大学出版社.2014-1

“《学习Python(第5版)(影印版)(套装共2册)》将让你获得针对核心Python语言的一次全面而又深入的介绍。基于作...”

Concurrent Programming in Mac OS X and iOS

《Concurrent Programming in Mac OS X and iOS》

Vandad Nahavandipoor.O'Reilly Media.2011-6-7

“Now that multicore processors are coming to mobile devices, ...”

Clojure Cookbook

《Clojure Cookbook》

Luke VanderHart,Ryan Neufeld.O'Reilly Media.2014-3

“Clojure Cookbook doesn't just teach you Clojure, it also sho...”

Fluent Python

《Fluent Python》

Luciano Ramalho.O'Reilly Media.2015-8-20

“Learn how to write idiomatic, effective Python code by lever...”

Objective-C 2.0程序设计

《Objective-C 2.0程序设计》

Stephen G. Kochan.机械工业出版社.2009年9月

“本书是Objective-C领域的经典著作,对Objective-C进行了系统而全面的阐述,权威性毋庸置疑。全书共分为四...”

写给大忙人看的Swift

《写给大忙人看的Swift》

【美】Matt Henderson(马特•亨德森),【美】Dave Wood(戴夫•伍德),周智勋.电子工业出版社.2015-6-1

“《写给大忙人看的Swift》全面介绍了苹果公司新推出的 Swift 编程语言。主要内容包括 Swift 语法简介, Sw...”

跟老齐学Python

《跟老齐学Python》

齐伟 编著.电子工业出版社.2016-2

“《跟老齐学Python:从入门到精通》是面向编程零基础读者的Python入门教程,内容涵盖了Python的基础知识和初步...”

JavaEE开发的颠覆者: Spring Boot实战

《JavaEE开发的颠覆者: Spring Boot实战》

汪云飞.电子工业出版社.2016-3

“在当今Java EE 开发中,Spring 框架是当之无愧的王者。而Spring Boot 是Spring 主推的基于“...”

面向ArcGIS的Python脚本编程

《面向ArcGIS的Python脚本编程》

[美] Paul A. Zandbergen 赞德伯根.人民邮电出版社.2014-10-1

“《面向ArcGIS的Python脚本编程》是一本指导ArcGIS for Desktop专业用户进行Python开发的指...”

轻量级Web应用开发

《轻量级Web应用开发》

邱俊涛.人民邮电出版社.2015-7-1

“轻量级开发是一个很宽泛的主题,开发人员经常提到这个术语,但却少有人能够讲明它的内涵。本书介绍了轻量级Web应用开发背后的...”

Practical Java中文版

《Practical Java中文版》

(美)Peter Haggar.中国电力出版社.2003-1

“本书出自第一线JAVA编程专家之手,为读者展现正确、高效、强固之JAVA代码实践方案。 这本取材广泛的掼,以不同层级的专...”

面向对象葵花宝典:思想、技巧与实践

《面向对象葵花宝典:思想、技巧与实践》

.电子工业出版社.2015-12

“《面向对象葵花宝典:思想、技巧与实践》系统地讲述了面向对象技术的相关内容,包括面向对象的基本概念、面向对象开发的流程、面...”

Unity Shaders and Effects Cookbook

《Unity Shaders and Effects Cookbook》

Lammers, Kenneth.Packt Publishing.

“”

The Swift Programming Language

《The Swift Programming Language》

苹果公司.Apple Inc..2014-6-2

“Swift is a new programming language for creating iOS and OS ...”

Android NDK Beginner's Guide

《Android NDK Beginner's Guide》

Sylvain Ratabouil.Packt Publishing.2012-1-26

“Android NDK is all about injecting high performance into you...”

Tim O'Reilly in a Nutshell

《Tim O'Reilly in a Nutshell》

O'Reilly Media, Inc..O'Reilly Media.2011-4

“It's not easy to put Tim O'Reilly in a nutshell, but with th...”