[Tutor] Modifying Source Code while Program is Running

Alan Gauld alan.gauld at freenet.co.uk
Fri Nov 25 18:47:53 CET 2005


> Just had a quick look at Smalltalk, and at first glance the overview
> of the ideas behind it seems amazing, but the language seems quite
> ugly, and it seems to be very IDE led.

Adherents will defend its simplicity but I confess I strugglred for 
a long time with SmallTalk before learning to love it :-) And yes 
it is IDE led although the IDE can be 'removed' when deploying 
applications. But much depends on the implementation, my favourite 
for PCs is Dolphin SmallTalk from ObjectArts. Its not a traditional 
SmallTalk (ala Xerox SmallTalk 80) but very much one for the '90's

> This immediately seemed to me to be a case for classes.  
> You provide a way for a user to create a new class by 
> subclassing the page class (from their point of view 
> probably through adding a few new fields to
> a form).  

That might be part of the problem, if you think of a class in terms 
of its data attributes then that is nearly always the wrong starting 
point. Classes express behaviour, the data is only there to support 
the behaviour. Thats why methods are polymorphic but not attributes.

So you think of a class having an interface and users extending 
or modifying the behaviour, not the data. If you follow that route
you might find you don't need to write self modifying code, 
you simply load new classes with a common interface into an 
existing hook structure.

> However it doesn't really seem that Python is suited to this.  Indeed
> it doesn't really seem that Python is suited to a persistent
> environment.  

What makes you think that? Most persistent environments 
(ie long running server processs) are written in C/C++ (or 
maybe Java nowadays) which are far less dynamic than Python.

> Having a program running for a long time (months) is
> possible certainly, but it seems to be fighting against the language

Not at all, at least no more than in languages like C which require 
recoding, recompiling, stopping and then restarting the server to 
make changes. Thats why a simple framework with loadable 
modules it usally preferred to self modifying code!

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld





More information about the Tutor mailing list