116 reputation
5
bio website
location Dallas, TX
age 37
visits member for 3 years, 7 months
seen Jul 23 at 0:24

Apr
25
awarded  Teacher
May
12
answered Automatic programming: write code that writes code
Mar
6
awarded  Editor
Jun
29
awarded  Supporter
Jun
29
comment What is the proper name for this design pattern in Python?
Thank you for that pointer. One of the reasons I liked the single-class approach is it allowed me to subclass models and do stuff like: def get(id): #code-goes-here return self(results) and I didn't want to give up the simplicity of return self(results). But, in other places, such as the query module, I pass in the "model" classes so the results could be initialized to the proper class. Evidently this is what Django is doing too. I finally bit the bullet and switched back to the two class approach where a proxy does the get instead of a subclass and am passing the model class to proxy.
Jun
29
awarded  Scholar
Jun
29
awarded  Student
Jun
28
comment What is the proper name for this design pattern in Python?
@mac Here's the problem I ran into last night with the single-class approach (stackoverflow.com/questions/6501193/…) -- in the example above, Person would be a subclass of Vertex, and Graph is providing a generic interface to the REST database. So yes, everything is lazy-loaded in the sense that there is no persistent connection to the DB.
Jun
28
comment What is the proper name for this design pattern in Python?
@mac Thanks for the feedback. I've also been trying to get feedback on if this two-class design the right approach (see my comment to Daniel below). In another version of this design, the XXX class is not there and everything is in the Person class, using classmethods to interact with the REST resource. This worked great when there was only 1 REST resource but breaks down when you allow users to specify the db_url at runtime.
Jun
28
comment What is the proper name for this design pattern in Python?
I've gone back and forth between a single-class design and a two-class design as the one shown in my question. I'm back on the two-class approach b/c something needs to contain the run-time configurable resource object prior to the Person object being created. To see what I'm talking about, see my question from last night (stackoverflow.com/questions/6501193/…).
Jun
28
comment What is the proper name for this design pattern in Python?
This is for a persistence framework that can be used for anything.
Jun
28
asked What is the proper name for this design pattern in Python?