[tahoe-lafs-trac-stream] [Tahoe-LAFS] #2782: code reorg: less inheritance, more delegation/composition

Tahoe-LAFS trac at tahoe-lafs.org
Wed Apr 27 21:27:45 UTC 2016


#2782: code reorg: less inheritance, more delegation/composition
--------------------+---------------------------
 Reporter:  warner  |          Owner:
     Type:  task    |         Status:  new
 Priority:  minor   |      Milestone:  undecided
Component:  code    |        Version:  1.11.0
 Keywords:          |  Launchpad Bug:
--------------------+---------------------------
 In the comments on [https://github.com/tahoe-lafs/tahoe-lafs/pull/270
 PR270], meejah pointed out that `Client.__init__` is doing a lot of work,
 and that it might be better to build these nodes with a function (rather
 than a class constructor) that is *given* the supporting objects (like an
 !IntroducerClient, !StorageServer, and !Tub), instead of creating those
 things itself. Glyph recently pointed me at an enlightening presentation
 known as [https://www.youtube.com/watch?v=3MNVP9-hglc "The Talk"] from
 PyCon2013, that encourages composition over inheritance, which ties in.

 I'm not exactly sure what this would look like, but we could start by
 either merging Node and Client into a single class, or passing Node in as
 an argument to the Client constructor. Then we might make a client-
 creating function that builds Storage Servers and Introducer Clients
 first, then passes them as arguments into the Client constructor.

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2782>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list