I wrote some time ago about thread-safety in OOP and how it can be achieved with decorators. It was also said that it���s very important to make sure objects are thread-safe (in Ruby and in Java), especially in web apps, which are multi-threaded (well, in most cases anyway). Well, here is SyncEm, a primitive Ruby gem which makes the above possible with a single decorator.
Look at this simple Ruby web app, which increments the internal counter on every web click:
require 'sinatra' cla...
Published on June 25, 2019 17:00