You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by "Henry Story (JIRA)" <ji...@apache.org> on 2011/07/09 12:37:16 UTC

[jira] [Updated] (CLEREZZA-599) EzMGraph imports too many implicits

     [ https://issues.apache.org/jira/browse/CLEREZZA-599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Story updated CLEREZZA-599:
---------------------------------

    Attachment: before-tooManyMethods.png

Here one sees a number of methods on the EzGraph instance that really have no role in that class:
 - bigint2lit
 - bool2lit
 - date2lit
 - double2lit

and many more not shown on that screenshot

> EzMGraph imports too many implicits
> -----------------------------------
>
>                 Key: CLEREZZA-599
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-599
>             Project: Clerezza
>          Issue Type: Improvement
>            Reporter: Henry Story
>         Attachments: before-tooManyMethods.png
>
>
> Importing all the implicit Preamble methods into EzMGraph is both unnecessary and problematic of working with that class with IDEs. As shown in the attached screenshots, IDEs will show - and should show - implicit methods just like any other methods. Extending a class therefore with implicit methods that convert between very different types, is not the right solution, both in OO programming and in pragmatic usage. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Updated] (CLEREZZA-599) EzMGraph imports too many implicits

Posted by Henry Story <he...@bblfish.net>.
On 12 Jul 2011, at 02:14, Reto Bachmann-Gmür wrote:

> On Mon, Jul 11, 2011 at 9:47 AM, Henry Story <he...@bblfish.net> wrote:
>> I am not sure how your proposal relates to EzMGraph importing too many
>> implicits. Do the renamings remove the problem of having methods
>> appear that have no relation to the class?
>> 
>> It seems like  you should open a new issue for renaming the Preamble.
> 
> I agree this should be done with another issue I only mentioned to
> better illustrate how I think the following entities relate:
> 
> 1. Preamble Object
> 2. Preamble class
> 3. EzMGraph

One could add a package object as I did in ISSUE-600 which essentially consisted of 1 file addition

http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/package.scala?view=markup&pathrev=1144670

containing the following line

package object utils extends TcIndependentConversions

> 
> The further down this list the more possibilities are offered, if you
> import the members of an instance of the Preable class you don't need
> to import the members of Preamble object and if you import the members
> of an EzMGraph issue you no longer need to import any of the others.

You get even simpler when you have the package ojbect above. Then you just need to 
write

import org.apache.clerezza.rdf.scala.utils._

> With your patch I'm afraid that in many situations one needs to make
> two imports rather than one.

With ISSUE-600 you get 1 import rather than 2. For you still need to import EzMGraph and then
import from individual instances.

In fact if you look at CLEREZZA-603 the problem with your third solution is that one has to 
import an object every time one switches context.

    import ez1._ 
    ez1.b_("reto") -- FOAF.homepage --> "http://bblfish.net/".uri 
    import ez2._ 
    ez2.b_("hjs") -- FOAF.homepage --> "http://bblfish.net/".uri 
    import ez1._ 
    ez1.b_("reto") -- FOAF.currentProject --> "http://clerezza.org/".uri 

So here we have one new import every line!

This does not seem optimal at all on your own criteria. It is also clearly an antipattern.

Furthermore this does not deal with the issue of methods appearing inside an object which have no
relation to the object as shown in the two pictures attached to issue CLEREZZA-599. Witness

https://issues.apache.org/jira/secure/attachment/12485812/before-tooManyMethods.png

Henry 

