Eloquent Ruby

Eloquent Ruby

Einband:
Kartonierter Einband
EAN:
9780321584106
Genre:
IT Encyclopedias
Autor:
Russ Olsen
Herausgeber:
Pearson International
Erscheinungsdatum:
11.02.2011

It's easy to write correct Ruby code, but to gain the fluency needed to write great Ruby code, you must go beyond syntax and absorb the Ruby way of thinking and problem solving. In Eloquent Ruby, Russ Olsen helps you write Ruby like true Rubyists doso you can leverage its immense, surprising power.Olsen draws on years of experience internalizing the Ruby culture and teaching Ruby to other programmers. He guides you to the Ah Ha! moments when it suddenly becomes clear why Ruby works the way it does, and how you can take advantage of this language's elegance and expressiveness.Eloquent Rubystarts small, answering tactical questions focused on a single statement, method, test, or bug. You'll learn how to write code that actually looks like Ruby (not Java or C#); why Ruby has so many control structures; how to use strings, expressions, and symbols; and what dynamic typing is really good for.Next, the book addresses bigger questions related to building methods and classes. You'll discover why Ruby classes contain so many tiny methods, when to use operator overloading, and when to avoid it. Olsen explains how to write Ruby code that writes its own codeand why you'll want to. He concludes with powerful project-level features and techniques ranging from gems to Domain Specific Languages.A part of the renowned Addison-Wesley Professional Ruby Series, Eloquent Ruby will help you put on your Ruby-colored glasses and get results that make you a true believer.

Autorentext
Russ Olsen’s career spans three decades, during which he has written everything from graphics device drivers to document management applications. These days, he diligently codes GIS, web service security, and process automation solutions. He spends much of his otherwise free time writing and speaking about programming, especially Ruby and Clojure. His first book was the highly regarded Design Patterns In Ruby (Addison-Wesley, 2007). He is also the lurking presence behind the Technology As If People Mattered blog at www.russolsen.com.

Inhalt
Foreword xixPreface xxiAcknowledgments xxvAbout the Author xxviiPART I: The Basics 1Chapter 1: Write Code That Looks Like Ruby 3The Very Basic Basics 4Go Easy on the Comments 6Camels for Classes, Snakes Everywhere Else 8Parentheses Are Optional but Are Occasionally Forbidden 9Folding Up Those Lines 10Folding Up Those Code Blocks 11Staying Out of Trouble 12In the Wild 13Wrapping Up 15Chapter 2: Choose the Right Control Structure 17If, Unless, While, and Until 17Use the Modifier Forms Where Appropriate 19Use each, Not for 20A Case of Programming Logic 21Staying Out of Trouble 23In the Wild 25Wrapping Up 27Chapter 3: Take Advantage of Ruby's Smart Collections 29Literal Shortcuts 29Instant Arrays and Hashes from Method Calls 30Running Through Your Collection 33Beware the Bang! 36Rely on the Order of Your Hashes 38In the Wild 38Staying Out of Trouble 40Wrapping Up 42Chapter 4: Take Advantage of Ruby's Smart Strings 43Coming Up with a String 44Another API to Master 47The String: A Place for Your Lines, Characters, and Bytes 49In the Wild 50Staying Out of Trouble 51Wrapping Up 52Chapter 5: Find the Right String with Regular Expressions 53Matching One Character at a Time 54Sets, Ranges, and Alternatives 55The Regular Expression Star 57Regular Expressions in Ruby 58Beginnings and Endings 60In the Wild 62Staying Out of Trouble 63Wrapping Up 64Chapter 6: Use Symbols to Stand for Something 65The Two Faces of Strings 65Not Quite a String 66Optimized to Stand for Something 67In the Wild 69Staying Out of Trouble 70Wrapping Up 71Chapter 7: Treat Everything Like an ObjectBecause Everything Is 73A Quick Review of Classes, Instances, and Methods 74Objects All the Way Down 76The Importance of Being an Object 77Public, Private, and Protected 79In the Wild 81Staying Out of Trouble 82Wrapping Up 84Chapter 8: Embrace Dynamic Typing 85Shorter Programs, But Not the Way You Think 85Extreme Decoupling 89Required Ceremony Versus Programmer-Driven Clarity 92Staying Out of Trouble 93In the Wild 94Wrapping Up 96Chapter 9: Write Specs! 97Test::Unit: When Your Documents Just Have to Work 98A Plethora of Assertions 101Don't Test It, Spec It! 101A Tidy Spec Is a Readable Spec 104Easy Stubs 105. . . And Easy Mocks 107In the Wild 108Staying Out of Trouble 110Wrapping Up 113PART II: Classes, Modules, and Blocks 115Chapter 10: Construct Your Classes from Short, Focused Methods 117Compressing Specifications 117Composing Methods for Humans 121Composing Ruby Methods 122One Way Out? 123Staying Out of Trouble 126In the Wild 127Wrapping Up 128Chapter 11: Define Operators Respectfully 129Defining Operators in Ruby 129A Sampling of Operators 131Operating Across Classes 134Staying Out of Trouble 135In the Wild 137Wrapping Up 139Chapter 12: Create Classes That Understand Equality 141An Identifier for Your Documents 141An Embarrassment of Equality 142Double Equals for Everyday Use 143Broadening the Appeal of the == Method 145Well-Behaved Equality 146Triple Equals for Case Statements 149Hash Tables and the eql? Method 150Building a Well-Behaved Hash Key 152Staying Out of Trouble 153In the Wild 154Wrapping Up 156Chapter 13: Get the Behavior You Need with Singleton and Class Methods 157A Stubby Puzzle 158A Hidden, but Real Class 160Class Methods: Singletons in Plain Sight 162In the Wild 164Staying Out of Trouble 165Wrapping Up 167Chapter 14: Use Class Instance Variables 169A Quick Review of Class Variables 169Wandering Variables 171Getting Control of the Data in Your Class 174Class Instance Variables and Subclasses 175Adding Some Convenience to Your Class Instance Variables 176In the Wild 177Staying Out of Trouble 179Wrapping Up 179Chapter 15: Use Modules as Name Spaces 181A Place for Your Stuff, with a Name 181A Home for Those Utility Methods 184Building Modules a Little at a Time 185Treat Modules Like the Objects That They Are 186Staying Out of Trouble 189In the Wild 190Wrapping Up 191Chapter 16: Use Modules as Mixins 193Better Books with Modules 193Mixin Modules to the Rescue 195Extending a Module 197Staying Out of Trouble 198In the Wild 202Wrapping Up 205Chapter 17: Use Blocks to Iterate 207A Quick Review of Code Blocks 207One Word after Another 209As Many Iterators as You Like 210Iterating over the Ethereal 211Enumerable: Your Iterator on Steroids 213Staying Out of Trouble 215In the Wild 217Wrapping Up 218Chapter 18: Execute Around with a Block 219Add a Little Logging 219When It Absolutely Must Happen 224Setting Up Objects with an Initialization Block 225Dragging Your Scope along with the Block 225Carrying the Answers Back 227Staying Out of Trouble 228In the Wild 229Wrapping Up 231Chapter 19: Save Blocks to Execute Later 233Explicit Blocks 233The Call Back…


billigbuch.ch sucht jetzt für Sie die besten Angebote ...

Loading...

Die aktuellen Verkaufspreise von 6 Onlineshops werden in Realtime abgefragt.

Sie können das gewünschte Produkt anschliessend direkt beim Anbieter Ihrer Wahl bestellen.