lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Currens (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENENET-470) Change Getxxx() and Setxxx() methods to .NET Properties
Date Sun, 08 Apr 2012 22:02:17 GMT

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

Christopher Currens commented on LUCENENET-470:
-----------------------------------------------

I understand your concern.  We've had a lot of discussion about whether to abandon the Java
style API for one more friendly to .NET, one of the more in depth ones where we seemed to
finally come to a consensus was here [in this mailing list thread and its history|http://mail-archives.apache.org/mod_mbox/lucene-lucene-net-dev/201112.mbox/%3CCAJTRbSq8iNd7yK2F-j7xuhGkJeMM9Jff0in28mkT+JV_EVQZUA@mail.gmail.com%3E].

Ultimately .NET properties are nothing more than syntactical sugar, since there's no real
performance benefit over using a Get/Set method.  Either one has just as likely of a change
to be inlined than the other.  However, it makes Lucene.NET stand out from the rest of the
.NET libraries, where .NET features are used (and rightly so).

I'm not sure that deviation from the original API is a valid reason not to implement this
feature (not to mention, it's been partially implemented already), considering the plan is
and always has been implementing a newer .NET API.  There have been considerations to emulate
the Java API on top of the new API in the future for people that want that, but IMO it's not
really worth it.

Either way, I don't want to get into a discussion about whether to stick to the java API here,
that's something for the mailing lists.  If you have objections to the ultimate goal of the
project, it would be best you voice them on the dev mailing list.  I don't think our community
is as talkative as it could be, and we only get input from non-committers from just a few
vocal community members.  We'd love to hear your input on our goals.
                
> Change Getxxx() and Setxxx() methods to .NET Properties
> -------------------------------------------------------
>
>                 Key: LUCENENET-470
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-470
>             Project: Lucene.Net
>          Issue Type: Sub-task
>          Components: Lucene.Net Contrib, Lucene.Net Core
>    Affects Versions: Lucene.Net 2.9.4, Lucene.Net 2.9.4g, Lucene.Net 3.0.3
>         Environment: all
>            Reporter: Christopher Currens
>             Fix For: Lucene.Net 3.0.3
>
>
> We should use .NET properties where ever possible.  There are many methods in the API
that use methods similar to {{Class.Getxxxxx()}} or {{Class.Setxxxxx()}}.  These methods often
just return a less-accessible field, with no real logic behind it.
> * If there are both public Get/Set methods with no special logic, they can be turned
into an automatic property: Name { get; set; }
> * If there are both Get/Set methods with no special logic and the setter is private,
use an automatic property: Name { get; private set; }
> * In other cases, use good judgement based with the amount of logic that is present in
the getter and setter methods.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message