Github user okram commented on the pull request:

    
https://github.com/apache/incubator-tinkerpop/pull/219#issuecomment-181991788
  
    I studied `ScriptElementFactory` and am thinking that API is poorly 
designed. Here are my concerns:
    
    ```
    protected class ScriptElementFactory {
    
            private final StarGraph graph;
    
            public ScriptElementFactory() {
                this.graph = StarGraph.open();
            }
    
            public Vertex vertex(final Object id) {
                return vertex(id, Vertex.DEFAULT_LABEL);
            }
    
            public Vertex vertex(final Object id, final String label) {
                final Iterator<Vertex> vertices = graph.vertices(id);
                return vertices.hasNext() ? vertices.next() : 
graph.addVertex(T.id, id, T.label, label);
            }
    
            public Edge edge(final Vertex out, final Vertex in) {
                return edge(out, in, Edge.DEFAULT_LABEL);
            }
    
            public Edge edge(final Vertex out, final Vertex in, final String 
label) {
                return out.addEdge(label, in);
            }
        }
    ```
    
    `ScriptElementFactory` should be a `GraphWrapper` so that the APIs are 
consistent.
    
    ```
    ScriptGraph.addVertex()
    ScriptVertex.addEdge()
    ```
    
    Its weird that you diverge from the standard pattern for seemingly no 
reason except the `vertex(id,label)`-method logic. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to