Master Ruby and object-oriented design in this advanced course built for developers who are ready to take their programming expertise to the next level. Through 15 in-depth modules, you’ll move beyond the basics to write clean, reusable, and maintainable code while developing the skills to build and scale complex Ruby applications.

Advanced Ruby Programming and Object-Oriented Design

Advanced Ruby Programming and Object-Oriented Design
This course is part of Learn to Code with Ruby Specialization

Instructor: Packt - Course Instructors
Access provided by MAHE Manipal
Recommended experience
Recommended experience
Advanced level
This course is aimed at experienced Ruby developers and want to deepen their understanding of advanced concepts and object-oriented design.
Recommended experience
Recommended experience
Advanced level
This course is aimed at experienced Ruby developers and want to deepen their understanding of advanced concepts and object-oriented design.
What you'll learn
Analyze and evaluate the use of blocks, procs, and lambdas to write flexible and reusable code.
Design and create complex class hierarchies and object-oriented structures.
Utilize and implement advanced inheritance techniques and the super keyword in Ruby programming.
Handle and manage file operations, sets, and date/time manipulations effectively.
Details to know

Add to your LinkedIn profile
7 assignments
See how employees at top companies are mastering in-demand skills

Build your subject-matter expertise
- Learn new concepts from industry experts
- Gain a foundational understanding of a subject or tool
- Develop job-relevant skills with hands-on projects
- Earn a shareable career certificate

