Menu

#1 DESIGN:Factory Interface may be too narrow

open
nobody
None
5
2005-04-25
2005-04-25
Jens Engel
No

VERSION: 0.4

USE CASES:
1. Inject the "id" or "name" attribute into each
component to simplify diagnostics.
2. Inject a "parent" attribute into each component similar
to current container/sub-container handling (parent,
children).

There are at least 2 ways to implement these 2
usecases above:
I1. Use a special factory to inject the extra attributes.
I2. Provide an own container that injects the attribute(s)
(for each case) or derive a new one from PyContainer.

Case I1 cannot be used currently, because the Factory
does not get the necessary information handed to it.

Case I2 would cause a large duplication of PyContainer
code (because it does not have a post-create
component hook in PyContainer.getInstance()).

Case I1 could be easily used if the Factory interface is
enlarged ala:
Factory.getInstance(self, classpath, componentId,
containerAsOwner=None)

SIDE-NOTE:
Factory.create() would have been a more natural naming
choice to me (instead of Factory.getInstance()).

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.