Git Product home page Git Product logo

Comments (3)

hagbard avatar hagbard commented on July 27, 2024

On Tue, Apr 9, 2013 at 11:48 PM, fluentfuture [email protected]:

Hi.

Has it been considered that the ASSERT.that(list).has().allOf(foo,
bar).inOrder() be changed to ASSERT.that(list).hasAllOf(foo,
bar).inOrder()? And same for the rest of Has?

Or, is there a discussion where hasBlah() was voted out in favor of
has().blah()?

The way it is the has() methods seems a little hiccupy as opposed to
"fluent" to me. And it probably pose some discoverability issue to
unfamiliar users because one has to type "has()." first in order to see the
things he's really looking for.

Also, I have the habit of writing chained method calls one at a line, but
the has() makes it odd to read:

ASSERT.that(list)
.has()
.allOf(foo, bar)
.inOrder();

Because has() and allOf() are parts of the same atomic clause of the
sentence, with neither alone makes the sense.

Imho, it looks more natural as:

ASSERT.that(list)
.hasAllOf(foo, bar)
.inOrder();

Where each line states a single but atomic aspect of assertion.

There's nothing to stop you doing:

ASSERT.that(list)
.has().allOf(foo, bar)
.inOrder();

We could potentially roll some common cases into hasXxx() but we'll always
need has() for extensibility.

Christian probably has more of an opinion than I do on this. If there are
dozens of cases to roll in, I'd vote against but if there are two or three
really obvious wins then it might be worth it.

hasAllOf()
hasAnyOf()
hasNoneOf()
hasAtLeastNOf() - probably not a great idea ...
hasAtMostNOf() - ditto ...
...

I feel like there's diminishing returns from here on, but I might be
missing a whole class of predicates.

Cheers,
David

from truth.

fluentfuture avatar fluentfuture commented on July 27, 2024

I guess I'm just not used to this style maybe.

Either hasAllOf() or has(allOf()) reads more natural to me than has().allOf().

Instead of fluent, it reads hiccupy to me. The extra pair of parens serve to distract the eyes. At first sight my eyes were wondering what stops it from being:

has().all().of(foo, bar).in().order();

has().none().of(foo, bar).not().in().order();

Where do we draw the line?

(I'm semi-serious)

But thanks for explaining the rationale! I'm closing the issue since apparently it's only me feeling the issue.

from truth.

cgruber avatar cgruber commented on July 27, 2024

has().allOf/anyOf/exactly/item() there are two distinct things - a verb
and an object.

inOrder() is a single concept. in is a preposition and is entirely a
lead-up. One could say ordered() but inOrder() is more natural to an
english speaker.

notInOrder() isn't needed because that is the default - the looser
constraint

On 11 Apr 2013, at 10:24, fluentfuture wrote:

I guess I'm just not used to this style maybe.

Either hasAllOf() or has(allOf()) reads more natural to me than
has().allOf().

Instead of fluent, it reads hiccupy to me. At first sight my eyes were
wondering what stops it from being:

has().all().of(foo, bar).in().order();

has().none().of(foo, bar).not().in().order();

Where do we draw the line?

(I'm semi-serious)

But thanks for explaining the rationale! I'm closing the issue since
apparently only me is feeling the issue.


Reply to this email directly or view it on GitHub:
#55 (comment)

Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency
Injection
email: [email protected] :::: mobile: +1 (646) 807-9839

from truth.

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.