Well factored Objects

Jimmie Houchin jhouchin at texoma.net
Tue Apr 29 02:13:10 UTC 2003


Hello,

I am wanting/trying to move some homebrew software I wrote at work in 
MSWorks to Squeak. It is a database application.

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.

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 ...

and aggregate something like above into:
JHPerson
   name _ JHPersonName
   birth _ JhPersonBirth
...

Is that a good or proper approach?

And would code like the below be good or proper?
#JHPerson
name
     name isNil ifFalse: [^name]
                ifTrue: [name _ FHPersonName new].

with access like:

p _ FHPerson new initialize. "initialize initializes name variable."
p name first: 'John'.
...

Is this reasonably on course, or did I fall off the beam somewhere?

Thanks for any wisdom.

Jimmie Houchin



More information about the Squeak-dev mailing list