Code Monkey home page Code Monkey logo

Comments (3)

davidmoten avatar davidmoten commented on August 24, 2024

Thanks for your input and I'm glad you are finding the library useful.

So the static method approach means you can't use method chaining so code like:

tree = RTree.create()
                   .add(1, point(2,3))
                   .add(2, point(5,2))
                   .add(3, point(9,4));

becomes much more verbose and less discoverable to make happen with static add methods:

tree = RTreeBuilder.add(RTreeBuilder.create(), 1, point(2,3));
tree = RTreeBuilder.add(tree, 2, point(5,2));
tree = RTreeBuilder.add(tree, 3, point(9,4));

For an immutable data structure I would never expect add to do anything but return a new object otherwise it's not immutable and you make that point too. add in this case means create a new RTree based on the current tree with the item added to it. Perhaps a better name for the method or I could emphasise what add is doing in the documentation in the README. I don't like the idea of using a builder because it just makes for unnecessary typing and I'm not keen to lose method chaining.

from rtree.

pereferrera avatar pereferrera commented on August 24, 2024

Actually I thought about a normal builder, so you could chain and use it with build() in the end like .add().add().build(). But then I realized that you often want to perform online modifications so a builder is not really suited for that... And the static method for that purpose might be also not so nice, I agree.

Just emphasizing what the immutable operations do in the README would probably be fine then.

from rtree.

davidmoten avatar davidmoten commented on August 24, 2024

Righto, I'll update the README. Thanks for your input.

On 13 March 2015 at 10:05, Pere Ferrera [email protected] wrote:

Actually I thought about a normal builder, so you could chain and use it
with build() in the end like .add().add().build(). But then I realized that
you often want to perform online modifications so a builder is not really
suited for that... And the static method for that purpose might be also not
so nice, I agree.

Just emphasizing what the immutable operations do in the README would
probably be fine then.


Reply to this email directly or view it on GitHub
#20 (comment).

from rtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.