The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Edit and Deploy

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
Edit and Deploy Posted: Aug 3, 2005 11:01 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Edit and Deploy
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

In this post, I made light of the new VS support for "edit and continue". There were a few responses in the comments, along the lines that it "just works". I'm sure it's a great advance - for the curly brace world. However, we've had power above and beyond that in the Smalltalk space for (literally) decades. I figured I'd illustrate with a small example.

I've mentioned that I update this server on the fly a number of times. However, I'm not sure that I've emphasized exactly what that means from a power perspective. A couple of weeks ago, I was adding support for "search by author" (for multi-author blogs). That meant modifying a class that holds cache information - rather than scan all the posts on each such search, I simply have a cache that holds the name of each file in a dictionary, keyed by the author. It's a nice, simple scheme, the same one I use to lazily cache keyword searches. In any case, here's what the definition of the cache holder looked like before I made the change:


Smalltalk.Blog defineClass: #CacheManager
	superclass: #{Core.Object}
	indexedType: #none
	private: false
	instanceVariableNames: 'categoryCache refererCache 
		cachedHTML categoryFileCache keywordFileCache 
		cacheSem refererScanner saver availableStyles  '
	classInstanceVariableNames: ''
	imports: ''
	category: 'Blog'

And then after the change:


Smalltalk.Blog defineClass: #CacheManager
	superclass: #{Core.Object}
	indexedType: #none
	private: false
	instanceVariableNames: 'categoryCache refererCache 
		cachedHTML categoryFileCache keywordFileCache 
		cacheSem refererScanner saver availableStyles authorFileCache '
	classInstanceVariableNames: ''
	imports: ''
	category: 'Blog'

The change is simple - the addition of a single instance variable. I made this change in my test server, added the code required to utilize it, and had a working modification. That's when the power of Smalltalk stepped up - I wanted to roll this change into the server.

Now, I have a lot of blogs running in the server image. Each of those blogs holds an instance of this cache class, so each of them was short the new instance variable. No problem - I pushed out the changed code on the test server, along with the full parcel (the full component that gets loaded on startup). I pushed those to my server, and then used an interface I have on the server to have it load the changed code in. What happened? Not only do all new instances of the cache object get that new attribute, but all existing instances get it as well. To make sure that the new code referencing the cache didn't blow up, all I needed was a lazy accessor:


authorCache
	^authorCache isNil
		ifTrue: [authorCache := Dictionary new]
		ifFalse: [authorCache].

That ensures that the existing instances get the right thing when the new code I added asks for the cache. Amount of server downtime? Zero. Amount of time spent doing complex object migration? Zero. That's the definition of "it just works".

Incidentally, the blog server has been running for months without any downtime. I've updated it in the way I outlined above countless times since the last time I started it up.

Read: Edit and Deploy

Topic: Cincom Smalltalk Related Previous Topic   Next Topic Topic: Defining a

Sponsored Links



Google
  Web Artima.com   

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