*** javier_ has joined #circuits | 00:53 | |
javier_ | Hi! I'm beginning to use circuits and I have some questions. Is anyone up? | 00:53 |
---|---|---|
javier_ | The questions are regarding best practices. | 01:03 |
prologic | hi javier_ | 01:46 |
prologic | fire away :) | 01:47 |
prologic | on phun intended :) | 01:47 |
prologic | *no | 01:47 |
javier_ | :) | 01:53 |
javier_ | First, when developing TDD, how do you structure the code? | 01:53 |
prologic | ahh | 01:57 |
prologic | just like in examples/testing | 01:57 |
prologic | :) | 01:57 |
javier_ | Oh, I'll take a look. | 01:58 |
prologic | https://bitbucket.org/circuits/circuits/src/tip/examples/testing//pytest/ | 01:58 |
prologic | this question was asked before :) | 01:58 |
prologic | so we added an example of how to do it with pytest | 01:58 |
prologic | all of our own unit and intergration tests are done this way | 01:58 |
javier_ | Thanks! Another, I saw servers which handle many connections but not clients. How would you structure that? | 01:58 |
prologic | good question | 01:59 |
prologic | I believe our client socket implemtnation(s) do not handle mutiplexing very well in the same light as our servers do | 01:59 |
prologic | bit of a design flaw or lack of foresight there | 01:59 |
prologic | I'd like to improve that | 01:59 |
prologic | my main use case was for an async web crawler | 01:59 |
prologic | ihmo the base component for all clients in circuits.net.socekts.Client | 02:00 |
prologic | just needs to grow the same internal structures for managing many socket objects | 02:00 |
prologic | and passing that along with the respective events | 02:00 |
prologic | problem is this would ofc break backwards compatibility with anything using client connections :) | 02:00 |
prologic | so maybe someone can contribute a MultiClient socket component :) | 02:01 |
prologic | the only way to do it now (works but isn't as nice) | 02:01 |
prologic | is to spawn multiple instances of your client connection (e.g: TCPClient) | 02:02 |
prologic | but with different unique channels | 02:02 |
prologic | i.e: using something like uuid4() | 02:02 |
prologic | it works but ihmo it's unnecessary -- we should just improve circuits.net.sockets.Client to handle multiplexed connections | 02:02 |
javier_ | How can I create handlers for dynamic channels? | 02:03 |
javier_ | Or how can I register handlers in the new channels as I create them? | 02:04 |
prologic | well you don't need to as such it's handled for you | 02:04 |
prologic | you just spin up multiple instnaces of the component | 02:04 |
prologic | on different channels | 02:04 |
prologic | let me construct a contrived example | 02:04 |
javier_ | It's too much. Let me figure it out on my own, don't worry! | 02:06 |
prologic | https://gist.github.com/c68e4f6cac0ae2cf594c | 02:10 |
prologic | simple example based on examples/wget.py | 02:10 |
javier_ | Looking... | 02:21 |
javier_ | I see what you mean. If the component creating the clients (TCPClients) needed to handle the events directly, I don't see how to apply this approach. Would it work? Should I use an intermediate component to create an explicit request/response? | 02:24 |
prologic | it should | 02:33 |
prologic | if you *did* want to create more dynamic event handlers at run-time | 02:33 |
prologic | as opposed to declaring them up-front on the classes/componets | 02:33 |
prologic | you'd use .addHandler() and .removeHandler() | 02:34 |
prologic | typically we don't see much use-case for this kindo f thing though :) | 02:34 |
javier_ | Ah, yes. For got about those two. You have been very helpful. I appreciate your help. | 03:58 |
javier_ | The application that I'm trying to implement consumes jobs from a queue, performs a few network connections and puts the result in another queue. | 04:00 |
javier_ | I found the concept of Components and async events a nice abstraction but it's getting messy as the codebase grows. I guess I lack experience. :) | 04:00 |
prologic | heh | 04:30 |
prologic | yeah clean design and code comes with experience I'm afarid :) | 04:30 |
prologic | no "magic silver bullet" | 04:30 |
prologic | not even with a framework such as circuits :) | 04:30 |
prologic | in any case, circuits and it's component library should help you with your use-case | 04:31 |
javier_ | Thanks! :) | 04:48 |
prologic | *sigh* I wish weekends were longer :) | 06:43 |
prologic | http://dilbert.com/strips/comic/2014-09-21/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+DilbertDailyStrip+%28Dilbert+Daily+Strip%29 | 06:47 |
robert_ | sup prologic | 06:51 |
prologic | hey | 06:58 |
prologic | wishing my weekend was longer :) | 06:58 |
prologic | you? | 06:58 |
robert_ | wishing a whole bunch of things. :p | 06:58 |
Yama | hi | 09:35 |
prologic | hi | 10:53 |
*** ninkotech__ has joined #circuits | 14:49 | |
*** ninkotech_ has quit IRC | 14:50 | |
*** ninkotech has joined #circuits | 15:01 | |
*** ninkotech__ has quit IRC | 15:02 | |
*** ninkotech has quit IRC | 15:09 | |
*** ninkotech_ has joined #circuits | 15:14 | |
*** ninkotech_ has quit IRC | 15:28 | |
*** ninkotech_ has joined #circuits | 15:48 | |
*** ninkotech_ has quit IRC | 16:31 | |
*** ninkotech_ has joined #circuits | 16:32 | |
*** An_Ony_M1ose has joined #circuits | 21:29 | |
*** An_Ony_Moose has quit IRC | 21:31 | |
Yama | gn8 | 21:55 |
*** Workster has joined #circuits | 23:40 |
Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!