You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Rob Vesse <rv...@yarcdata.com> on 2013/04/23 19:59:40 UTC

Visibility of Op constructors

I've noticed in some of the optimization work I've been doing lately there is a somewhat inconsistent pattern around the visibility of constructors on the various Op implementations.

Some have public constructors while some require static methods to be used to create them

Is there a particular reason for this and could we move to supporting both modes universally across all Op implementations or would this create issues?

Rob

Re: Visibility of Op constructors

Posted by Claude Warren <cl...@xenei.com>.
It's been a year or so since I played with the Op classes in any detail.  I
think you may have covered them above.  Perhaps "won't work" was too strong
a phrase, but what I was thinking of was the couple of static methods that
do some manipulation before creating the instance of Op.  Basically
operations that have to be completed before the super constructor is called.

-- Claude


On Thu, Apr 25, 2013 at 8:48 AM, Andy Seaborne <an...@apache.org> wrote:

> On Tue, Apr 23, 2013 at 6:59 PM, Rob Vesse <rv...@yarcdata.com>
>> wrote:
>>
>>  I've noticed in some of the optimization work I've been doing
>>> lately there is a somewhat inconsistent pattern around the
>>> visibility of constructors on the various Op implementations.
>>>
>>> Some have public constructors while some require static methods to
>>> be used to create them
>>>
>>> Is there a particular reason for this and could we move to
>>> supporting both modes universally across all Op implementations or
>>> would this create issues?
>>>
>>
> Shouldn't be a problem. I take it you are referring to the join-family of
> Ops.  Inconsistent naming as well - OpSequence.create vs OpFilter.filter --
> that's history.  The OpFilter.filter style works better with import static.
>
> Some of the factory-ish methods do do some additional work other than call
> the constructors and return an Op, not the specific type itself because of
> that.
>
> OpSequence.create(Op,Op) does null reduction and collapses OpSequence
> arguments.  It makes it convenient when looping producing an OpSequence's
>
> OpJoin.create used to so join identity reduction but that's the separate
> createReduce now.
>
> Downside is that most Ops use constructors so it's not a small change.
>
> The style I'd suggest is name-specific so you can write function call
> style when used with import static.   Even a single OpFactory with .filter,
> .join, .sequence statics.
>
>
> On 24/04/13 20:40, Claude Warren wrote:
>
>  I've noticed this in the past. I think that we should move to the
>> factory/builder pattern with static methods used to create the Ops. I
>> think there are a couple of constructors that won't work otherwise,
>> but I am not certain.
>>
>
> Which did you have in mind?  I've have thought that a constructor can be
> replaced.
>
>         Andy
>
>
>


-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
Identity: https://www.identify.nu/user.php?claude@xenei.com
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: Visibility of Op constructors

Posted by Andy Seaborne <an...@apache.org>.
> On Tue, Apr 23, 2013 at 6:59 PM, Rob Vesse <rv...@yarcdata.com>
> wrote:
>
>> I've noticed in some of the optimization work I've been doing
>> lately there is a somewhat inconsistent pattern around the
>> visibility of constructors on the various Op implementations.
>>
>> Some have public constructors while some require static methods to
>> be used to create them
>>
>> Is there a particular reason for this and could we move to
>> supporting both modes universally across all Op implementations or
>> would this create issues?

Shouldn't be a problem. I take it you are referring to the join-family 
of Ops.  Inconsistent naming as well - OpSequence.create vs 
OpFilter.filter -- that's history.  The OpFilter.filter style works 
better with import static.

Some of the factory-ish methods do do some additional work other than 
call the constructors and return an Op, not the specific type itself 
because of that.

OpSequence.create(Op,Op) does null reduction and collapses OpSequence 
arguments.  It makes it convenient when looping producing an OpSequence's

OpJoin.create used to so join identity reduction but that's the separate 
createReduce now.

Downside is that most Ops use constructors so it's not a small change.

The style I'd suggest is name-specific so you can write function call 
style when used with import static.   Even a single OpFactory with 
.filter, .join, .sequence statics.

On 24/04/13 20:40, Claude Warren wrote:

> I've noticed this in the past. I think that we should move to the
> factory/builder pattern with static methods used to create the Ops. I
> think there are a couple of constructors that won't work otherwise,
> but I am not certain.

Which did you have in mind?  I've have thought that a constructor can be 
replaced.

	Andy



Re: Visibility of Op constructors

Posted by Claude Warren <cl...@xenei.com>.
I've noticed this in the past.  I think that we should move to the
factory/builder pattern with static methods used to create the Ops.  I
think there are a couple of constructors that won't work otherwise, but I
am not certain.



On Tue, Apr 23, 2013 at 6:59 PM, Rob Vesse <rv...@yarcdata.com> wrote:

> I've noticed in some of the optimization work I've been doing lately there
> is a somewhat inconsistent pattern around the visibility of constructors on
> the various Op implementations.
>
> Some have public constructors while some require static methods to be used
> to create them
>
> Is there a particular reason for this and could we move to supporting both
> modes universally across all Op implementations or would this create issues?
>
> Rob
>



-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
Identity: https://www.identify.nu/user.php?claude@xenei.com
LinkedIn: http://www.linkedin.com/in/claudewarren