On Tue, Nov 8, 2011 at 5:44 AM, Glyph Lefkowitz <gl...@twistedmatrix.com> wrote:
>
>> On Nov 7, 2011, at 10:25 AM, exar...@twistedmatrix.com wrote:
>>
>>> reactor = getUtility(IReactor)?
>
>> That's not really a solution.  It's the barest glimpse of a large system
>> which might be applied as a solution.  Do you want to expand it?
>
> I'd like to echo this request for exposition.  My understanding is that
> 'getUtility' is just a baroque way to access a global variable, with most of
> the disadvantages of said globalness intact.  What does it provide that our
> existing import strategy doesn't?

An extra layer of abstraction and XML-based configuration – what's not to love?

It could allow for a clearer expression of dependency. Something that
only uses IReactorTime would only get the utility for that. This would
in turn make it easier to swap out only parts for testing, or to do
things like "speed up or slow down time from a protocol's
perspective".

However, you're right. Ultimately, it's a process-wide configuration
setting. That means that setting it is a slightly politer form of
monkey patching and that it's not fine-grained enough to do the other
things you suggested (e.g. "suspending a group of related objects").

jml

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to