Code Monkey home page Code Monkey logo

Comments (4)

robdmoore avatar robdmoore commented on August 16, 2024

Are there any scenarios that this lights up that you can't do with .BuildList() followed by a LINQ extension method to grab a random item? If not then it seems like, while it's useful, it's an orthogonal concern of the library?

from teststack.dossier.

Quantumplation avatar Quantumplation commented on August 16, 2024

If the builder has been used to construct several different objects, it could be more difficult. It's all doable, but it's overhead / boilerplate, whereas this library is meant (as I interpret it) to eliminate as much of that as possible.

Something that isn't as simple as .BuildList() and .Random() would be the tree example I gave. In that case, you're explicitly ensuring that everything generated is parented to something generated before it. Without this, you'd have to do something like:

    var nodes = Builder<OrgUnit>.CreateListOfSize(1000).BuildList();
    var workingSet = new List<OrgUnit>();
    workingSet.Add(nodes.First());
    foreach(var node in nodes)
    {
        node.Parent = workingSet.PickRandom();
        workingSet.Add(node);
    }

Yes, it's doable, but it seems to me to fit nicely within the concerns of the library: Reducing the burden of creating data for testing purposes.

from teststack.dossier.

robdmoore avatar robdmoore commented on August 16, 2024

Ah yeah, fair enough.

I'll be honest I'm still a bit confused about what's going on in that code, but if you have a PoC to push up as a pull request then maybe it will make more sense?

from teststack.dossier.

Quantumplation avatar Quantumplation commented on August 16, 2024

Sure, I'll do so when I get off work today.

from teststack.dossier.

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.