There are 15 modules in this course
In this module, we will delve into the advanced functionalities of blocks, Procs, and lambdas in Ruby. You will learn how to implement and utilize these features to create flexible, reusable, and efficient code. We'll cover key concepts such as the 'yield' keyword, block parameters, and methods with Proc parameters, and provide detailed comparisons between Procs and lambdas. By the end of this section, you'll have a comprehensive understanding of these powerful Ruby tools.
What's included
12 videos2 readings
12 videos• Total 115 minutes
- Review of Blocks• 5 minutes
- The yield Keyword• 5 minutes
- Block Return Values• 5 minutes
- The block_given? Method• 4 minutes
- Block Parameters• 10 minutes
- A Custom each Method• 11 minutes
- Procs• 11 minutes
- More Proc Examples• 9 minutes
- Methods with Proc Parameters• 18 minutes
- Intro to Lambdas• 8 minutes
- Differences between Lambdas and Procs• 15 minutes
- Section Review [SLIDES]• 13 minutes
2 readings• Total 20 minutes
- Introduction to the Course 'Advanced Ruby Programming and Object-Oriented Design'• 10 minutes
- Full Specialization Resources• 10 minutes
In this module, we will explore the fundamental principles of object-oriented programming in Ruby by examining classes and objects. You will learn how to define classes, create and use instance variables, and write instance methods to encapsulate functionality. We'll also cover the 'self' keyword, getter and setter methods, and Ruby's shorthand syntax for accessors. By the end of this section, you'll have a solid understanding of how to create and manipulate objects using Ruby classes, setting the foundation for more advanced topics in object-oriented design.
What's included
14 videos
14 videos• Total 126 minutes
- Intro to Classes• 15 minutes
- Create a Class• 8 minutes
- The new Method on Ruby's Native Objects• 3 minutes
- Instance Variables and the initialize Method• 17 minutes
- Instance Methods• 13 minutes
- Override the to_s Method• 7 minutes
- The self Keyword• 11 minutes
- Omitting the self Keyword• 11 minutes
- Getter Methods (Read Methods)• 6 minutes
- Setter Methods (Write Methods)• 9 minutes
- The attr_reader and attr_writer Methods• 6 minutes
- The attr_accessor Method• 2 minutes
- Add Parameters to initialize Method• 8 minutes
- Section Review [SLIDES]• 10 minutes
In this module, we will delve deeper into the advanced aspects of Ruby classes. You will learn how to encapsulate class internals with private and protected methods, ensuring controlled access to class functionality. We'll cover how to add validation to setter methods and compute derived values dynamically. Additionally, you'll explore class methods, alternative syntaxes for defining them, and class variables for shared state management. The concept of monkey patching will be introduced, allowing you to extend existing classes with new functionality. This section concludes with a comprehensive review to solidify your understanding of these advanced class concepts.
What's included
10 videos1 assignment
10 videos• Total 87 minutes
- Private Methods• 9 minutes
- Protected Methods• 12 minutes
- Add Validation to Setter Methods• 8 minutes
- Derived Values• 8 minutes
- Class Methods• 12 minutes
- Alternative Class Method Syntax• 6 minutes
- Class Variables• 8 minutes
- Building a Class Over Time• 7 minutes
- Monkey Patching• 10 minutes
- Section Review [SLIDES]• 8 minutes
1 assignment• Total 15 minutes
- Assessment 1• 15 minutes
In this module, we will explore the robust feature of keyword arguments in Ruby. You'll learn how to use hashes as initialization arguments to make your methods more flexible and efficient. We'll cover the implementation of required and optional keyword arguments, ensuring your methods can handle varying input needs gracefully. Additionally, we’ll examine the interplay between positional and keyword arguments, providing insights into their effective combination. Through a practical refactoring of the Candidate class, you'll see how keyword arguments can simplify and enhance object initialization. This section concludes with a thorough review to reinforce your understanding of keyword arguments and their benefits.
What's included
6 videos
6 videos• Total 42 minutes
- Hash as initialize Argument• 13 minutes
- Required Keyword Arguments• 10 minutes
- Optional Keyword Arguments• 4 minutes
- Positional Arguments and Keyword Arguments• 5 minutes
- New Version of Candidate Class with Keyword Arguments• 5 minutes
- Section Review [SLIDES]• 4 minutes
In this module, we will delve into the powerful concept of inheritance in Ruby. You'll learn to create and manage superclasses and subclasses, understanding the hierarchical relationships that shape object functionality. We'll explore key methods such as 'superclass', 'ancestors', 'is_a?', and 'instance_of?' to trace and verify inheritance hierarchies. You’ll also learn to define exclusive methods in subclasses and override superclass methods. The 'super' keyword will be covered in-depth, along with techniques for defining object equality and leveraging duck typing for dynamic programming. This section concludes with a comprehensive review of all inheritance concepts discussed.
What's included
13 videos
13 videos• Total 115 minutes
- Intro to Inheritance [SLIDES]• 6 minutes
- Create Subclasses• 9 minutes
- The superclass and ancestors Class Methods• 10 minutes
- Check Inheritance Hierarchy of our Subclasses• 8 minutes
- The is_a? and instance_of? Methods• 5 minutes
- The methods Method• 8 minutes
- Exclusive Instance Methods in Subclasses• 5 minutes
- Override Methods in a Subclass• 9 minutes
- The super Keyword I• 13 minutes
- The super Keyword II• 11 minutes
- Defining Equality• 8 minutes
- Duck Typing• 13 minutes
- Section Review [SLIDES]• 10 minutes
In this module, we will explore various methods for handling input and output operations in Ruby. You'll learn to read from and write to text files, and how to rename and delete files while ensuring their existence. We will also cover how to pass and use command-line arguments via the ARGV array. The module includes a detailed explanation of loading and importing Ruby files using the 'load', 'require', and 'require_relative' methods, highlighting the differences and best practices for each. This section concludes with a comprehensive review to reinforce your understanding of Ruby's file handling and input/output capabilities.
What's included
7 videos1 assignment
7 videos• Total 57 minutes
- Read from a Text File• 7 minutes
- Write to a Text File• 10 minutes
- Rename and Delete a File• 5 minutes
- Command Line Arguments (ARGV)• 7 minutes
- Load A Ruby File with load Method• 10 minutes
- The require and require_relative Methods• 11 minutes
- Section Review [SLIDES]• 8 minutes
1 assignment• Total 15 minutes
- Assessment 2• 15 minutes
In this module, we will explore the powerful concept of modules and mixins in Ruby. You'll learn to define modules with constants and methods, and how to manage multiple modules with identical methods using protected namespaces. We'll cover importing modules into files and utilizing built-in modules like Math, URI, and Net/HTTP. The module will introduce mixins, showcasing how to add methods from modules like Enumerable and Comparable to classes. You'll learn to mix in custom modules, use the 'prepend' and 'extend' keywords, and handle multiple module declarations and nesting within modules. This section concludes with a comprehensive review to solidify your understanding of modules and mixins in Ruby.
What's included
15 videos
15 videos• Total 131 minutes
- Intro to Modules• 11 minutes
- Modules with Identical Methods• 5 minutes
- Import Modules into the Current File• 5 minutes
- The Math Module• 6 minutes
- The uri and net/http Modules• 11 minutes
- The Enumerable Mixin• 25 minutes
- The Comparable Mixin• 16 minutes
- Mixing in Our Own Module• 8 minutes
- The ancestors Method in Depth• 7 minutes
- The prepend Keyword• 4 minutes
- The extend Keyword• 5 minutes
- Mixing in Multiple Modules• 4 minutes
- Multiple Declarations for the Same Module• 7 minutes
- Modules within Modules• 9 minutes
- Section Review [SLIDES]• 10 minutes
In this module, we will delve into the Set data structure in Ruby. You will learn about its properties as a mutable, unordered collection that ensures element uniqueness. We will cover methods to add and delete elements, examining how these methods behave based on the presence or absence of elements within the Set. Additionally, we will explore the Set class's source code on GitHub to gain insights into its implementation. This section concludes with a review to reinforce your understanding of Sets and their practical applications in Ruby programming.
What's included
4 videos
4 videos• Total 16 minutes
- Intro to Sets• 6 minutes
- Add and Delete Items from Set• 3 minutes
- Explore set.rb on GitHub• 4 minutes
- Section Review [SLIDES]• 3 minutes
In this module, we will explore the handling of dates and times in Ruby using the Date and Time objects. You will learn to instantiate these objects, perform arithmetic operations to add or subtract time, and compare Time objects using the Comparable module. We'll cover formatting Time objects into strings with the 'strftime' method and parsing strings into Time objects using the 'parse' and 'strptime' methods. This section concludes with a comprehensive review to ensure a solid understanding of managing date and time representations in Ruby for various applications.
What's included
7 videos1 assignment
7 videos• Total 49 minutes
- The Date Object• 6 minutes
- The Time Object• 8 minutes
- Add or Subtract Time• 5 minutes
- The Comparable Methods on a Time Object• 5 minutes
- Convert Time Object to Formatted String• 7 minutes
- The parse and strptime Methods• 11 minutes
- Section Review [SLIDES]• 6 minutes
1 assignment• Total 15 minutes
- Assessment 3• 15 minutes
In this module, we will delve into the powerful tool of regular expressions in Ruby. You'll learn the basics of creating 'Regexp' objects and using simple search methods. We'll explore the 'scan' method to find all matches in a string and practice using symbols like '\d' for digits, '.' for wildcards, and more for custom pattern matching. Anchors and exclusion techniques will be covered to refine your searches. Additionally, we'll learn to use the 'sub' and 'gsub' methods for find-and-replace operations. This section concludes with a review and an introduction to Rubular.com, a helpful resource for experimenting with regular expressions.
What's included
9 videos
9 videos• Total 58 minutes
- Intro to Regular Expressions• 9 minutes
- The scan Method• 5 minutes
- The Digit Symbol• 9 minutes
- The Wildcard Symbol• 9 minutes
- Anchors• 5 minutes
- Exclude Characters• 5 minutes
- The sub and gsub Methods with Regular Expressions• 8 minutes
- Rubular.com• 3 minutes
- Section Review [SLIDES]• 5 minutes
In this module, we will explore exception handling in Ruby to manage and respond to errors effectively. You'll learn to use the 'begin' and 'rescue' keywords to define and handle error-prone sections of code. We'll cover capturing error objects with the '=> e' syntax and using multiple rescue clauses for different error types. The 'retry' keyword will be introduced to reattempt code execution, while the 'ensure' keyword will be used for clean-up actions. We'll also discuss how to manually raise exceptions with the 'raise' keyword and define custom error classes for specific error handling. This section concludes with a review to reinforce your understanding of exception handling in Ruby.
What's included
8 videos
8 videos• Total 71 minutes
- The begin and rescue Keywords• 11 minutes
- Catching Error Object• 9 minutes
- The retry Keyword• 7 minutes
- The ensure Keyword• 4 minutes
- Using begin and rescue at Top Level• 9 minutes
- The raise Keyword• 9 minutes
- Custom Exceptions• 11 minutes
- Section Review [SLIDES]• 10 minutes
In this module, we will immerse ourselves in testing Ruby code using the Minitest framework. Starting with the basics, you'll learn to import the 'minitest/autorun' module, declare test classes, and use common assertions like 'assert_equal'. We'll then test a simple class to put these concepts into practice. You'll learn to set up and tear down test environments using the 'setup' and 'teardown' methods, and validate code behavior with assertions such as 'assert_includes' and 'assert_raises'. Additionally, we will cover how to enhance test messages with custom strings. This section concludes with a comprehensive review of Minitest features and practices to solidify your understanding of testing in Ruby.
What's included
7 videos1 assignment
7 videos• Total 71 minutes
- Intro to Testing• 17 minutes
- Testing a Class• 10 minutes
- The setup and teardown Methods• 12 minutes
- Assert Inclusion• 7 minutes
- Assert Error was Raised• 9 minutes
- Final Argument to Assertion Methods• 6 minutes
- Section Review [SLIDES]• 10 minutes
1 assignment• Total 15 minutes
- Assessment 4• 15 minutes
In this module, we will focus on reading and writing documentation in Ruby. You will learn to navigate the official Ruby documentation, searching for classes and methods while understanding the distinction between class methods ('::') and instance methods ('#'). We'll cover using RDoc to generate webpage documentation for Ruby projects, showing how regular comments can be used to annotate code effectively. By mastering these skills, you'll enhance your ability to document and understand Ruby projects, making your code more maintainable and accessible to others.
What's included
2 videos
2 videos• Total 19 minutes
- Reading Documentation• 9 minutes
- Use RDoc to Generate Documentation• 10 minutes
In this module, we will explore the world of Ruby Gems, which are pre-written code bundles that can enhance your projects. You'll learn to navigate RubyGems, update the gem program, and install Gems using both 'gem install' and 'bundle install' commands. We'll cover managing project dependencies through a Gemfile to maintain consistency across development environments. Finally, we'll practice using the Faker Gem to generate random data, demonstrating the practical integration of gems into Ruby projects. By the end of this section, you'll be proficient in leveraging gems to add functionality and streamline your Ruby development process.
What's included
4 videos1 assignment
4 videos• Total 45 minutes
- Intro to Ruby Gems• 18 minutes
- Updating Gem Program• 3 minutes
- Installing Faker Gem• 16 minutes
- Use Faker Gem• 8 minutes
1 assignment• Total 15 minutes
- Assessment 5• 15 minutes
In this final module, we will celebrate the completion of the Advanced Ruby Programming and Object-Oriented Design course. We'll wrap up by summarizing the key learnings and achievements throughout the course. Reflect on the skills acquired, including advanced Ruby techniques, object-oriented design principles, and practical applications. This session provides an opportunity to acknowledge your progress and consider how to apply your new knowledge to future Ruby programming projects.
What's included
1 video1 reading2 assignments
1 video• Total 2 minutes
- Conclusion to the Specialization• 2 minutes
1 reading• Total 10 minutes
- Conclusion to the Course 'Advanced Ruby Programming and Object-Oriented Design'• 10 minutes
2 assignments• Total 75 minutes
- Full Course Assessment• 60 minutes
- Full Course Practice Assessment• 15 minutes
Earn a career certificate
Add this credential to your LinkedIn profile, resume, or CV. Share it on social media and in your performance review.
Instructor

Offered by

Offered by

Packt helps tech professionals put software to work by distilling and sharing the working knowledge of their peers. Packt is an established global technical learning content provider, founded in Birmingham, UK, with over twenty years of experience delivering premium, rich content from groundbreaking authors on a wide range of emerging and popular technologies.
Why people choose Coursera for their career

Felipe M.

Jennifer J.

Larry W.


