Skip to main content
main-content

Über dieses Buch

Learn the principles behind object-oriented programming and within a few chapters create a fully functional Ruby application. You'll also gain a basic understanding of many ancillary technologies such as databases, XML, web frameworks, and networking - some of which are needed as part of a fully functioning Ruby application.

Based on the bestselling first and second editions, Beginning Ruby, Third Edition is a leading guide to learn Ruby from the ground up. The new edition of this book provides the same excellent introduction to Ruby as the previous editions plus updates for the newest version of Ruby 2.3. This book can also be used as a textbook or companion to a textbook on beginning Ruby programming.

The light and agile Ruby programming language remains a very popular open source scripting option for developers building today's web and even some enterprise applications. And, now, Ruby also has applications using the Raspberry Pi, popular among hobbyists and makers. Many former Java developers still use Ruby on Rails today, the most popular framework for building Ruby applications.

What You'll Learn

What are the fundamentals of Ruby and its object-oriented building blocksHow to work with Ruby libraries, gems, and documentationHow to work with files and databasesHow to write and deploy Ruby applicationsWhat are the various Ruby web frameworks and how to use themHow to do network programming with Ruby and moreWho This Book Is For

This book is for beginning programmers, programmers new to Ruby, and web developers interested in learning and knowing the foundations of the Ruby programming language.

Inhaltsverzeichnis

Frontmatter

Foundations and Scaffolding

Frontmatter

Chapter 1. Let’s Get It Started: Installing Ruby

Abstract
Ruby is a popular programming language, but not many computers have it perfectly installed by default. This chapter takes you through the steps necessary to get Ruby working on your computer.
Peter Cooper

Chapter 2. Programming == Joy: A Whistle-Stop Tour of Ruby and Object Orientation

Abstract
Depending on who you ask, programming is both a science and an art. Telling computers what to do with computer programs requires being able to think analytically, like a scientist, and conceptually, like an artist. Being an artist is essential for coming up with big ideas and being flexible enough to take unique approaches. Being a scientist is essential to understanding how and why certain methodologies need to be taken into account, and to approach testing and debugging from a logical perspective, rather than an emotional one.
Peter Cooper

Chapter 3. Ruby’s Building Blocks: Data, Expressions, and Flow Control

Abstract
Computer programs spend nearly all their time manipulating data or waiting for data to arrive from elsewhere. We type in words, phrases, and numbers; listen to music; and watch videos, while the computer performs calculations, makes decisions, and relays information to us. To write computer programs, it’s essential to understand the basics of data and its manipulation.
Peter Cooper

Chapter 4. Developing Your First Ruby Application

Abstract
Up to this point, we’ve focused on covering the basics of the Ruby language and how it works at the ground level. In this chapter, we’ll move into the world of real software development and develop a complete, though very basic, Ruby application with a basic set of features. Once we’ve developed and tested the basic application, we’ll look at different ways to extend it to become more useful. On our way, we’ll cover some new facets of development that haven’t been mentioned so far.
Peter Cooper

Chapter 5. The Ruby Ecosystem

Abstract
As with other programming languages, Ruby has its own culture and “ecosystem.” Ruby’s ecosystem is made up of thousands of developers, maintainers, documenters, bloggers, companies, and those who help sponsor or fund the development of the language.
Peter Cooper

The Core of Ruby

Frontmatter

Chapter 6. Classes, Objects, and Modules

Abstract
In Chapter 2 we dived straight into the principles of object orientation, the method of representing concepts in Ruby by using classes and objects. Since then we’ve looked at Ruby’s standard classes, such as String and Array; worked with them; and then branched off to look at Ruby’s logic and other core features.
Peter Cooper

Chapter 7. Projects and Libraries

Abstract
In previous chapters we’ve looked at and worked with Ruby from a low-level perspective by working directly with classes, objects, and functions. Each line of code we’ve used in the small projects so far has been written specifically for that project from scratch. In this chapter, we’ll look at how to build larger projects with Ruby, and how to reuse code written previously. Finally, we’ll look at how to use code already written and prepared by other developers within your own applications so that you don’t need to reinvent the wheel every time you create a new program.
Peter Cooper

Chapter 8. Documentation, Error Handling, Debugging, and Testing

Abstract
In this chapter we’re going to look at the finer details of developing reliable programs: documentation, error handling, debugging, and testing. These tasks aren’t what most people think of as “development,” but are as important to the overall process as general coding tasks. Without documenting, debugging, and testing your code, it’s unlikely that anyone but you could work on the code with much success, and you run the risk of releasing faulty scripts and applications.
Peter Cooper

Chapter 9. Files and Databases

Abstract
In this chapter, we’re going to look at how to store, process, and interact with external sources of data from our Ruby programs. In Chapter 4, we briefly looked at how to load files to get data into an application, but this chapter will extend upon that greatly and allow you to create files from scratch from your Ruby programs.
Peter Cooper

Chapter 10. Distributing Ruby Code and Libraries

Abstract
In this chapter, we’re going to look at how to distribute the Ruby code you write to other developers and users.
Peter Cooper

Chapter 11. Advanced Ruby Features

Abstract
In this chapter, we’re going to look at some advanced Ruby techniques that have not been covered in prior chapters. This chapter is the last instructional chapter in the second part of the book, and although we’ll be covering useful libraries, frameworks, and Ruby-related technologies in Part 3, this chapter rounds off the mandatory knowledge that any proficient Ruby programmer should have. This means that although this chapter will jump between several different topics, each is essential to becoming a professional Ruby developer.
Peter Cooper

Chapter 12. Tying It Together: Developing a Larger Ruby Application

Abstract
In this chapter, we’re going to step back from focusing on individual facets of Ruby and develop an entire program using much of the knowledge you’ve gained so far. We’ll focus on the structural concerns of developing a program and look at how a flexible structure can benefit you and other developers in the long run.
Peter Cooper

Ruby Online

Frontmatter

Chapter 13. Two Web Application Approaches: Rails and Sinatra

Abstract
In this chapter, we’re going look at web application (or web app, for short) frameworks—libraries of code that provide a easily reusable structure and design patterns for developing web applications. If you want to develop something useful for the Web, you’ll probably find a web application framework very useful, and Ruby has a wonderful selection of them, of which we’ll look at two: Rails and Sinatra.
Peter Cooper

Chapter 14. Ruby and the Internet

Abstract
In this chapter, we’re going to look at how to use Ruby with the Internet and with the various services available on the Internet, from the Web to e-mail and file transfers.
Peter Cooper

Chapter 15. Networking and Sockets

Abstract
In this chapter, we’re going to look at how to use Ruby to perform network-related operations, how to create servers and network services, and how to create persistent processes (daemons) that can respond to queries over a network.
Peter Cooper

Chapter 16. Useful Ruby Libraries

Abstract
This chapter is a basic reference to a collection of useful Ruby libraries that you might want to use in your programs. We’re going to look at libraries covering a vast array of functionality, from networking and Internet access to file parsing and compression. The libraries in this chapter are in alphabetical order, and each library starts on a new page with the name as the page header for easy browsing.
Peter Cooper

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise