Home > Store

Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World Of Computational Thinking with Code, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World Of Computational Thinking with Code, 3rd Edition

Best Value Purchase

Book + eBook Bundle

  • Your Price: $43.19
  • List Price: $71.98
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

More Purchase Options

Book

  • Your Price: $31.99
  • List Price: $39.99
  • Usually ships in 24 hours.

eBook (Watermarked)

  • Your Price: $25.59
  • List Price: $31.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

About

Features

  • A disciplined, practice-driven training method that works, from top blogger and outstanding teacher Zed Shaw
  • Moves from the absolute basics through functions, files, variables, lists, objects -- all the way to building a real web-based game
  • CD contains 5+ hours of teaching video
  • Refined through Shaw's years of teaching online, where he attracts thousands of visitors per day

Description

  • Copyright 2015
  • Dimensions: 7" x 9-1/8"
  • Pages: 336
  • Edition: 3rd
  • Book
  • ISBN-10: 0-321-88499-X
  • ISBN-13: 978-0-321-88499-2

You Will Learn Ruby!

Zed Shaw has perfected the world’s best system for learning Ruby. Follow it and you will succeed–just like the hundreds of thousands of beginners Zed has taught to date! You bring the discipline, commitment, and persistence; the author supplies everything else.

In Learn Ruby the Hard Way, Third Edition, you’ll learn Ruby by working through 52 brilliantly crafted exercises. Read them. Type their code precisely. (No copying and pasting!) Fix your mistakes. Watch the programs run. As you do, you’ll learn how software works; what good programs look like; how to read, write, and think about code; and how to find and fix your mistakes using tricks professional programmers use. Most importantly, you’ll learn the following, which you need to start writing excellent Ruby software of your own:

• Installing your Ruby environment

• Organizing and writing code

• Ruby symbols and keywords

• Basic mathematics

• Variables and printing

• Strings and text

• Interacting with users

• Working with files

• Using and creating functions

• Looping and logic

• Arrays and elements

• Hashmaps

• Program design

• Object-oriented programming

• Inheritance and composition

• Modules, classes, and objects

• Project “skeleton” directories

• Debugging and automated testing

• Advanced user input

• Text processing

• Basic game development

• Basic web development

It’ll Be Hard At First. But Soon, You’ll Just Get It–And That Will Feel Great!

This tutorial will reward you for every minute you put into it. Soon, you’ll know one of the world’s most powerful, popular programming languages. You’ll be a Ruby programmer.

Watch Zed, too! The accompanying DVD contains 5+ hours of passionate, powerful teaching: a complete Ruby video course!

Zed Shaw is an avid guitar player, programmer, and writer whose books teach people all over the world how to write software. His book Learn Python the Hard Way has been read by millions of people around the world. His software has been used by many large and small companies. His essays are often quoted and read by members of many geek communities. He is an entertaining and lively writer, who is sure to keep you laughing and make you think.

Extras

Author's Site

Please visit the author's site here

Companion Site

Please visit the website associated with Learn Ruby the Hard Way at learncodethehardway.org.

Sample Content

Online Sample Chapters

Learn Ruby the Hard Way: A Good First Program

Learn Ruby the Hard Way: Comments and Pound Characters

Excerpts

Learn Ruby the Hard Way: Comments and Pound Characters

The Hard Way Is Easier: An Introduction to Learn Ruby the Hard Way

Sample Pages

Download the sample pages (includes Exercises 1-2 and Index)

Table of Contents

Preface 1

Acknowledgments 1

The Hard Way Is Easier 2

Reading and Writing 2

Attention to Detail 2

Spotting Differences 3

Do Not Copy-Paste 3

Using the Included Videos 3

A Note on Practice and Persistence 3

A Warning for the Smarties 4

Exercise 0: The Setup 6

Mac OS X 6

Windows 7

Linux 8

Finding Things on the Internet 10

Warnings for Beginners 10

