Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World Of Computational Thinking with Code (3rd Edition) (Zed Shaw's Hard Way Series)
Format: PDF / Kindle (mobi) / ePub
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
• 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.
Importing some things and see if you can get it right. It's alright if you do not. This script is really annoying. There's no need to ask you before doing the copy, and it prints too much out to the screen. Try to make it more friendly to use by removing features. See how short you can make the script. I could make this 1 line long. Notice at the end of the WYSS I used something called cat? It's an old command that "con*cat*enates" files together, but mostly it's just an easy way to print a.
The last exercise you worked out some if-statements, and then tried to guess what they are and how they work. Before you learn more I'll explain what everything is by answering the questions you had from extra credit. You did the extra credit right? What do you think the if does to the code under it? An if statement creates what is called a "branch" in the code. It's kind of like those choose your own adventure books where you are asked to turn to one page if you make one choice, and another if.
Pay close attention to how I changed the last line of the / block so it calls erb passing in your greeting variable. Once you have that in place, reload the web page in your browser and you should see a different message in green. You should also be able to do a View Source on the page in your browser to see that it is valid HTML. This may have flown by you very fast, so let me explain how a template works: In your lib/gothonweb.rb you've added a new erb method call. The erb method knows how.
With them. Actually, I always knew that, but I'd get distracted by the languages and forget it periodically. Now I never forget it, and neither should you. Which programming language you learn and use doesn't matter. Do not get sucked into the religion surrounding programming languages as that will only blind you to their true purpose of being your tool for doing interesting things. Programming as an intellectual activity is the only art form that allows you to create interactive art. You can.
Have a good foundation for moving onto another book. You might not really learn "programming" from this book, but you will learn the foundation skills you need to start learning the language. This book's job is to teach you the three most essential skills that a beginning programmer needs to know: Reading and Writing, Attention to Detail, Spotting Differences. Reading and Writing It seems stupidly obvious, but, if you have a problem typing, you will have a problem learning to code.