How to have shared state between different instance of a class without a singleton pattern.
The ‘Singleton’ DP is all about ensuring that just one instance of a certain
class is ever created. It has a catchy name and is thus enormously popular,
but it’s NOT a good idea – it displays different sorts of problems in
different object-models. What we should really WANT, typically, is to let as
many instances be created as necessary, BUT all with shared state. Who cares
about identity – it’s state (and behavior) we care about!
This might be a very esoteric topic for most people, but since I could not find information about this anywhere, I
decided to document this in a post.
Here is the problem. I use Jira at work, and today, I needed to close a
bunch of tickets based on a search result. Now, searching or doing batch operations is simple enough from the browser,
but a small detail made the exercise impossible via the web UI.
It is impossible to ignore avro at work - it is the data serialization format
of choice at work (and rightly so), whether it is to store data into Kafka
or into our document database Espresso. Recently, I had the need to read
avro data serialized by a Java application, and I looked into how I might use
Python to read such data.
Having worked with Python for a while, I am trying to pick up Ruby, especially
for some of my work with logstash. While trying out a small program in Ruby, I
got stumped with a peculiar trait of Ruby hashes with default values. It made
me lose an hour of my life I am not going to get back. :(