[Rbrainz-users] Model factory

Philipp Wolfer phw at rubyforge.org
Mon Jul 16 04:46:44 EDT 2007


Hi Nigel,

I added a factory class for the models. It works mostly as in
PythonMusicbrainz with the following differences:

* DefaultFactory is defined in the Model module.
* There is a method new_entity to create an entity class for a given
entity type.

There are a few open points I like to discuss:

1.  Currently all custom entity classes need to implement entity_type,
since the generic version in Entity uses the class name to return the
entity type. I like to get rid of this but keep the method. I thought
about setting the type in the constructor.

2. What do you think about refactoring Query.new to only accept the
options hash (currently webservice is a separate parameter)

3. Do you think the factory should be able to construct Collections as
well? I think it would be a good idea

4. Does it need to create IncompleteDate and MBID? I think those are
basic data types which don't need to be created by a factory.

Regards,
Phil

-- 
Philipp Wolfer


More information about the Rbrainz-users mailing list