Opened 9 years ago
Last modified 17 months ago
There's a big change in code here to use component-type stuff witghout much explanation. Need to really explain that calling an interface looks up an adapter, etc. Might be best to say "read the components how-to" with link ;-) Would also be good to explain that protocol.ClientFactoru uses the protocol instance variable by default, AND that it is that that implements the buidlProtocol method required for most of the CientFactory interfaces in the example.
Thanks, just noting the bug is read. More comments (or fixes) when I look at the tutorial.
As dialtone pointed out in issue 547, one specific example is that finger19.py defines IFingerSetterService without using it (it is used in finger19a.py). I'm planning to split the tutorial into about four parts (because it's such an enormous download) before I fix this bug, I'll keep you posted on progress.
Reassigning doc bugs to edsuom.
(In [24841]) Branching to 'finger19-cleanup-532'
Replying to hypatia:
As dialtone pointed out in issue 547, one specific example is that finger19.py defines IFingerSetterService without using it (it is used in finger19a.py).
I removed IFingerSetterService in r24842.
I'm planning to split the tutorial into about four parts (because it's such an enormous download) before I fix this bug, I'll keep you posted on progress.
I assume this not happening anymore, putting this up for review so it can finally be closed, unless there are other things that can be cleaned up here.
Hm. I think there's still a big jump here, although now it's slightly smaller. :)
However, it seems like almost every change in the finger tutorial is unexplained. components.xhtml seems to actually have more explanatory text than other parts of the tutorial.
There's probably a huge amount of improvement that could be made to the finger tutorial overall. We can do it incrementally, perhaps, but just shortening finger19.tac (or even doing that and adding more explanatory text to components.xhtml) isn't going to do it.
As far as this particular part of the document goes, it would probably benefit greatly from some links to zope.interface documentation, documentation about the Twisted adapter registry (do we have any? I don't know), and the removal the lies (or at least unexplained claims) like However, using interfaces provides the same flexibility inheritance gives: future subclasses can override the adapters..
Removing IFingerSetterService but leaving FingerSetterFactoryFromService doesn't really make sense. As far as I can tell, FingerSetterFactoryFromService isn't used anywhere (but this code is ridiculously complex). If the interface is removed, then removing this service makes sense too.
At the very least, components.registerAdapter requires 3 arguments, so the change beneath FingerSetterFactoryFromService to call it with only two is wrong.
Also, the later listings still include IFingerSetterService, so deleting it from finger19.tac only moves the jump from 18->19 to 19->20. :)
"Component-based architecture" with much more explanation
There we go. It's still not pretty, but it's an improvement.
I'm not sure it makes sense to give any more feedback beyond those last points, since a lot about what happens to this document depends on how those points get addressed. If you'd like clarification on any of these points, or if you'd like to discuss a plan for this document overall, I'd be happy to talk about this some more (either here or on IRC).
Okay then. "Ugg" is indeed the word, but I think this looks a lot better. I have linked to the Components HOWTO rather than trying to cram a bad explanation in.
Changes to finger19.tac (and derivatives) include the removal of BuildProtocol from the interface definitions. I also felt like renaming UserStatusTree to something that provides more parallelism. And of course the FingerSetterFactory nastiness is rearranged. (I also notice that, unlike finger18.tac, IRCClientFactory no longer does anything with ReconnectingClientFactory, but I'm not sure where that should go.)
The phrase However, using interfaces provides the same flexibility inheritance gives: future subclasses can override the adapters makes sense to me, albeit not perfect sense.
"Component-based architecture" with much more explanation, and new finger19x.tac
(In [25110]) Branching to 'finger-components-jump-532'
(In [25111]) apply components-v2.diff
refs #532
Testing trac ticket email notification.
Removing review keyword left in by kehander1
It's still up for review. I didn't review it.
""" Like this. """
"Like this."
Changes to branch 25111
(In [25499]) Apply components-25111.diff
To re-iterate what is the most important part of this (and previous) review, though: the use of adapters and interfaces in finger19.tac is incorrect. No amount of clear explanation or code re-arrangement is going to fix this.
I really don't want all the effort you've put into this ticket to turn out to be fruitless, but I also don't want you to spend any more time on it if that will be fruitless. I suggest that if you're interested in doing more work here, you work on removing the use of interfaces and the adapter registry. For example, this approach:
ircFactory = IRCFingerFactory(service, 'fingerbot') ircClient = internet.TCPClient('irc.freenode.org', 6667, ircFactory) ircClient.setServiceParent(serviceCollection)
makes far more sense than the way the IRC client in the current code is created and is much simpler, both to implement and to explain. It provides all of the same benefits of componentization discussed in the document, and it does so without using anything from twisted.python.components. Less is more.
There is certainly some place in the tutorial for coverage of twisted.python.components, but it needs to more carefully thought out than it was when this part of the finger tutorial was written.
finger19.tac with components removed (from 25499)
Very well... Does this make any sense? If it does, I will use it as a basis for splitting the code up into libraries and re-writing components.xhtml, and then subsequent bits. (I might add that it's not nearly as interesting-looking as it was before - but maybe that's for the best.)
Yea, this looks good. There are a few minor problems with the patch (name errors and things like that) which I will commit fixes for in a moment. Then hopefully all that should remain to do is propagate these changes to the later finger listings.
Applied at r25830.
Yikes, it's been a while. Does this still make sense?
I'm still not fond of the name "UserStatusTree" instead of "HTTPFactoryFromService". It just doesn't seem to be descriptive in this context.
Finger19.tac split into libraries
Ignoring the last attachment, since I'm not really sure how it's supposed to relate, this (the contents of the branch) looks ready to merge to me. It's definitely an improvement. Of course, I think the finger tutorial could still use more work :) but the new text seems ready to close this ticket.
Then hopefully all that should remain to do is propagate these changes to the later finger listings.
That's how the last attachment relates.
Things kind of stalled when no one could think of a good way to propagate changes through multiple finger libraries. The way the tutorial is structured, making a change in one library necessitates a new file with a new name, which means everything else that depends on that library has to be changed to reference the new file.
Replying to kehander1:
jerub worked on unit tests for the documentation codelistings in #2205, which include the finger libraries as well, so that would be part of, or related to, this ticket as well. Could you check that out as well kehander1?
That doesn't seem like it's going to solve the problem in question, though. I'd point out the relevant portion of the IRC logs, but I can't seem to get to them at the moment.
Same finger19-libs as before, but without the dos newlines
The finger19-libs attachment had two problems:
I did not fix the second problem. Please move that code into startService, and make sure that all services are added to the application.
Unmarking review, assigning back.
(In [26915]) Branching to 'finger-components-jump-532-2'
This does not appear to have an active maintainer anymore; I've unassigned it. Its ultimate end will be determined by the perceived usefulness of the Finger tutorial, I suppose.
Replying to moshez:
2. The finger service does stuff in init that should be done in startService (_read, specifically) I did not fix the second problem. Please move that code into startService, and make sure that all services are added to the application.
This second problem was fixed with #3375.
Fixing authorship metadata.