[BangPypers] How to model these entities?

Dhananjay Nene dhananjay.nene at gmail.com
Sun Mar 29 15:49:12 CEST 2015


One reason I am not fond of singletons is that they make unit testing a lot
harder

Dhananjay

On Wed, Mar 25, 2015 at 7:02 PM, Abhaya Agarwal <abhaya.agarwal at gmail.com>
wrote:

> Hi,
>
> I need to model four entities that share some attributes and behaviors and
> also have some unique attributes and behaviors. I need to be able to refer
> to them from other entities. And these entities are Singletons.
>
> Ex: online marketplaces. They share common attributes like website, contact
> person, commission rates which are best stored in DB. But they differ in
> how you upload data to them - one of them supports FTP, other Dropbox -
> best modeled as implementation of an interface. There may be unique data
> associated with these behaviors. FTP credentials, Dropbox credentials.
>
> Also a product may need to refer to these marketplaces (Ex: where all is it
> going to be listed), so they need to be enumerable.
>
> I have considered class hierarchy + a central registry + on disk config
> files. But since this is a part of a larger Django project, implementing it
> like this kind of sticks out and integrating it with admin etc requires lot
> more work. What are the other options to model something like this? I feel
> like I'm missing something obvious.
>
> Thanks a lot!
>
> Regards,
> Abhaya
>
> --
> -------------------------------------------------
> blog: http://abhaga.blogspot.com
> Twitter: http://twitter.com/abhaga
> -------------------------------------------------
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list