Exercise 1: A Good First Program 12

What You Should See 14

Study Drills 16

Common Student Questions 17

Exercise 2: Comments and Pound Characters 18

What You Should See 18

Study Drills 18

Common Student Questions 19

Exercise 3: Numbers and Math 20

What You Should See 21

Study Drills 21

Common Student Questions 22

Exercise 4: Variables and Names 24

What You Should See 25

Study Drills 25

Common Student Questions 25

Exercise 5: More Variables and Printing 28

What You Should See 28

Study Drills 29

Common Student Questions 29

Exercise 6: Strings and Text 30

What You Should See 31

Study Drills 31

Common Student Question 31

Exercise 7: More Printing 32

What You Should See 32

Study Drills 33

Common Student Questions 33

Exercise 8: Printing, Printing 34

What You Should See 34

Study Drills 35

Common Student Questions 35

Exercise 9: Printing, Printing, Printing 36

What You Should See 36

Study Drills 37

Common Student Questions 37

Exercise 10: What Was That? 38

What You Should See 39

Escape Sequences 39

Study Drills 40

Common Student Questions 40

Exercise 11: Asking Questions 42

What You Should See 42

Study Drills 43

Common Student Question 43

Exercise 12: Prompting People for Numbers 44

What You Should See 44

Study Drills 44

Exercise 13: Parameters, Unpacking, Variables 46

What You Should See 46

Study Drills 47

Common Student Questions 47

Exercise 14: Prompting and Passing 50

What You Should See 50

Study Drills 51

Common Student Questions 51

Exercise 15: Reading Files 52

What You Should See 53

Study Drills 53

Common Student Questions 54

Exercise 16: Reading and Writing Files 56

What You Should See 57

Study Drills 57

Common Student Questions 58

Exercise 17: More Files 60

What You Should See 60

Study Drills 61

Common Student Questions 61

Exercise 18: Names, Variables, Code, Functions 62

What You Should See 63

Study Drills 64

Common Student Questions 65

Exercise 19: Functions and Variables 66

What You Should See 67

Study Drills 67

Common Student Questions 67

Exercise 20: Functions and Files 70

What You Should See 71

Study Drills 71

Common Student Questions 71

Exercise 21: Functions Can Return Something 74

What You Should See 75

Study Drills 75

Common Student Questions 76

Exercise 22: What Do You Know So Far? 78

What You Are Learning 78

Exercise 23: Read Some Code 80

Exercise 24: More Practice 82

What You Should See 83

Study Drills 83

Common Student Questions 83

Exercise 25: Even More Practice 84

What You Should See 85

Study Drills 87

Common Student Questions 87

Exercise 26: Congratulations, Take a Test! 88

Common Student Questions 88

Exercise 27: Memorizing Logic 90

The Truth Terms 90

The Truth Tables 91

Common Student Question 92

Exercise 28: Boolean Practice 94

What You Should See 96

Study Drills 96

Common Student Questions 96

Exercise 29: What If 98

What You Should See 99

Study Drills 99

Common Student Question 99

Exercise 30: Else and If 100

What You Should See 101

Study Drills 101

Common Student Question 101

Exercise 31: Making Decisions 102

What You Should See 103

Study Drills 103

Common Student Questions 103

Exercise 32: Loops and Arrays 106

What You Should See 108

Study Drills 108

Common Student Questions 108

Exercise 33: While Loops 110

What You Should See 111

Study Drills 112

Common Student Questions 112

Exercise 34: Accessing Elements of Arrays 114

Study Drills 115

Exercise 35: Branches and Functions 116

What You Should See 118

Study Drills 118

Common Student Questions 118

Exercise 36: Designing and Debugging 120

Rules for If-Statements 120

Rules for Loops 120

Tips for Debugging 121

Homework 121

Exercise 37: Symbol Review 122

Keywords 122

Data Types 124

String Escape Sequences 124

Operators 125

Reading Code 126

Study Drills 126

