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.

Streamlining Rails controllers with custom filters

Streamlining Rails controllers with custom filters

Rails controllers bloated with subscription checks? Extract that logic into custom filter classes: a before_action that delegates to a dedicated object, giving cleaner controllers, clearer error messages, easier testing, and a pattern you can expand.

Database shrading and database partitioning in Rails

Database shrading and database partitioning in Rails

Database sharding in Rails step by step: create a separate database per shard, wire them up in database.yml, and query across them. Plus how sharding differs from partitioning, with a native PostgreSQL partitioning example done through Rails migrations.

Understanding generic types in Typescript

Understanding generic types in Typescript

Generic types in TypeScript let one function, class, or interface work safely with many data types. What generics are, how a type parameter beats hardcoding a concrete entity type in a validation helper, and honest pros and cons before you use them everywhere.

Solutions for const and enums per class in Ruby

Solutions for const and enums per class in Ruby

Three ways to define constants and enums per class in Ruby: the ActiveRecord enum macro, a mixed style combining frozen constants with enum, and a dependency-free PORO version. Code for each solution and a comparison to help you pick the right one.

Factory Pattern with auto-detecting classes in Ruby

Factory Pattern with auto-detecting classes in Ruby

The Factory Pattern in Ruby, then a step further: using naming conventions and regular expressions so the factory auto-detects which notification class to instantiate. Complete code for both versions, plus when strict class listing is the safer choice.