I wanted to publish this post right next to my Observer Pattern post, as a tribute to an awesome cat we had to say goodbye to this week. I thought I’d celebrate the little guy’s life through the lens of the Observer Pattern.

If you’re trying to learn more about the actual Observer Pattern, give it a read here: Observer Pattern

The Observer Pattern and Your Cat

In this particular pattern, you serve as the subject and your cat as the observer. In much the same way as a regular observer, your cat (in my case Atlas) would attach their interest in your state and react according to that state change.

There are times when Atlas would simply detach his interest and not give a fig about my state but I think that speaks to his confidence in knowing that I wasn’t going anywhere and would still be there later. Cats are, after all, efficient and this was merely his way of freeing up some processing power to do other important tasks, like lounging in the sun or refining the cat scratchers to his liking.

Real-World Applications

  1. Lap time: Should Atlas have noted a state change from Position.Standing to Position.Seated, he would utilise the functions TestLapForWarmth() and RepeatedlyTryToGetCosyOnLap().
  2. Treat time: Should he have noted the state being affected by the function OpenTreatCupboard() he would obviously fire off ActCuteAndMeow().
  3. Box time: If the human was doing efficiency improvement tasks like UnpackBox() Atlas would react with GetInBox(). This is a common act where the observer would try to save space in one area by taking it up in a different area. Perhaps it can be seen as some form of defragmentation.

Conclusion

Cats are awesome

Atlas was a great cat and a good friend over the past 15 years. In our line of work, we’re always trying to be processing and memory efficient but in this case, I think I’ll keep some memory space taken up just for him.

Taxes

Atlas