> The whole project is about providing utilities I think these should be as readily available as possible and
> don't think its a big problem that one might have some implicit import
> that aren't actually needed in a concrete usage.
> 
> For example the following code (I just committed before updating
> rdf.scala with your patch) no longer compiles:
> 
> val resultGraph = new EzMGraph(new UnionMGraph(new SimpleMGraph,
> contactNode.getGraph))
> import resultGraph._
> val result: GraphNode = bnode
> result a CONTROLPANEL.ContactConfirmPage
> result -- FOAF.primaryTopic --> contactNode
> 
> For it to compile with your patch it would have to be:
> 
> val resultGraph = new EzMGraph(new UnionMGraph(new SimpleMGraph,
> contactNode.getGraph))
> import resultGraph._
> val resultGraphPreamble = new Preamble(resultGraph)
> import resultGraphPreamble._
> val result: GraphNode = bnode
> result a CONTROLPANEL.ContactConfirmPage
> result -- FOAF.primaryTopic --> contactNode
> 
> I suggest to postpone discussion of this issue so we can focus on the
> release now, for this I move your patch to an issue branch.
> 
> Cheers,
> Reto
> 
>> 
>> On 9 Jul 2011, at 12:47, Reto Bachmann-Gmür wrote:
>> 
>>> I think they should stay there, so one just has to import one out of
>>> preamble-object, preamble-instance or ezmgraph.
>> 
>> 
>>> 
>>> I thin preamble could be renamed to EzGraph to make the three level more
>>> clear.
>>> EzGraph: object the utilities that do nor depend on a particular tc
>>> EzGraph class: the utilities that require a specified readable tc
>>> EzMGraph: the utilities that require a readwrite tc
>>> On Jul 9, 2011 12:37 PM, "Henry Story (JIRA)" <ji...@apache.org> wrote:
>>>> 
>>>> [
>>> https://issues.apache.org/jira/browse/CLEREZZA-599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>>>> 
>>>> Henry Story updated CLEREZZA-599:
>>>> ---------------------------------
>>>> 
>>>> Attachment: before-tooManyMethods.png
>>>> 
>>>> Here one sees a number of methods on the EzGraph instance that really have
>>> no role in that class:
>>>> - bigint2lit
>>>> - bool2lit
>>>> - date2lit
>>>> - double2lit
>>>> 
>>>> and many more not shown on that screenshot
>>>> 
>>>>> EzMGraph imports too many implicits
>>>>> -----------------------------------
>>>>> 
>>>>> Key: CLEREZZA-599
>>>>> URL: https://issues.apache.org/jira/browse/CLEREZZA-599
>>>>> Project: Clerezza
>>>>> Issue Type: Improvement
>>>>> Reporter: Henry Story
>>>>> Attachments: before-tooManyMethods.png
>>>>> 
>>>>> 
>>>>> Importing all the implicit Preamble methods into EzMGraph is both
>>> unnecessary and problematic of working with that class with IDEs. As shown
>>> in the attached screenshots, IDEs will show - and should show - implicit
>>> methods just like any other methods. Extending a class therefore with
>>> implicit methods that convert between very different types, is not the right
>>> solution, both in OO programming and in pragmatic usage.
>>>> 
>>>> --
>>>> This message is automatically generated by JIRA.
>>>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>>> 
>>>> 
>> 
>> Social Web Architect
>> http://bblfish.net/
>> 
>> 

Social Web Architect
http://bblfish.net/


Re: [jira] [Updated] (CLEREZZA-599) EzMGraph imports too many implicits

Posted by Reto Bachmann-Gmür <me...@farewellutopia.com>.
On Mon, Jul 11, 2011 at 9:47 AM, Henry Story <he...@bblfish.net> wrote:
> I am not sure how your proposal relates to EzMGraph importing too many
> implicits. Do the renamings remove the problem of having methods
> appear that have no relation to the class?
>
> It seems like  you should open a new issue for renaming the Preamble.

I agree this should be done with another issue I only mentioned to
better illustrate how I think the following entities relate:

1. Preamble Object
2. Preamble class
3. EzMGraph

The further down this list the more possibilities are offered, if you
import the members of an instance of the Preable class you don't need
to import the members of Preamble object and if you import the members
of an EzMGraph issue you no longer need to import any of the others.

With your patch I'm afraid that in many situations one needs to make
two imports rather than one. The whole project is about providing
utilities I think these should be as readily available as possible and
don't think its a big problem that one might have some implicit import
that aren't actually needed in a concrete usage.

For example the following code (I just committed before updating
rdf.scala with your patch) no longer compiles:

val resultGraph = new EzMGraph(new UnionMGraph(new SimpleMGraph,
contactNode.getGraph))
import resultGraph._
val result: GraphNode = bnode
result a CONTROLPANEL.ContactConfirmPage
result -- FOAF.primaryTopic --> contactNode

For it to compile with your patch it would have to be:

val resultGraph = new EzMGraph(new UnionMGraph(new SimpleMGraph,
contactNode.getGraph))
import resultGraph._
val resultGraphPreamble = new Preamble(resultGraph)
import resultGraphPreamble._
val result: GraphNode = bnode
result a CONTROLPANEL.ContactConfirmPage
result -- FOAF.primaryTopic --> contactNode

I suggest to postpone discussion of this issue so we can focus on the
release now, for this I move your patch to an issue branch.

Cheers,
Reto

>
> On 9 Jul 2011, at 12:47, Reto Bachmann-Gmür wrote:
>
>> I think they should stay there, so one just has to import one out of
>> preamble-object, preamble-instance or ezmgraph.
>
>
>>
>> I thin preamble could be renamed to EzGraph to make the three level more
>> clear.
>> EzGraph: object the utilities that do nor depend on a particular tc
>> EzGraph class: the utilities that require a specified readable tc
>> EzMGraph: the utilities that require a readwrite tc
>> On Jul 9, 2011 12:37 PM, "Henry Story (JIRA)" <ji...@apache.org> wrote:
>>>
>>> [
>> https://issues.apache.org/jira/browse/CLEREZZA-599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>>>
>>> Henry Story updated CLEREZZA-599:
>>> ---------------------------------
>>>
>>> Attachment: before-tooManyMethods.png
>>>
>>> Here one sees a number of methods on the EzGraph instance that really have
>> no role in that class:
>>> - bigint2lit
>>> - bool2lit
>>> - date2lit
>>> - double2lit
>>>
>>> and many more not shown on that screenshot
>>>
>>>> EzMGraph imports too many implicits
>>>> -----------------------------------
>>>>
>>>> Key: CLEREZZA-599
>>>> URL: https://issues.apache.org/jira/browse/CLEREZZA-599
>>>> Project: Clerezza
>>>> Issue Type: Improvement
>>>> Reporter: Henry Story
>>>> Attachments: before-tooManyMethods.png
>>>>
>>>>
>>>> Importing all the implicit Preamble methods into EzMGraph is both
>> unnecessary and problematic of working with that class with IDEs. As shown
>> in the attached screenshots, IDEs will show - and should show - implicit
>> methods just like any other methods. Extending a class therefore with
>> implicit methods that convert between very different types, is not the right
>> solution, both in OO programming and in pragmatic usage.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>>>
>>>
>
> Social Web Architect
> http://bblfish.net/
>
>

Re: [jira] [Updated] (CLEREZZA-599) EzMGraph imports too many implicits

Posted by Henry Story <he...@bblfish.net>.
I am not sure how your proposal relates to EzMGraph importing too many 
implicits. Do the renamings remove the problem of having methods
appear that have no relation to the class?

It seems like  you should open a new issue for renaming the Preamble.

On 9 Jul 2011, at 12:47, Reto Bachmann-Gmür wrote:

> I think they should stay there, so one just has to import one out of
> preamble-object, preamble-instance or ezmgraph.


> 
> I thin preamble could be renamed to EzGraph to make the three level more
> clear.
> EzGraph: object the utilities that do nor depend on a particular tc
> EzGraph class: the utilities that require a specified readable tc
> EzMGraph: the utilities that require a readwrite tc
> On Jul 9, 2011 12:37 PM, "Henry Story (JIRA)" <ji...@apache.org> wrote:
>> 
>> [
> https://issues.apache.org/jira/browse/CLEREZZA-599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>> 
>> Henry Story updated CLEREZZA-599:
>> ---------------------------------
>> 
>> Attachment: before-tooManyMethods.png
>> 
>> Here one sees a number of methods on the EzGraph instance that really have
> no role in that class:
>> - bigint2lit
>> - bool2lit
>> - date2lit
>> - double2lit
>> 
>> and many more not shown on that screenshot
>> 
>>> EzMGraph imports too many implicits
>>> -----------------------------------
>>> 
>>> Key: CLEREZZA-599
>>> URL: https://issues.apache.org/jira/browse/CLEREZZA-599
>>> Project: Clerezza
>>> Issue Type: Improvement
>>> Reporter: Henry Story
>>> Attachments: before-tooManyMethods.png
>>> 
>>> 
>>> Importing all the implicit Preamble methods into EzMGraph is both
> unnecessary and problematic of working with that class with IDEs. As shown
> in the attached screenshots, IDEs will show - and should show - implicit
> methods just like any other methods. Extending a class therefore with
> implicit methods that convert between very different types, is not the right
> solution, both in OO programming and in pragmatic usage.
>> 
>> --
>> This message is automatically generated by JIRA.
>> For more information on JIRA, see: http://www.atlassian.com/software/jira
>> 
>> 

Social Web Architect
http://bblfish.net/


Re: [jira] [Updated] (CLEREZZA-599) EzMGraph imports too many implicits

Posted by Reto Bachmann-Gmür <re...@apache.org>.
I think they should stay there, so one just has to import one out of
preamble-object, preamble-instance or ezmgraph.

I thin preamble could be renamed to EzGraph to make the three level more
clear.
EzGraph: object the utilities that do nor depend on a particular tc
EzGraph class: the utilities that require a specified readable tc
EzMGraph: the utilities that require a readwrite tc
On Jul 9, 2011 12:37 PM, "Henry Story (JIRA)" <ji...@apache.org> wrote:
>
> [
https://issues.apache.org/jira/browse/CLEREZZA-599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Henry Story updated CLEREZZA-599:
> ---------------------------------
>
> Attachment: before-tooManyMethods.png
>
> Here one sees a number of methods on the EzGraph instance that really have
no role in that class:
> - bigint2lit
> - bool2lit
> - date2lit
> - double2lit
>
> and many more not shown on that screenshot
>
>> EzMGraph imports too many implicits
>> -----------------------------------
>>
>> Key: CLEREZZA-599
>> URL: https://issues.apache.org/jira/browse/CLEREZZA-599
>> Project: Clerezza
>> Issue Type: Improvement
>> Reporter: Henry Story
>> Attachments: before-tooManyMethods.png
>>
>>
>> Importing all the implicit Preamble methods into EzMGraph is both
unnecessary and problematic of working with that class with IDEs. As shown
in the attached screenshots, IDEs will show - and should show - implicit
methods just like any other methods. Extending a class therefore with
implicit methods that convert between very different types, is not the right
solution, both in OO programming and in pragmatic usage.
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>