When to use Module over Class in Ruby? ruby

When to use Module over Class in Ruby?

Ruby modules often beat classes for service objects: why a shell class like PasswordResetInitiator is procedural code in disguise, using a module as a toolbox, mixins instead of artificial inheritance, and Data objects for tidy parameters.

Jan 26, 2026

Ruby 4.0 - a big update for its 30th birthday ruby

Ruby 4.0 - a big update for its 30th birthday

Ruby 4.0 marks the language's 30th birthday with maturity instead of revolution: saner syntax for multiline conditions, faster boot with fewer requires, a maturing Ractor story, hidden performance gems, and protection against command injection.

Jan 12, 2026

Transforming YAML config files into Ruby objects with helpers

Transforming YAML config files into Ruby objects with helpers

YAML config files don't have to end up as messy nested hashes. Turn them into real Ruby objects with validation and custom methods: a small model class that loads the YAML, exposes clean accessors, and grows with your Rails app's configuration needs.

Creating predictable randomness in Ruby: The magic of seeds

Creating predictable randomness in Ruby: The magic of seeds

Reproducible randomness in Ruby sounds like a contradiction, but seeds make it easy: how pseudo-random generators work, fixed seeds for tests, debugging, and procedural generation, creative ways to pick seeds, and the pitfalls that quietly break determinism.

Leveraging JSON in PostgreSQL 17

Leveraging JSON in PostgreSQL 17

PostgreSQL 17 finally implements the SQL/JSON standard: constructors like JSON_OBJECT and JSON_ARRAYAGG, query functions JSON_EXISTS and JSON_QUERY, and the star of the release, JSON_TABLE, which turns JSON into rows, shown on a real IoT data example.

PostgreSQL indexing for newbies - Practical Guide

PostgreSQL indexing for newbies - Practical Guide

PostgreSQL indexing explained for beginners: how B-tree, BRIN, GIST, and GIN indexes work, reading EXPLAIN ANALYZE to see if they are used, maintenance and hit rate tips, and clear rules for when an index helps and when it just slows your writes down.

Event Sourcing in practice: Lessons from the trenches

Event Sourcing in practice: Lessons from the trenches

Event Sourcing can be introduced to legacy systems incrementally, no big rewrite required. Lessons from production: the migration event technique, upcasting old events, right-sizing aggregates, stream lifecycles, and payoffs in audits, analytics, and debugging.

How to create multi trait inside trait in FactoryBot

How to create multi trait inside trait in FactoryBot

FactoryBot traits can nest other traits, letting you compose reusable test fixtures instead of copying attribute blocks. A quick refresher on traits, then the traitception pattern: defining traits inside traits and combining them for cleaner Rails test setup.

The necessity of architectural advancement

The necessity of architectural advancement

Evolutionary architecture treats change as a design input, not a threat. Why rigid paradigms fail, how to make well-informed architecture decisions, and how identifying architectural drivers and writing fitness functions keeps your system resilient.

Embracing Hexagonal Architecture in Ruby

Embracing Hexagonal Architecture in Ruby

Hexagonal Architecture separates your business logic from databases, UIs, and external services using ports and adapters. What the pattern really means, a practical Ruby implementation, when it pays off, and the common problems teams hit when adopting it.

What is ENVIRONMENT in rake task?

What is ENVIRONMENT in rake task?

The :environment dependency in Rake tasks is what loads your Rails app, models, and database connections. What task my_task: :environment actually does behind the scenes, how the Rake dependency syntax works, and why skipping it breaks your custom tasks.