Newbie Question - Usual ways of doing things. 
Author Message
 Newbie Question - Usual ways of doing things.

Hi,  I'm just getting my feet wet in Smalltalk, and was wondering...
Would it be within the realm of standard Smalltalk programming practices to
have an application which creates new classes as part of it's normal
operation?

I'm thinking of a program that keeps track of a large number of "things",
that are instances of a lesser number of "kinds".  The exact features of
these kinds cannot be predicted in advance.  I'd like to provide the user
with some kind of interface that lets them design a new "vital statistics
card" for each kind that comes along.  That info would create a subclass of
some more generic class.

The motivation for doing this is that a lot of the info describing a thing
is applicable to all things of a kind - i.e. more class variables than
instance variables.  Am I making sense?  Thanks.



                   "I read the news today oh boy."



Thu, 26 Jun 1997 04:58:14 GMT  
 Newbie Question - Usual ways of doing things.

Quote:
>Would it be within the realm of standard Smalltalk programming practices to
>have an application which creates new classes as part of it's normal
>operation?

I wouldn't call it standard, but it's certainly doable.  Some cautions,
though:

a. self modifying code is notoriously difficult to understand, debug, and
extend.  Be sure you need this feature.

b. changing the class structure at run-time may introduce a new potential
concurrency problem.

c. most vendors discourage distributing applications which use the compiler
by imposing additional run-time fees (damn them!).

-dms



Fri, 27 Jun 1997 06:38:45 GMT  
 Newbie Question - Usual ways of doing things.

 >Hi,  I'm just getting my feet wet in Smalltalk, and was wondering...
 >Would it be within the realm of standard Smalltalk programming practices to
 >have an application which creates new classes as part of it's normal
 >operation?

It's not unheard of though typically not required.

 >I'm thinking of a program that keeps track of a large number of "things",
 >that are instances of a lesser number of "kinds".  The exact features of
 >these kinds cannot be predicted in advance.  I'd like to provide the user
 >with some kind of interface that lets them design a new "vital statistics
 >card" for each kind that comes along.  That info would create a subclass of
 >some more generic class.
 >
 >The motivation for doing this is that a lot of the info describing a thing
 >is applicable to all things of a kind - i.e. more class variables than
 >instance variables.  Am I making sense?  Thanks.

Seems like you intend to use these dynamic classes simply to store
some data.  That's fine but a bit of overkill perhaps.  This sounds
like a case for Dictionaries.  The thing about dynamically generated
classes is that unless you are dynamically generating non-trivial code
(i.e., something other than get and set methods), there is not alot of
point.  There are cases where it helps for speed but I've found those
situations to be rare.

Hope this helps.

JEff

--
ato de, |m        -- Warning:  anti-socialist in training.



Fri, 27 Jun 1997 13:06:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie Question - Usual ways of doing th

2. R6003 error on HP WinMe (I've already done the usual)

3. Low level disk services - Usual newbie needs help type of message

4. Simple Newbie Question: What am I doing wrong?

5. help w/ doing several things at once.

6. Top ten things people are doing with Forth.

7. Not doing things

8. Doing Things Professionally!

9. Playing a wav file while doing other things?

10. EAI - doing things between events

11. Doing the simplest thing with Tkinter Canvas

12. Doing things in one line?

 

 
Powered by phpBB® Forum Software