About the course
Ruby is a dynamic, open-source programming language celebrated for its elegant syntax, developer-friendly design, and powerful object-oriented capabilities. It promotes a focus on readability and productivity, making programming a more intuitive and enjoyable experience. From simple scripting tasks to building complex web applications (notably with the Ruby on Rails framework), Ruby's versatility makes it a valuable language for various development needs. This 3-day hands-on training course provides a comprehensive introduction to programming with Ruby, covering its core concepts, its unique object-oriented paradigm, and venturing into some of its more advanced features and practical applications. Participants will gain solid programming skills by writing and executing Ruby code throughout the workshop.
The course begins by providing a brief history of Ruby and guiding participants through the essential first steps: installing and running Ruby on their systems, understanding how to execute scripts from the command line, and handling command-line arguments. Fundamental programming concepts are introduced through an exploration of Ruby's built-in data types, including Numbers, Text, Strings, Arrays, Hashes, and Symbols, along with understanding boolean expressions and the concept of nil. Participants will then dive deep into the heart of Ruby's design: its object-oriented nature. The core concepts of Objects, Classes, Modules, and Variables are introduced, followed by detailed modules covering how to define simple classes, create instances of objects, work with object attributes (getters and setters), understand method visibility (access control), and implement inheritance to build reusable and extendable code structures.
Beyond the foundational concepts, the course covers essential programming constructs such as flow control statements (conditionals like if/else, case, and loops like while, until, for, iterators) and implementing robust error and exception handling to build more resilient applications. Participants will learn practical skills like reading from and writing to files, handling structured data formats by parsing YAML, and understanding basic techniques for unit testing and debugging Ruby code to ensure correctness and facilitate troubleshooting. The course also provides an introduction to the fascinating and powerful world of Ruby Metaprogramming, exploring concepts like dynamic method definition and handling missing methods, and concludes with an overview of the popular Ruby on Rails web development framework, providing a clear pathway for applying their newly acquired Ruby skills in the context of web application development.
Instructor-led online and in-house face-to-face options are available - as part of a wider customised training programme, or as a standalone workshop, on-site at your offices or at one of many flexible meeting spaces in the UK and around the World.
-
- Install and run Ruby on their system and execute basic Ruby scripts from the command line.
- Understand and effectively utilise Ruby's fundamental data types (Numbers, Strings, Arrays, Hashes, Symbols) and expressions.
- Apply flow control statements (conditionals, loops) and implement basic error and exception handling in Ruby.
- Explain and apply core Object-Oriented Programming concepts in Ruby (Objects, Classes, Modules).
- Define classes, create object instances, work with attributes (getters, setters), understand method visibility, and implement inheritance.
- Gain an introduction to Ruby Metaprogramming concepts and write code that manipulates other code.
- Read from and write to files and handle data using techniques like YAML parsing and Marshaling.
- Perform basic Unit Testing and debugging of Ruby code.
- Gain an overview of the Ruby on Rails web development framework and its relationship to Ruby.
-
This hands-on training course is designed for individuals who want to learn programming using the Ruby language. It is ideal for:
Beginners with little to no prior programming experience looking for a user-friendly and expressive language to start with.
Developers from other programming languages (e.g., Python, Java, C#, PHP) wanting to learn Ruby's syntax and object-oriented approach.
Anyone interested in scripting, automation, or looking to build a foundation upon which to move into web development using Ruby (e.g. Ruby on Rails).
-
Participants should:
Have reasonable logical thinking and problem-solving skills.
Be comfortable using a computer and navigating file systems.
Prior programming experience is helpful but not strictly required as the course starts with the fundamentals.
-
This Ruby course is available for private / custom delivery for your team - as an in-house face-to-face workshop at your location of choice, or as online instructor-led training via MS Teams (or your own preferred platform).
Get in touch to find out how we can deliver tailored training which focuses on your project requirements and learning goals.
-
Introduction to Ruby Programming
Brief history and philosophy of Ruby.
Why choose Ruby? Strengths and common applications.
The Ruby ecosystem (RubyGems, etc.).
Interactive Discussion: Sharing expectations and goals for the course.
Getting Started with Ruby
Installing & running Ruby on different operating systems.
Using the interactive Ruby shell (irb).
Writing and executing Ruby scripts (.rb files).
Command Line Arguments: Accessing arguments passed to scripts (ARGV).
Hands-On Lab: Installing Ruby, running irb, writing and executing simple scripts, working with command line arguments.
Ruby Fundamentals – Data Types
Numbers (Integers, Floats) and basic arithmetic operations.
Text & Strings: Creating strings, string manipulation, interpolation.
Arrays: Creating, accessing elements, common array methods.
Hashes: Creating, accessing key-value pairs, common hash methods.
Symbols: Understanding symbols and their use cases.
Expressions (True, False, Nil): Understanding Ruby's boolean values and the concept of nil.
Basic input and output (puts, gets).
Hands-On Lab: Working with different data types, performing operations, using basic input/output.
Flow Control & Basic Statements
Conditionals: if, else, elsif, unless.
Comparison operators and logical operators (&&, ||, !).
The case statement.
Loops: while, until.
Iterators: each, map, select, reduce (inject).
break, next, redo.
Hands-On Lab: Writing code using conditionals and loops, applying iterators to process data in arrays and hashes.
Objects, Classes & Modules
Everything is an Object in Ruby.
Understanding Classes: Blueprints for objects.
Defining simple Ruby Classes.
Creating Object Instances.
Instance Variables (@variable).
Introduction to Modules: Grouping methods, classes, and constants, Mixins.
Hands-On Lab: Defining simple classes with instance variables, creating objects, exploring object methods and classes.
Methods, Attributes & Variables
Defining methods in classes.
Understanding object Attributes.
Creating manual Setter & Getter methods.
Using attr_reader, attr_writer, attr_accessor for defining attributes concisely.
Method Visibility (Access Control): public, protected, private.
Class Variables (@@variable) and Global Variables ($variable) - use cases and caution.
Hands-On Lab: Defining methods, using attr_ helpers for attributes, experimenting with method visibility.
Inheritance
Understanding Inheritance: Creating new classes based on existing ones.
The super keyword.
Method overriding.
Inheritance vs. Mixins.
Hands-On Lab: Implementing inheritance to create a hierarchy of classes.
Persistence (Overview)
Introduction to object Persistence: Saving object state.
Marshaling: Serialising and de-serialising Ruby objects.
Brief mention of Object-Relational Mapping (ORM) concepts (e.g., ActiveRecord in Rails) for database persistence.
Hands-On Lab: Experimenting with Marshaling to save and load simple objects.
Error & Exception Handling
Understanding Errors and Exceptions.
The begin, rescue, ensure, else blocks.
Handling specific exception types.
Raising exceptions (raise).
Custom exception classes.
Hands-On Lab: Implementing error handling in code, raising and rescuing exceptions.
Reading and Writing Data / Files in Ruby
All about the File Class: Opening, reading, writing, closing files.
File modes and arguments.
Working with file paths.
Handling common file operations (copy, move, delete).
Parsing structured data:
Parsing YAML data.
Brief mention of other formats (JSON, CSV).
Introduction to YPath (if relevant/time permits) or similar data navigation concepts.
Hands-On Lab: Reading from and writing to text files, parsing data from a YAML file.
Metaprogramming & Reflection (Introduction)
Metaprogramming: When, why, and how to write code that writes or modifies other code.
Reflection: Examining code structure at runtime.
Exploring Types, Modules & Classes as objects.
Working with Blocks & Strings in metaprogramming contexts.
Dynamically defining methods (define_method).
Handling missing methods (method_missing).
Brief look at Custom Structures or dynamic object creation.
Hands-On Lab: Experimenting with basic metaprogramming techniques like dynamic method definition and handling missing methods.
Testing & Debugging
Importance of testing in software development.
Introduction to Unit Tests in Ruby (using MiniTest or RSpec basics).
Writing simple unit tests.
Introduction to Debugging Ruby code.
Using a debugger (e.g., byebug).
Common debugging techniques.
Hands-On Lab: Writing simple unit tests for a class, using a debugger to step through code and inspect variables.
What next?
Overview of the Ruby on Rails web development framework: Its philosophy, architecture (MVC), and capabilities.
How Ruby skills apply to Rails development.
Other areas for Ruby application (scripting, data processing).
Resources for continued learning.
Discussion: Q&A and guidance on next steps for learning Ruby and related technologies like Rails.
-
Ruby-Lang.org: The official website for the Ruby programming language, offering documentation, news, and downloads.
RubyGems.org: The package manager for the Ruby programming language, where you can find and share libraries (Gems).
The Ruby Style Guide: A widely accepted community guide to writing idiomatic and readable Ruby code.
Ruby on Rails Official Website: Information and documentation for the popular Ruby web development framework.
Trusted by