Well factored Objects

Jimmie Houchin jhouchin at texoma.net
Tue Apr 29 14:38:30 UTC 2003


Christian Hofer wrote:
> Hello Jimmie,

Hello Christian,

> Allow me to make just some general remarks concerning OO analysis:

Yes, please.

>>From: Jimmie Houchin <jhouchin at texoma.net>
>>Hello,
>>
>>I am wanting/trying to move some homebrew software I wrote at work in 
>>MSWorks to Squeak. It is a database application.
> 
> Porting a non-OO software to Smalltalk is a really hard job: You have to
> switch from thinking in data structures to thinking in objects and rethink
> *everything*. I don't envy you for the task you want to do.

Fortunately I am currently the developer and sole user of this 
application. The requirements and standards are mine alone at this point.

>>It is a person database with close to 200 fields. Not all fields are an 
>>attribute of person, but I am very contrained with MSWorks. Alas, it was 
>>all I had available.
> 
> What is a database? If you know, try to forget it for the moment. The
> question is: what is the data used for? Don't think about storage of data - there
> is the image, that is all for now, care about the details later...
> 
>>The JHPerson class could easily have dozens of instance variables. But 
>>what I had been thinking is to group common variables into new classes 
>>similar to but not necessarily exactly:
>>
>>JHPersonName (first, middle, last, maiden, suffix)
>>JHPersonBirth (date, place)
>>JHPersonDeath (date, place)
>>JHPersonMarriage (list of (dates, places, spouses))
>>JHPersonAddress (street, city, county, state, zip)
>>JHPersonOccupation (title, industry)
>>JHPersonEducation (numYears, listOfSchools)
>>... lots more data ...
> 
> You are listing a data structure, not a collaboration of objects. The
> question is: What are the tasks you want to do that you need all that data for?
> Forget about most of the data first (you can add it later) and ask for
> responsibilities: What shall a "Person" be able to do? Or try it the other way around:
> e.g. what is it, that I do with the information which education a person
> has? The answer names a responsibility and the follow-up question is: which
> object should carry that responsibility. Draw CRC-Cards and play with them. First
> figure out what an object can do (and this shouldn't be: "Show me the date
> of birth", but e.g. "Notify me if somebody has birthday today") and then ask
> what it has to know in order to accomplish its tasks.

You are quite correct it is very much a data structure.

It will be a change of thinking to enable the app to be different.
It is a Vital Statistics and Geneological type application.
It is used for filling out government and other forms.

There aren't many behaviours for the objects other than ensuring data 
integrity and filling out my forms.

I may very well be under estimating what I can do based on what I 
currently do.

Fortunately I could move the app to Squeak in a much improved and more 
functional level and over time refactor into those capabilities you 
speak of.

Thanks for provoking thought.

Jimmie Houchin



More information about the Squeak-dev mailing list