Re: DirectoryResource.registerResource()

>I guess the reason I didn't do it is because of the call to
>updateDefaultChildAttribute.

I don't see this as a problem.  StoreContainer provides an implementation
of updateDefaultChildAttributes().  Subclasses overriding
updateDefaultChildAttributes() can simply call
super.updateDefaultChildAttributes() from within the overriding version.  I
think this makes sense.

>Does this makes sense ? Would you still have a registerResource method
>in StoreContainer along with an abstract initializeChild method
>instead ?

I think the mechanism as it works now is fine, except for the following:
If I subclass StoreContainer, using DirectoryResource as an example for how
to proceed, I see that the subclass-specific work of registerResource() is
all done by updateDefaultChildAttributes().  This means that in my subclass
of StoreContainer I need to re-write registerResource() line-by-line just
it appears in DirectoryResource, which I see as needless duplication of
code, providing opportunity for future incompatibility, should something in
the original version need to change.

I don't see a need for a distinct initializeChild() method.  The
registerResource() method as written in DirectoryResource makes sure the
child is initialized with the appropriate default attributes for the
specific subclass that it is.

I think that the version of registerResource() in DirectoryResource is
sufficiently generic that any StoreContainer will need it, pretty much as
is. (If not, they can always override.)  Bubbling this code up to
StoreContainer prevents divergent subclasses of StoreContainer from having
to duplicate it.  This way, a subclass can simply override
updateDefaultChildAttributes() -- as described above, including the call to
super.updateDefaultChildAttributes() -- making it really easy to subclass
StoreContainer.



+---------------------+-------------------------+---------------------+
|    Dave Makower     |    davemak@pencom.com   |   WWW Specialist    |
+---------------------+-------------------------+---------------------+
|     Co-author of "Java Programming Basics" (Henry Holt/MIS:Press)   |
|                 http://www.pencom.com/javabasics/                   |
+----------------------------------+----------------------------------+
|   Pencom Web Works               |   (212) 513-7777   voice         |
|   Pencom Systems Inc.            |   (212) 513-1975   fax           |
|   40 Fulton St.                  |                                  |
|   New York, NY  10038            |   http://www.pencom.com/         |
+----------------------------------+----------------------------------+

Received on Friday, 28 February 1997 11:49:50 UTC