ToString Method Name
The ToString.of() violates the new transform rules and we need to choose a new name. Here is the method for reference: /** * Returns a {@code PTransform>} which transforms each * element of the input {@link PCollection} to a {@link String} using the * {@link Object#toString} method. */ public static PTransform, PCollection> of() { return new SimpleToString(); } Here are the possibilities we've had so far: - elements - default - simple - asString - simpleString - stringValue - toString - strings - make I think default shouldn't be used as that's a keyword for Lambdas. Here is the guide that I think of() is violating (@eugene is that correct?): Name factory functions so that either the function name is a verb, or referring to the transform reads like a verb: e.g. MongoDbIO.read(), Flatten.iterables(). What are everyone's thoughts? I'm thinking going back to elements or make, strings. Thanks, Jesse
Re: ToString Method Name
Yup, this is the part of the style guide I had in mind. As you probably know from the PR, I'm in favor of "elements" :) Note that here we're naming a family of transforms - elements, kvs and iterables (potentially more in the future), so the naming should be consistent between the different versions and future-proof. On Fri, Feb 10, 2017 at 10:16 AM Jesse Anderson wrote: > The ToString.of() violates the new transform rules and we need to choose a > new name. > > Here is the method for reference: > /** >* Returns a {@code PTransform>} which > transforms each >* element of the input {@link PCollection} to a {@link String} using the >* {@link Object#toString} method. >*/ > public static PTransform, PCollection> of() { > return new SimpleToString(); > } > > Here are the possibilities we've had so far: > >- elements >- default >- simple >- asString >- simpleString >- stringValue >- toString >- strings >- make > > I think default shouldn't be used as that's a keyword for Lambdas. > > Here is the guide that I think of() is violating (@eugene is that > correct?): > Name factory functions so that either the function name is a verb, or > referring to the transform reads like a verb: e.g. MongoDbIO.read(), > Flatten.iterables(). > > What are everyone's thoughts? I'm thinking going back to elements or make, > strings. > > Thanks, > > Jesse >
Re: ToString Method Name
Ok will create a JIRA and PR. On Fri, Feb 10, 2017 at 11:23 AM Eugene Kirpichov wrote: > Yup, this is the part of the style guide I had in mind. As you probably > know from the PR, I'm in favor of "elements" :) > Note that here we're naming a family of transforms - elements, kvs and > iterables (potentially more in the future), so the naming should be > consistent between the different versions and future-proof. > > On Fri, Feb 10, 2017 at 10:16 AM Jesse Anderson > wrote: > > The ToString.of() violates the new transform rules and we need to choose a > new name. > > Here is the method for reference: > /** >* Returns a {@code PTransform>} which > transforms each >* element of the input {@link PCollection} to a {@link String} using the >* {@link Object#toString} method. >*/ > public static PTransform, PCollection> of() { > return new SimpleToString(); > } > > Here are the possibilities we've had so far: > >- elements >- default >- simple >- asString >- simpleString >- stringValue >- toString >- strings >- make > > I think default shouldn't be used as that's a keyword for Lambdas. > > Here is the guide that I think of() is violating (@eugene is that > correct?): > Name factory functions so that either the function name is a verb, or > referring to the transform reads like a verb: e.g. MongoDbIO.read(), > Flatten.iterables(). > > What are everyone's thoughts? I'm thinking going back to elements or make, > strings. > > Thanks, > > Jesse > >