[darcs-devel] [patch1943] get rid of the PrimPatchBase superclass for Summary

Ben Franksen bugs at darcs.net
Fri Sep 27 23:39:20 UTC 2019


Ben Franksen <ben.franksen at online.de> added the comment:

>> I don't get it. How does this simplify anything? I see a clear increase
>> in complexity of constraints, overall. Also, I don't understand what's
>> so unpleasant about the occasional extra PrimPatch or PrimPatchBase
>> constraint (3 alltogether in your patch).
> 
> I was actually provoked to do it by some nasty cascading constraints
> that the PrimPatchBase superclass entailed when doing the rebase
> refactoring, so to some extent it was about preventing future complexity
> as well. But I can't remember the exact details now and can't quickly
> reproduce them. I expect I'll come across them again as I continue
> cleaning up that refactoring.

Okay, fine. If it helps prevent getting into trouble there, go ahead.

> As a general principle I think this is a bad superclass though. Why
> should we need all the stuff in PrimPatch (PrimOf p) just to be able to
> implement Summary? It obscures the modularity of our code when we have
> huge constraints on instances.

True. The superclass couples things more tightly than necessary.

In general I guess this is the price we pay for being able to shorten
constraints. I mean, how much of the functionality of PrimPatch or
RepoPatch do you really need in each single case? Usually only a small
fraction. Still lots of our code is riddled with PrimPatch and RepoPatch
constraints, simply because it is more convenient than to write down all
the classes we actually need. It also makes the constraint more robust
against changes because you don't have to adapt lots of constraints when
you shift functionality from one place to another.

So it's a trade-off. I usually give up when I reach 4 or 5 constraints
and just use one of the two "big hammers" ;-))

(And I see now why you were tempted to split PrimOf out of PrimPatchBase
as that would mean that PrimPatchBase no longer is a "logically
justified" superclass.)

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1943>
__________________________________


More information about the darcs-devel mailing list