[Dev] Factory method for EmailAddress
Donn Denman
donn at osafoundation.org
Fri Aug 27 14:41:40 PDT 2004
Dev Folks,
I'm planning to add a factory method for creation/reusing EmailAddress
Items, and there are some architecture issues for consideration.
Currently we're creating a lot of EmailAddress Items on the fly now
that Email and Sharing are starting to work. I'm thinking the factory
method will allow us to reuse existing EmailAddress items to prevent
build-up of duplicates.
Architecture Issues:
------------------------------
* Looking up existing items could impact performance of reading mail,
but I'll use Ted's latest queries, and we can add a parameter to
disable the lookup if it's not fast enough.
* We don't have any scheme for deleting unused or obsolete addresses,
so they will build up over time if we don't have some cleanup scheme.
* The factory method will act as a bottleneck for creation of
EmailAddress Items, which could provide several benefits.
- we can more easily change implementation when we come up with
better strategies or defaults
- the factory method can do quick validation on the address for all
users
- we can lookup by the fullName attribute as well as by address
- we can use optional parameters to tag the item as to how it got
created. E.g. User Entered, Sent By, From AddressBook, Recipient,
which can help with automatic cleanup or UI-driven lookup.
Implementation Issues:
---------------------------
I'm thinking I'll make it a class method on EmailAddress.
* Do we have a standard naming scheme to use for factory methods? I'm
thinking I'll just use getEmailAddress() unless there's some standard.
* Should we use a subclass for auto-generated EmailAddresses, or just
add an enum attribute to track creation?
The "me" EmailAddress
--------------------------------
Mimi's UI specifies a special display for the current user: "me". I'm
thinking that I won't make any special "me" EmailAddress, I'll just
make the __str__() method return "me" when the emailAddress matches the
current default account. I'll probably cache that account address in
globals or a class variable for quick and easy access.
Your comments are welcome.
- Donn
More information about the Dev
mailing list