Migration rules for methods

0 views
Skip to first unread message

Gokhan Demir

unread,
Nov 19, 2010, 9:09:40 AM11/19/10
to lucer...@googlegroups.com
What is the convention for exporting method signatures ? Is there any rule for access levels ? (e.g only public methods should extracted) 
When I look at the source, I saw all public, protected and private methods has migrated.

--
Gokhan Demir.

Sergey Mirvoda

unread,
Nov 19, 2010, 9:12:05 AM11/19/10
to lucer...@googlegroups.com
we implementing only public interfaces and public interfaces can only contain public methods.

as for protected. 
2 All
I don't know should we change visibility and publicate this methods?

--
You received this message because you are subscribed to the Google Groups "Lucere Development" group.
To post to this group, send email to lucer...@googlegroups.com.
To unsubscribe from this group, send email to lucere-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/lucere-dev?hl=en.



--
--Regards, Sergey Mirvoda

Mark Perry

unread,
Nov 19, 2010, 9:14:49 AM11/19/10
to lucer...@googlegroups.com
I think Troy would rather not expose the "protected" methods in the Java code
in the interfaces.

Mark

Gokhan Demir

unread,
Nov 19, 2010, 9:32:27 AM11/19/10
to lucer...@googlegroups.com
looking at
- lucere.index.IFieldInfos private Read(...)
- lucere.index.read.ISegmentTermDocuments protected SkippingDoc()

both are extracted. These are the points for me to ask this question.
 
Gokhan Demir.

Sergey Mirvoda

unread,
Nov 19, 2010, 9:55:18 AM11/19/10
to lucer...@googlegroups.com
strange. I thing it is a mistake. 
To publish private method.
It definitely should not be published.

On Fri, Nov 19, 2010 at 7:32 PM, Gokhan Demir <yada...@gmail.com> wrote:
IFieldInfos



--
--Regards, Sergey Mirvoda

Christopher Currens

unread,
Nov 19, 2010, 11:51:34 AM11/19/10
to lucer...@googlegroups.com
I'm not usually extracting private methods.  Protected methods and fields that are have no access modifiers are being pulled out to my knowledge.  Methods and fields without access are implicitly default, which is the equivalent of internal.  I think there may be some cases with private methods that might warrant them being interfaced, but I think that's more of a judgement call, generally speaking, private methods are not interfaced.

- Christopher

--

Christopher Currens

unread,
Nov 19, 2010, 12:08:52 PM11/19/10
to Lucere Development
I don't think the way I wrote it was very clear. To summarize: Yes,
we are interfacing protected methods/fields as well as those without
any access modifiers. Java defaults those to internal, but we are
making them public.


-Christopher

On Nov 19, 8:51 am, Christopher Currens <currens.ch...@gmail.com>
wrote:
> I'm not usually extracting private methods.  Protected methods and fields
> that are have no access modifiers are being pulled out to my knowledge.
>  Methods and fields without access are implicitly default, which is
> the equivalent of internal.  I think there may be some cases with private
> methods that might warrant them being interfaced, but I think that's more of
> a judgement call, generally speaking, private methods are not interfaced.
>
> - Christopher
>
>
>
>
>
>
>
> On Fri, Nov 19, 2010 at 6:55 AM, Sergey Mirvoda <ser...@mirvoda.com> wrote:
> > strange. I thing it is a mistake.
> > To publish private method.
> > It definitely should not be published.
>
> > On Fri, Nov 19, 2010 at 7:32 PM, Gokhan Demir <yadaz...@gmail.com> wrote:
>
> >> IFieldInfos
>
> > --
> > --Regards, Sergey Mirvoda
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Lucere Development" group.
> > To post to this group, send email to lucer...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > lucere-dev+...@googlegroups.com<lucere-dev%2Bunsubscribe@googlegrou ps.com>
> > .

Sergey Mirvoda

unread,
Nov 19, 2010, 12:28:52 PM11/19/10
to lucer...@googlegroups.com
@Christopher
it's looks like mistake.
whats is a reasoning?

On Fri, Nov 19, 2010 at 10:08 PM, Christopher Currens <curren...@gmail.com> wrote:
Christopher



--
--Regards, Sergey Mirvoda

Juan Velasco

unread,
Nov 19, 2010, 12:18:21 PM11/19/10
to lucer...@googlegroups.com
Hi all,

I am a bit late on jumping on this band wagon. Making those methods/fields public sounds good to me, fire at will. (but don't forget to 'duck and cover') :)

Juan Pablo

To unsubscribe from this group, send email to lucere-dev+...@googlegroups.com.

Christopher Currens

unread,
Nov 19, 2010, 12:51:22 PM11/19/10
to lucer...@googlegroups.com
Sergey,

Again, I think my post was unclear.  I didn't write that code, so I don't know the reasoning.  It may be a mistake, but I was saying in general, there may be rare cases to make a private function public in an interface.


-Christopher

Sergey Mirvoda

unread,
Nov 19, 2010, 12:51:50 PM11/19/10
to lucer...@googlegroups.com
think about haw many unit tests you should write to test only one published method if all method have a side effects.


--
--Regards, Sergey Mirvoda

Sergey Mirvoda

unread,
Nov 19, 2010, 1:02:24 PM11/19/10
to lucer...@googlegroups.com
oh, Christopher sorry it is what unclear to me.

Yes definitely there may be the cases.
In a Search layer  there are few protected methods which can be published.
but we need a tests and guards in code before publishing.

Simple example.

ILock
{
obtain()
release()
}

when I call release before obtain implementors should throw exception.
suppose we have internal/protected method A() in Lock abstract class.
after publishing A() to ILock
and when client calls A() before or after obtain() what we should do?
God only knows - without tests we can't guarantee anything.
Also API can be polluted  with strange named methods.

I think we should only publish internal method if it used by other classes not inheritors.
--Regards, Sergey Mirvoda
Reply all
Reply to author
Forward
0 new messages