[squeak-dev] Re: Proper Smalltalk lots of classes

Yanni Chiu yanni at rogers.com
Sat Jan 1 18:29:23 UTC 2011


On 31/12/10 5:24 PM, Jimmie Houchin wrote:
> I am initially creating the message classes as they form the basis of
> the protocol and the fields are simply instance variables and methods in
> the message classes.

I had a look at:

http://en.wikipedia.org/wiki/Financial_Information_eXchange
http://www.quickfixengine.org/FIX44.html
http://www.quickfixengine.org/xml.html

In a lot of cases, many fields are optional, so I doubt an instance 
variable per message field is the right thing to do.

> I am not porting the Java library. I am implementing the protocol in
> Smalltalk from the documentation.

I think a lot of the code can be generated from the xml file 
corresponding to the FIX44.html above.

What code should be generated is the big question. You could generate 
classes for each message type and each field type, and get the code 
bloat you're concerned about. Or, you could generate data structures 
from the spec, that are used to construct/parse messages and fields. If 
you generate all this stuff then you can delay the choice.

> Initially I have created a Fix44Field class with its necessary variables.
> There are several versions of the Protocol and FIX 4.4 is the one
> required for my application.
>
> With this Fix44Field class I am creating a Dictionary with the 956
> different field types. I am planning on creating a constructor method
> which will create the desired field from the information in the
> dictionary about the field and its properties.
>
> Am I way off base here? Should I really create the 956 classes necessary
> to for each field in addition to the 90 or so message classes, and then
> I don't know what else I haven't discovered yet. Having 1000+ classes
> just seems unwieldy and naively it just doesn't feel like the Smalltalk
> way. I could be wrong, but I haven't seen such an example to my memory.
> I don't know enough about Java to know if it is good Java form either.

IMHO, you'll end up with a class for each of the 90 or so message types, 
due to validation and constraint needs. Whereas, the 1000+ field types 
will be handled generically by a few classes.

Good luck.

-- 
Yanni




More information about the Squeak-dev mailing list