postgres-17
postgres-17
data
Struct vs Data in Ruby 3.2
Struct vs Data in Ruby 3.2: what the new immutable Data class does differently, when mutability still makes Struct the right choice, how to extend Data, and benchmarks comparing Data, Struct, and OpenStruct performance.
optimistic-locking
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.
Latest
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.
Map vs WeakMap in practice
Map vs WeakMap in JavaScript comes down to keys and memory: WeakMap only accepts object keys and lets garbage collection reclaim unused entries, while Map holds onto everything. Differences, similarities, and practical guidance on when each one is the right choice.
How to write Naive Bayes classification algorithm in Ruby
Naive Bayes classification in plain Ruby: how prior and posterior probabilities decide the winning class, then a working spam filter that classifies email titles. Also where the algorithm shines: sentiment analysis, recommendations, and fraud detection.