This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Blog update
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Michael asked for a small enhancement today - he wanted to have the number of items in a category shown in the category list. That was easy enough, and the server does that now. This was another hotfix executed on the server, and it illustrates one of the strengths of a Smalltalk server, IMHO.
The server has a per-blog cache for each category - until a few minutes ago, that cache was simply a dictionary that looked something like this:
categoryName -> Set(filename1, filename2, ...)
Each entry was a set of filenames - the filenames being files that hold entries in the given category. When a category search comes in, the server merely grabs the set of filenames, gets the appropriate entries from each, and displays them. Well, now we wanted more information - so I created a small Object called CategoryHolder:
All I did was move the set of filenames into an object, and included a count of items. That gets incremented each time a new entry falls into a category. Then I made the necessary refactorings in the handful of methods that dealt with this cache. Finally, I had to load the changes into the server. Once those changes were in, I had to script up a conversion method - which consisted of this:
Now, it's possible that you got an error browsing the blog if you happened to hit it while I was executing that - but it was all done in less than 30 seconds. The new functionality is there now, and all without cycling the server. That's the power of Smalltalk