[ 
https://issues.apache.org/jira/browse/SOLR-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14088061#comment-14088061
 ] 

Shawn Heisey commented on SOLR-6315:
------------------------------------

Looking over these notes, those on SOLR-912, and the actual implementation of 
SimpleOrderedMap ... it looks to me like SimpleOrderedMap has zero behavior 
difference from NamedList.  If I'm wrong about that, will someone please point 
me at the code that makes them different?

When I was poking through the code making a patch to remove SimpleOrderedMap, I 
do remember seeing one place where another class makes a decision based on 
whether the object is a SimpleOrderedMap or not, and it turns out that it was 
in JSONResponseWriter, which is mentioned above.

There are exactly three places in trunk where "instanceof SimpledOrderedMap" 
appears.  One of them is in code that decides how to encode javabin, which adds 
yet another possible complication to the entire notion of dropping 
SimpleOrderedMap.  The javabin codec has ORDERED_MAP and NAMED_LST as distinct 
object types.

A derivative class should only exist if its implementation is different than 
the parent, or if it makes sense within the human mind to think of them as 
different things because the distinction is concrete and will be required 
frequently.

The three places I mentioned are cases where an entirely new class (different 
only in the name) is used instead of implementing a setting within the class 
that other code can use to make decisions.  Although the existing method uses 
slightly less memory, I think it's the wrong approach.  I know that I'm only 
one voice, and I may be overruled.

One option for the stated purpose of this issue is to add a boolean flag within 
NamedList (possibly with a getter/setter) to use in JSONResponseWriter.  
Another is to bite the bullet and actually implement an extension of NamedList 
that behaves differently -- in this case (based on what I see in 
JSONResponseWriter and the javadocs), preventing duplicates and being more 
efficient for key lookups.


> Remove SimpleOrderedMap
> -----------------------
>
>                 Key: SOLR-6315
>                 URL: https://issues.apache.org/jira/browse/SOLR-6315
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>         Attachments: SOLR-6315.patch
>
>
> As I described on SOLR-912, SimpleOrderedMap is redundant and generally 
> useless class, with confusing jdocs. We should remove it. I'll attach a patch 
> shortly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to