Introduction
In the previous chapter, we studied different methods and parameters of Ruby. We also learned about the built-in libraries of Math
and Time
in Ruby. It was here that we began to introduce the concepts of classes and modules. In this chapter, we will dive deeper into Ruby classes using object-oriented programming (OOP) concepts as our guide.
OOP is where the rubber meets the road in programming. In other words, this is where the action happens. If you want to write a quick script or a full-fledged application, the chances are you will use OOP. OOP has the following benefits:
- It is easy to design programs, as OOP concepts help greatly in the organization of concepts in everyday life.
- It breaks hard problems down into manageable pieces for coding.
- It is easy to test.
- It is easy for others to read and learn how the program works.
- It provides foundational units that can be easily extended or built upon, so as to construct robust applications.