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

Book description

YouWillLearn 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.

Table of contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Contents
  5. Preface
    1. Acknowledgments
  6. The Hard Way Is Easier
    1. Reading and Writing
    2. Attention to Detail
    3. Spotting Differences
    4. Do Not Copy-Paste
    5. Using the Included Videos
    6. A Note on Practice and Persistence
    7. A Warning for the Smarties
  7. Exercise 0. The Setup
    1. Mac OS X
      1. OS X: What You Should See
    2. Windows
      1. Windows: What You Should See
    3. Linux
      1. Linux: What You Should See
    4. Finding Things on the Internet
    5. Warnings for Beginners
  8. Exercise 1. A Good First Program
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  9. Exercise 2. Comments and Pound Characters
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  10. Exercise 3. Numbers and Math
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  11. Exercise 4. Variables and Names
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  12. Exercise 5. More Variables and Printing
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  13. Exercise 6. Strings and Text
    1. What You Should See
    2. Study Drills
    3. Common Student Question
  14. Exercise 7. More Printing
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  15. Exercise 8. Printing, Printing
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  16. Exercise 9. Printing, Printing, Printing
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  17. Exercise 10. What Was That?
    1. What You Should See
    2. Escape Sequences
    3. Study Drills
    4. Common Student Questions
  18. Exercise 11. Asking Questions
    1. What You Should See
    2. Study Drills
    3. Common Student Question
  19. Exercise 12. Prompting People for Numbers
    1. What You Should See
    2. Study Drills
  20. Exercise 13. Parameters, Unpacking, Variables
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  21. Exercise 14. Prompting and Passing
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  22. Exercise 15. Reading Files
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  23. Exercise 16. Reading and Writing Files
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  24. Exercise 17. More Files
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  25. Exercise 18. Names, Variables, Code, Functions
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  26. Exercise 19. Functions and Variables
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  27. Exercise 20. Functions and Files
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  28. Exercise 21. Functions Can Return Something
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  29. Exercise 22. What Do You Know So Far?
    1. What You Are Learning
  30. Exercise 23. Read Some Code
  31. Exercise 24. More Practice
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  32. Exercise 25. Even More Practice
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  33. Exercise 26. Congratulations, Take a Test!
    1. Common Student Questions
  34. Exercise 27. Memorizing Logic
    1. The Truth Terms
    2. The Truth Tables
    3. Common Student Question
  35. Exercise 28. Boolean Practice
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  36. Exercise 29. What If
    1. What You Should See
    2. Study Drills
    3. Common Student Question
  37. Exercise 30. Else and If
    1. What You Should See
    2. Study Drills
    3. Common Student Question
  38. Exercise 31. Making Decisions
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  39. Exercise 32. Loops and Arrays
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  40. Exercise 33. While Loops
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  41. Exercise 34. Accessing Elements of Arrays
    1. Study Drills
  42. Exercise 35. Branches and Functions
    1. What You Should See
    2. Study Drills
    3. Common Student Questions
  43. Exercise 36. Designing and Debugging
    1. Rules for If-Statements
    2. Rules for Loops
    3. Tips for Debugging
    4. Homework
  44. Exercise 37. Symbol Review
    1. Keywords
    2. Data Types
    3. String Escape Sequences
    4. Operators
    5. Reading Code
    6. Study Drills
    7. Common Student Question
  45. Exercise 38. Doing Things to Arrays
    1. What You Should See
    2. What Arrays Can Do
    3. When to Use Arrays
    4. Study Drills
    5. Common Student Questions
  46. Exercise 39. Hashes, Oh Lovely Hashes
    1. A Hash Example
    2. What You Should See
    3. What Hashes Can Do
    4. Making Your Own Hash Module
    5. The Code Description
    6. Three Levels of Arrays
    7. What You Should See (Again)
    8. When to Use Hashes or Arrays
    9. Study Drills
    10. Common Student Questions
  47. Exercise 40. Modules, Classes, and Objects
    1. Modules Are Like Hashes
      1. Classes Are Like Modules
      2. Objects Are Like Require
      3. Getting Things from Things
      4. A First Class Example
    2. What You Should See
    3. Study Drills
    4. Common Student Question
  48. Exercise 41. Learning to Speak Object Oriented
    1. Word Drills
    2. Phrase Drills
    3. Combined Drills
    4. A Reading Test
    5. Practice English to Code
    6. Reading More Code
    7. Common Student Questions
  49. Exercise 42. Is-A, Has-A, Objects, and Classes
    1. How This Looks in Code
    2. Study Drills
    3. Common Student Questions
  50. Exercise 43. Basic Object-Oriented Analysis and Design
    1. The Analysis of a Simple Game Engine
      1. Write or Draw about the Problem
      2. Extract Key Concepts and Research Them
      3. Create a Class Hierarchy and Object Map for the Concepts
      4. Code the Classes and a Test to Run Them
      5. Repeat and Refine
    2. Top Down Versus Bottom Up
    3. The Code for ”Gothons from Planet Percal #25”
    4. What You Should See
    5. Study Drills
    6. Common Student Question
  51. Exercise 44. Inheritance Versus Composition
    1. What Is Inheritance?
      1. Implicit Inheritance
      2. Override Explicitly
      3. Alter Before or After
      4. All Three Combined
      5. Using super() with initialize
    2. Composition
    3. When to Use Inheritance or Composition
    4. Study Drills
    5. Common Student Questions
  52. Exercise 45. You Make a Game
    1. Evaluating Your Game
    2. Function Style
    3. Class Style
    4. Code Style
    5. Good Comments
    6. Evaluate Your Game
  53. Exercise 46. A Project Skeleton
    1. Creating the Skeleton Project Directory
      1. Final Directory Structure
    2. Testing Your Setup
    3. Using the Skeleton
    4. Required Quiz
    5. Common Student Questions
  54. Exercise 47. Automated Testing
    1. Writing a Test Case
    2. Testing Guidelines
    3. What You Should See
    4. Study Drills
    5. Common Student Questions
  55. Exercise 48. Advanced User Input
    1. Our Game Lexicon
      1. Breaking Up a Sentence
      2. Lexicon Tuples
      3. Scanning Input
      4. Exceptions and Numbers
    2. A Test First Challenge
    3. What You Should Test
    4. Study Drills
    5. Common Student Questions
  56. Exercise 49. Making Sentences
    1. Match and Peek
    2. The Sentence Grammar
    3. A Word on Exceptions
    4. The Parser Code
    5. Playing with the Parser
    6. What You Should Test
    7. Study Drills
    8. Common Student Question
  57. Exercise 50. Your First Website
    1. Installing Sinatra
    2. Make a Simple ”Hello World” Project
    3. What’s Happening Here?
    4. Stopping and Reloading Sinatra
    5. Fixing Errors
    6. Create Basic Templates
    7. Study Drills
    8. Common Student Questions
  58. Exercise 51. Getting Input from a Browser
    1. How the Web Works
    2. How Forms Work
    3. Creating HTML Forms
    4. Creating a Layout Template
    5. Writing Automated Tests for Forms
    6. Study Drills
    7. Common Student Question
  59. Exercise 52. The Start of Your Web Game
    1. Refactoring the Exercise 43 Game
    2. Sessions and Tracking Users
    3. Creating an Engine
    4. Your Final Exam
  60. Next Steps
    1. How to Learn Any Programming Language
  61. Advice from an Old Programmer
  62. Appendix. Command Line Crash Course
    1. Introduction: Shut Up and Shell
      1. How to Use This Appendix
      2. You Will Be Memorizing Things
    2. The Setup
      1. Do This
      2. You Learned This
      3. Do More
    3. Paths, Folders, and Directories (pwd)
      1. Do This
      2. You Learned This
      3. Do More
    4. If You Get Lost
      1. Do This
      2. You Learned This
    5. Make a Directory (mkdir)
      1. Do This
      2. You Learned This
      3. Do More
    6. Change Directory (cd)
      1. Do This
      2. You Learned This
      3. Do More
    7. List Directory (ls)
      1. Do This
      2. You Learned This
      3. Do More
    8. Remove Directory (rmdir)
      1. Do This
      2. You Learned This
      3. Do More
    9. Moving Around (pushd, popd)
      1. Do This
      2. You Learned This
      3. Do More
    10. Making Empty Files (Touch, New-Item)
      1. Do This
      2. You Learned This
      3. Do More
    11. Copy a File (cp)
      1. Do This
      2. You Learned This
      3. Do More
    12. Moving a File (mv)
      1. Do This
      2. You Learned This
      3. Do More
    13. View a File (less, MORE)
      1. Do This
      2. You Learned This
      3. Do More
    14. Stream a File (cat)
      1. Do This
      2. You Learned This
      3. Do More
    15. Removing a File (rm)
      1. Do This
      2. You Learned This
      3. Do More
    16. Exiting Your Terminal (exit)
      1. Do This
      2. You Learned This
      3. Do More
    17. Command Line Next Steps
      1. UNIX Bash References
      2. PowerShell References
  63. Index
  64. Where are the Companion Content Files?
  65. Code Snippets

Product information

  • Title: Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World of Computational Thinking with Code, Third Edition
  • Author(s):
  • Release date: December 2014
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780133135633