The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Blog update

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Blog update Posted: Oct 23, 2004 12:42 AM
Reply to this message Reply

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.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

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:

Smalltalk.Blog defineClass: #CategoryHolder
	superclass: #{Core.Object}
	indexedType: #none
	private: false
	instanceVariableNames: 'filenames numberOfItems '
	classInstanceVariableNames: ''
	imports: ''
	category: 'Blog'

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:

| blogs |
blogs := Blog.BlogSaver allInstances.
blogs do: [:each |
		each categoryFileCache: nil.
		each setupSearchCategory].

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

Read: Blog update

Topic: Losing Focus... Previous Topic   Next Topic Topic: How hot is the Yankees/Sox rivalry?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use