RE: Class Dependancy Injection
- From: "Robert Rawlins - Think Blue" <robert.rawlins@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 13 Apr 2007 17:38:08 +0100
Thanks Steve that's good to here. I'll give it a shot this evening and if I
have any problems then 'I'll be back';-)
Rawlins
-----Original Message-----
From: python-list-bounces+robert.rawlins=thinkbluemedia.co.uk@xxxxxxxxxx
[mailto:python-list-bounces+robert.rawlins=thinkbluemedia.co.uk@xxxxxxxxxx]
On Behalf Of Steve Holden
Sent: 13 April 2007 17:32
To: python-list@xxxxxxxxxx
Subject: Re: Class Dependancy Injection
Robert Rawlins - Think Blue wrote:
Hey again guys,That indeed sounds like the best way to proceed. You should find that,
I'm looking to get an answer about dependency injection in python
classes, what is the best way to deal with this?
For instance, in my application I have a configuration bean which
contains all the applications configuration information. Now in one of
other classes I need access to those configuration settings. What I
would have done in my ColdFusion/JAVA type applications is create an
instance of the configuration bean, and then pass that in as an argument
to the constructor for my other class, then have the other class set
that as a 'self' variable. Then from within my class I can access the
configuration details like self.config.getName() and it would return the
name of the application.
How is this best handled in python, can I still inject dependencies as a
constructor argument like that? If so then is there anything in
particular I need to watch out for that may cause me trouble?
modulo the language differences, the technique works in just the same
way. You shouldn't anticipate trouble.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings http://holdenweb.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
.
- Prev by Date: Re: function/method assigment
- Next by Date: Re: function/method assigment
- Previous by thread: Re: Class Dependancy Injection
- Index(es):
Relevant Pages
|