《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 个评论

要评论图书请先登录注册

你也许想看:

The Go Programming Language

《The Go Programming Language》

Brian W. Kernighan,Alan Donovan.Addison-Wesley Professional.2015-11-23

“”

简约之美

《简约之美》

[美] Max Kanat-Alexander.人民邮电出版社.2013-1

“《简约之美:软件设计之道》将软件设计作为一门严谨的科学,阐述了开发出优雅简洁的代码所应该遵循的基本原则。作者从为什么以前...”

OpenGL 4.0 Shading Language Cookbook

《OpenGL 4.0 Shading Language Cookbook》

David Wolff.Packt Publishing.2011-7-9

“”

Objective-C 2.0程序设计

《Objective-C 2.0程序设计》

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

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

ACE程序员指南

《ACE程序员指南》

[美] Stephen D. Huston,James CE Johnson,Umar Syyid.中国电力出版社.2004-11

“本书由ACE的几位核心开发者撰写,快速而直接地解释了怎样充分利用ACE。从介绍ACE开始,循序渐进,详细讨论了ACE的I...”

Starting Out with Python

《Starting Out with Python》

Gaddis, Tony.Addison-Wesley.2011-3

“In Starting Out with Python ® , Second Edition Tony Gaddis’ ...”

编程高手箴言

《编程高手箴言》

梁肇新.电子工业出版社.2003-11-1

“”

The C++ Standard Library Extensions

《The C++ Standard Library Extensions》

Pete Becker.Addison-Wesley Professional.2006-7-31

“"TR1 roughly doubles the size of the C++ standard library, a...”

写给大家看的C++书

《写给大家看的C++书》

Larry Ullman,Andreas Signer.人民邮电出版社.2009.7

“在这个信息技术无所不在的时代,编程能力正在变得越来越重要。C++以高性能、易移植而著称,而且同时支持过程式、面向对象和泛...”

Django Design Patterns and Best Practices

《Django Design Patterns and Best Practices》

Arun Ravindran.Packt Publishing - ebooks Account.2015-3-26

“”

WCF全面解析(上下册)

《WCF全面解析(上下册)》

蒋金楠.电子工业出版社.2012-4

“《WCF全面解析(套装上下册)》由蒋金楠所著,是作者多年潜心研究WCF技术的心血之作,也是这些年来从事WCF开发的经验总...”

Mastering Python Regular Expressions

《Mastering Python Regular Expressions》

Félix López,Víctor Romero.Packt Publishing - ebooks Account.2014-2-26

“”

Spring Boot in Action

《Spring Boot in Action》

Craig Walls.Manning Publications.2016-1-3

“”

Autotools

《Autotools》

John Calcote.No Starch Press.2010-7-20

“The GNU Autotools make it easy for developers to create soft...”

iOS 9 by Tutorials

《iOS 9 by Tutorials》

Aaron Douglas, Caroline Begbie, Chris Wagner, Derek Selander, Evan Dekhayser, James Frost, Jawwad Ahmad, Pietro Rea, Soheil Azarpour, Vincent Ngo.Razeware LLC.2015-10-7

“Learn the New iOS 9 APIs! iOS 9 introduces a ton of great ne...”

Head First SQL

《Head First SQL》

Lynn Beighley.O'Reilly Media.2007-9-1

“Head First SQL is about RDBMS (databases) specifically mySQL...”

Object-Oriented Programming With ANSI-C

《Object-Oriented Programming With ANSI-C》

Axel-Tobias Schreiner.Hanser Fachbuch.1994

“Object-oriented programming is the current cure-all — althou...”

PaaS实现与运维管理

《PaaS实现与运维管理》

余何.电子工业出版社.2016-2-1

“《PaaS实现与运维管理:基于Mesos +Docker+ELK的实战指南》主要阐述了云计算中PaaS平台的实现与运维管...”

Learn C the Hard Way

《Learn C the Hard Way》

Zed A. Shaw.Addison-Wesley Professional.2015-4-30

“Need to learn C? Now you can! Forget old-fashioned C program...”

C#高级编程(第4版)

《C#高级编程(第4版)》

Christian Nagel Bill Evjen Jay Glynn等.清华大学出版社.2006-10

“C#经典名著!也是Wrox红皮书中最畅销的品种之一,从第一版开始就名满天下;其第3版被中华读书报、CSDN、《程序员》等...”