Common Student Question 127

Exercise 38: Doing Things to Arrays 128

What You Should See 129

What Arrays Can Do 129

When to Use Arrays 130

Study Drills 131

Common Student Questions 131

Exercise 39: Hashes, Oh Lovely Hashes 132

A Hash Example 133

What You Should See 135

What Hashes Can Do 136

Making Your Own Hash Module 136

The Code Description 140

Three Levels of Arrays 142

What You Should See (Again) 142

When to Use Hashes or Arrays 143

Study Drills 143

Common Student Questions 144

Exercise 40: Modules, Classes, and Objects 146

Modules Are Like Hashes 146

What You Should See 151

Study Drills 151

Common Student Question 151

Exercise 41: Learning to Speak Object Oriented 152

Word Drills 152

Phrase Drills 152

Combined Drills 153

A Reading Test 153

Practice English to Code 156

Reading More Code 156

Common Student Questions 156

Exercise 42: Is-A, Has-A, Objects, and Classes 158

How This Looks in Code 159

Study Drills 161

Common Student Questions 161

Exercise 43: Basic Object-Oriented Analysis and Design 164

The Analysis of a Simple Game Engine 165

Top Down Versus Bottom Up 170

The Code for ”Gothons from Planet Percal #25” 170

What You Should See 176

Study Drills 177

Common Student Question 177

Exercise 44: Inheritance Versus Composition 178

What Is Inheritance? 178

Composition 183

When to Use Inheritance or Composition 185

Study Drills 186

Common Student Questions 186

Exercise 45: You Make a Game 188

Evaluating Your Game 188

Function Style 189

Class Style 189

Code Style 190

Good Comments 190

Evaluate Your Game 191

Exercise 46: A Project Skeleton 192

Creating the Skeleton Project Directory 192

Testing Your Setup 195

Using the Skeleton 195

Required Quiz 195

Common Student Questions 196

Exercise 47: Automated Testing 198

Writing a Test Case 198

Testing Guidelines 201

What You Should See 201

Study Drills 202

Common Student Questions 202

Exercise 48: Advanced User Input 204

Our Game Lexicon 204

A Test First Challenge 206

What You Should Test 207

Study Drills 209

Common Student Questions 210

Exercise 49: Making Sentences 212

Match and Peek 212

The Sentence Grammar 213

A Word on Exceptions 213

The Parser Code 213

Playing with the Parser 216

What You Should Test 217

Study Drills 217

Common Student Question 217

Exercise 50: Your First Website 218

Installing Sinatra 218

Make a Simple ”Hello World” Project 219

What’s Happening Here? 220

Stopping and Reloading Sinatra 221

Fixing Errors 221

Create Basic Templates 222

Study Drills 223

Common Student Questions 223

Exercise 51: Getting Input from a Browser 224

How the Web Works 224

How Forms Work 226

Creating HTML Forms 227

Creating a Layout Template 228

Writing Automated Tests for Forms 229

Study Drills 230

Common Student Question 231

Exercise 52: The Start of Your Web Game 232

Refactoring the Exercise 43 Game 232

Sessions and Tracking Users 237

Creating an Engine 238

Your Final Exam 240

Next Steps 242

How to Learn Any Programming Language 243

Advice from an Old Programmer 246

Appendix: Command Line Crash Course 249

Introduction: Shut Up and Shell 249

The Setup 251

Paths, Folders, and Directories (pwd) 254

If You Get Lost 256

Make a Directory (mkdir) 257

Change Directory (cd) 260

List Directory (ls) 264

Remove Directory (rmdir) 269

Moving Around (pushd, popd) 273

Making Empty Files (Touch, New-Item) 276

Copy a File (cp) 277

Moving a File (mv) 281

View a File (less, MORE) 283

Stream a File (cat) 285

Removing a File (rm) 286

Exiting Your Terminal (exit) 289

Command Line Next Steps 290

Index 291

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020