ruby
ruby
microservices
Microservices - a significant cost that may not always suit your project
Microservices promise independence and deliver network calls where method calls used to be. Why small and medium teams pay the highest price: chaos scaling instead of product scaling, lost shared context, operational overhead, and the way back to sanity.
software-architecture
Pseudo-modularity - why your code will fall apart anyway
Pseudo-modularity looks like clean folders and rots underneath: a change in Products breaks Inventory tests and blocks three teams. Why noun-driven modules and a shared database create facade modularity, and what real module boundaries look like.
Latest
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
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.
How to simplify TypeScript types and reduce documentation overhead
TypeScript types with many optional fields need comments to explain what goes together. Discriminated unions fix that: split a Task type into per-status variants so invalid combinations fail to compile and the type documents itself. Before and after code included.
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
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.
Sample DDD explanation in Ruby with Event-sourcing and Event-driven development
Domain Driven Design in Ruby with a working example: aggregates, entities, value objects, and repositories built around a ProductCatalog, then extended with event-driven design and event sourcing, where projections rebuild state from events instead of a database.
Rails optimistic locking, pessimistic locking and how to solve StaleObjectError
Rails locking strategies for concurrent updates: optimistic locking with a lock_version column that works out of the box, pessimistic locking with lock! and with_lock, and practical ways to rescue and resolve the StaleObjectError that optimistic locking raises.
Differences between load, autoload, require, and require_relative in Ruby
Ruby has four ways to load code and each behaves differently: load re-executes a file every time, autoload waits until first use, require loads once from the load path, require_relative resolves from the current file. Examples plus a summary of when to use each.
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
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.
Ruby SOLID in practice with minimizing nesting rule
SOLID in Ruby with working code for every principle: Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion, plus a bonus rule on minimizing nesting and a fair look at the criticisms of SOLID.