cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedict (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-10063) Standardize use of collections, streams, iterables, functions, predicates etc.
Date Thu, 13 Aug 2015 09:57:47 GMT


Benedict commented on CASSANDRA-10063:

Initially (without having considered it extensively), my thought is that we should introduce
a {{Streamable}} interface that we can supplant {{Iterable}} with, that also implements {{Iterable}},
but supports the same kind of composition methods as a {{Stream}} (and is implemented as a
simple mapping of those method calls onto any stream it produces). This would let us gradually
replace the old approach, since it could easily co-exist with both worlds.

I prefer this to the introduction of static methods wrapping any call to {{Iterable.iterator}},
as it makes the new world order the first class citizen, rather than retrofitting it. It also
means the code using such an object immediately gains the modernity of brevity and expressiveness,
without boilerplate, which is kind of the main point of the new facilities. Any unnecessary
boilerplate inevitably discourages me, at least, from using the new approaches as it seems
completely at odds with it, and defies the point. That may just be me, though.

> Standardize use of collections, streams, iterables, functions, predicates etc.
> ------------------------------------------------------------------------------
>                 Key: CASSANDRA-10063
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Benedict
>            Assignee: Benedict
>             Fix For: 3.x
> With the advent of Java 8 we have a lot of different mechanisms for achieving the same
expression of ideas. We should standardize on (approximately) a single approach across the
codebase, as this will help clarity, reduce development time (with less indecision about which
set of tools to use, and how to interface between the two), and improve icache occupancy.
> The problem is exacerbated by the difficulty of interfacing between the two paradigms,
and this (IMO) introduces an unnecessary cognitive burden when they inevitably meet. We should
pick one and fill in whatever we're missing to make it fit all of our needs. We should perform
a bit of due diligence about the implementation details of any utility methods we use also,
as having dived into a handful they are occasionally.... surprising. And probably not how
we would implement them (take {{Ordering.leastOf}} as an example).
> Since it is the future, I think we should be standardising on the JDK8 Streams API where
possible. There are a couple of rough edges with interfacing with it in some places, but we
can smooth them and the result should be much more legible code.
> This really should not be a huge amount of work, and I expect will pay dividends quite

This message was sent by Atlassian JIRA

View raw message