—



This is simply not required.
And if it is, then it’s safe to hide it after the viewer has watched a couple of full screen videos.
I fail to understand why this is acceptable.
— David Ogilvy (Confessions of an Advertising Man)
— David Ogilvy (Confessions of an Advertising Man)
Counter caching single columns is an excellent feature in Rails [1]. However, the need to counter cache values from multiple columns occurs frequently in complex real world applications. Let’s explore a non database solution.
Here’s a toy example :
To keep track of all the products in a store we have the products_count column which rails automatically updates because we set :counter_cache => true
Counter caching quickly becomes inadequate if we have to store the total price of all products in a store. Of course, we can easily implement our own.
Now, suppose we have to keep track of the total price and total count of products in every category in every store. It’s a nightmare to develop and maintain if each value is kept in the database.
Enter caching. I recommend Amazon’s ElastiCache [2] or any implementation of memcached. Though, Rails can cleanly accomodate most caching solutions [3].
But first, make sure you have indexes.
Then, convert counter caches into queries and place them in cache blocks.
And, of course delete cache entries in a product observer.
That’s it. By using cache storage instead of database storage for complex counter caching the code becomes simpler, maintainable and scalable.
— The Black Swan (Nassim Nicholas Taleb)
The past is hard to escape and impossible to change but nevertheless, thought provoking.
One of the best memories of school was walking back home after getting a good score on a test, knowing it’ll make my parents happy. Sharing good news still makes me happier than the news itself. Though, beyond a few bright sparks I was consistently above average but never the best.
I remember my year end report cards saying, rather tersely, “Siddharth has potential and can do much more” or simply “Can do much better.”
The feeling of not being good enough has stuck with me.
Over the years, I understood, how powerful this feeling is. It doesn’t result in the best of sleep but it means never being complacent about your abilities.
Not feeling good enough is a part of who I am and so even today when I look into a mirror, all I can think of is - “Can do much better.”
— Walt Whitman
— Mr. Linderman (Heroes)