sshyran / genxdm

Automatically exported from code.google.com/p/genxdm
0 stars 0 forks source link

Code duplication #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
org.genxdm.typed.types.Quantifier
org.genxdm.xs.enums.KeeneQuantifier

diff -uw will demonstrate that this was originally the same code.  But this is 
a nightmare: there are 335 references to the Quantifier; 354 references to 
KeeneQuantifier.  There ought to be a clear relationship (at least in the 
comments!) between them, but there's nothing.  It looks like random 
duplication, but disentangling it looks certain to be painful.  We're going to 
need to understand the (apparently-trivial) differences, and adjust such that 
the right thing happens, once we've managed to make just one class.

Alternatively, we need an explanation of why these two classes exist, *in* the 
code.  If we must have two such quantifier classes (both are representations of 
the keene-type ?+* indicators), then ideally we factor out common behavior, and 
then explain, in the derived classes, why the differences exist and where each 
class ought to be used.

Original issue reported on code.google.com by aale...@gmail.com on 15 Dec 2010 at 5:22

GoogleCodeExporter commented 8 years ago
Also see:
DomCompatibility.listFromIterable
AxisNodeNavigatorBase.iterableToList

Original comment by eric%tib...@gtempaccount.com on 10 Feb 2011 at 5:47

GoogleCodeExporter commented 8 years ago
So what?  The test code is highly non-optimized, intended solely for (very) 
clean use within a test.

Same basic functionality; different use case requirements.  This is similarity, 
not duplication.

Original comment by aale...@gmail.com on 10 Feb 2011 at 6:13

GoogleCodeExporter commented 8 years ago
Okay, KeeneQuantifier is gone, replaced by Quantifier.

There was a UnaryIterable in the schema parser; it's gone now.  There are 
probably other code duplications; we'll leave this open for comments in case 
someone comes up with more.  Not going to change the code in the tests; I like 
having it there, and don't want to risk changes to the public thing in 
domcompat breaking tests.

Further note: MetaBridge and SchemaTypeBridge showed massive overlap, a 
consequence of the removal of <T>ype from the API, a long time ago, and 
although they weren't related by inheritance, they should've been.  Now they 
are, but there's a possibility that one or the other ought to just go away.

Original comment by aale...@gmail.com on 9 Jun 2011 at 7:36

GoogleCodeExporter commented 8 years ago
quantifiers and bridges have been reduced and eliminated, which is where this 
defect shows valid issues, so mark it done.

Original comment by aale...@gmail.com on 29 Aug 2011 at 7:04

GoogleCodeExporter commented 8 years ago

Original comment by aale...@gmail.com on 26 Jul 2012 at 7:44