[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3830: LeaseInfo invites the anti-pattern of external mutation

Tahoe-LAFS trac at tahoe-lafs.org
Thu Oct 28 13:47:25 UTC 2021


#3830: LeaseInfo invites the anti-pattern of external mutation
---------------------+---------------------------
 Reporter:  exarkun  |          Owner:  exarkun
     Type:  defect   |         Status:  new
 Priority:  normal   |      Milestone:  undecided
Component:  unknown  |        Version:  n/a
 Keywords:           |  Launchpad Bug:
---------------------+---------------------------
 The way the expiration time of a lease is updated is that a `LeaseInfo`
 has its `expiration_time` attribute mutated and then the object is
 serialized into a share file.

 "Set an attribute" as an API is an anti-pattern because:

 * attribute setting is minimally discoverable
 * attribute setting is prone to delayed failure (it is typically not an
 error to set the wrong attribute)
 * mutation un-localizes behavior and makes reasoning more difficult

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


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