[aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Bruno Oliveira
Good morning everyone! Lay out your costumes from halloween and let's talk about this jira (https://issues.jboss.org/browse/AEROGEAR-593).

Passos did a great work creating a builder for Pipes and of course we can improve it more and more, it's all about software. Currently to create a Pipe we must do it:

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();

Chatting with Matthias we agreed that would be better 2 alternatives:

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.add(Project.class).build();

Doing just this implicitly means that the name of the pipe will be "Project" and if you need 'extras':

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();

What do you guys think?


-- 
"The measure of a man is what he does with power" - Plato
-
@abstractj
-
Volenti Nihil Difficile

_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Daniel Passos-2
+1 to pipeline.add(Project.class)

On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <[hidden email]> wrote:
Good morning everyone! Lay out your costumes from halloween and let's talk about this jira (https://issues.jboss.org/browse/AEROGEAR-593).

Passos did a great work creating a builder for Pipes and of course we can improve it more and more, it's all about software. Currently to create a Pipe we must do it:

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();

Chatting with Matthias we agreed that would be better 2 alternatives:

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.add(Project.class).build();

Doing just this implicitly means that the name of the pipe will be "Project" and if you need 'extras':

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();

What do you guys think?


-- 
"The measure of a man is what he does with power" - Plato
-
@abstractj
-
Volenti Nihil Difficile

_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev



_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Matthias Wessendorf
On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <[hidden email]> wrote:
> +1 to pipeline.add(Project.class)

One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
http://BASE_URL/types <<<== note the 's' for plural ....

Fluent API:
the combination of 'add()' and a followed/ending 'build()' makes sense
in terms of a fluent API:
- here you add something (-> pipe) that is created (build) at the end
of the statement...

A little note aside...

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();

Is fine for me too:
-pipe => indicates you create a pipe object;
-buildAndAdd => you build the object and add it to the pipeline.

Not sure if the 'buildAndAdd' is a bit too verbose.

I am fine with the suggestion from Bruno
(pipeline.add(class).build();), but wanted to share the notes on the
pipe().buildAndAdd() as well


-M


>
> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <[hidden email]> wrote:
>>
>> Good morning everyone! Lay out your costumes from halloween and let's talk
>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>
>> Passos did a great work creating a builder for Pipes and of course we can
>> improve it more and more, it's all about software. Currently to create a
>> Pipe we must do it:
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>
>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.add(Project.class).build();
>>
>> Doing just this implicitly means that the name of the pipe will be
>> "Project" and if you need 'extras':
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>
>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>
>> What do you guys think?
>>
>>
>> --
>> "The measure of a man is what he does with power" - Plato
>> -
>> @abstractj
>> -
>> Volenti Nihil Difficile
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Marko Strukelj-2
On Thu, Nov 1, 2012 at 12:49 PM, Matthias Wessendorf <[hidden email]> wrote:
> On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <[hidden email]> wrote:
>> +1 to pipeline.add(Project.class)
>
> One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
> http://BASE_URL/types <<<== note the 's' for plural ....
>

I just wanted to ask about that :)

Maybe we could even introduce an annotation on 'entity' classes that
would specify an endpoint, and take that into account.

> Fluent API:
> the combination of 'add()' and a followed/ending 'build()' makes sense
> in terms of a fluent API:
> - here you add something (-> pipe) that is created (build) at the end
> of the statement...
>
Yes that's nice.

> A little note aside...
>
> Pipeline pipeline  = new Pipeline(ROOT_URL);
> pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();
>
> Is fine for me too:
> -pipe => indicates you create a pipe object;
> -buildAndAdd => you build the object and add it to the pipeline.
>
> Not sure if the 'buildAndAdd' is a bit too verbose.
>
> I am fine with the suggestion from Bruno
> (pipeline.add(class).build();), but wanted to share the notes on the
> pipe().buildAndAdd() as well
>
>
> -M
>
>
>>
>> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <[hidden email]> wrote:
>>>
>>> Good morning everyone! Lay out your costumes from halloween and let's talk
>>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>>
>>> Passos did a great work creating a builder for Pipes and of course we can
>>> improve it more and more, it's all about software. Currently to create a
>>> Pipe we must do it:
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>>
>>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>> pipeline.add(Project.class).build();
>>>
>>> Doing just this implicitly means that the name of the pipe will be
>>> "Project" and if you need 'extras':
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>>
>>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>>
>>> What do you guys think?
>>>
>>>
>>> --
>>> "The measure of a man is what he does with power" - Plato
>>> -
>>> @abstractj
>>> -
>>> Volenti Nihil Difficile
>>>
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Summers Pittman
In reply to this post by Matthias Wessendorf
-1 to Pipeline.add
+1 to Pipline.pipe w/ buildAndAdd() (or overloading build to also add)

I don't like pipeline.add(Class) because it implies that the adding is happening then and you don't have to do more work.  I like buildAndAdd or overloading the builder Pipeline provides because it is either more explicit or more automatic respectivly.

----- Original Message -----
From: "Matthias Wessendorf" <[hidden email]>
To: "AeroGear Developer Mailing List" <[hidden email]>
Sent: Thursday, November 1, 2012 7:49:11 AM
Subject: Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <[hidden email]> wrote:
> +1 to pipeline.add(Project.class)

One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
http://BASE_URL/types <<<== note the 's' for plural ....

Fluent API:
the combination of 'add()' and a followed/ending 'build()' makes sense
in terms of a fluent API:
- here you add something (-> pipe) that is created (build) at the end
of the statement...

A little note aside...

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();

Is fine for me too:
-pipe => indicates you create a pipe object;
-buildAndAdd => you build the object and add it to the pipeline.

Not sure if the 'buildAndAdd' is a bit too verbose.

I am fine with the suggestion from Bruno
(pipeline.add(class).build();), but wanted to share the notes on the
pipe().buildAndAdd() as well


-M


>
> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <[hidden email]> wrote:
>>
>> Good morning everyone! Lay out your costumes from halloween and let's talk
>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>
>> Passos did a great work creating a builder for Pipes and of course we can
>> improve it more and more, it's all about software. Currently to create a
>> Pipe we must do it:
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>
>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.add(Project.class).build();
>>
>> Doing just this implicitly means that the name of the pipe will be
>> "Project" and if you need 'extras':
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>
>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>
>> What do you guys think?
>>
>>
>> --
>> "The measure of a man is what he does with power" - Plato
>> -
>> @abstractj
>> -
>> Volenti Nihil Difficile
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Marko Strukelj-2
-1 to overloading build() to also add.

That would give no indication that a reference is kept by Pipeline in
the background, and it's not something you normally expect from a
factory object, to keep references to created objects around.


On Thu, Nov 1, 2012 at 1:48 PM, Summers Pittman <[hidden email]> wrote:

> -1 to Pipeline.add
> +1 to Pipline.pipe w/ buildAndAdd() (or overloading build to also add)
>
> I don't like pipeline.add(Class) because it implies that the adding is happening then and you don't have to do more work.  I like buildAndAdd or overloading the builder Pipeline provides because it is either more explicit or more automatic respectivly.
>
> ----- Original Message -----
> From: "Matthias Wessendorf" <[hidden email]>
> To: "AeroGear Developer Mailing List" <[hidden email]>
> Sent: Thursday, November 1, 2012 7:49:11 AM
> Subject: Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent
>
> On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <[hidden email]> wrote:
>> +1 to pipeline.add(Project.class)
>
> One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
> http://BASE_URL/types <<<== note the 's' for plural ....
>
> Fluent API:
> the combination of 'add()' and a followed/ending 'build()' makes sense
> in terms of a fluent API:
> - here you add something (-> pipe) that is created (build) at the end
> of the statement...
>
> A little note aside...
>
> Pipeline pipeline  = new Pipeline(ROOT_URL);
> pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();
>
> Is fine for me too:
> -pipe => indicates you create a pipe object;
> -buildAndAdd => you build the object and add it to the pipeline.
>
> Not sure if the 'buildAndAdd' is a bit too verbose.
>
> I am fine with the suggestion from Bruno
> (pipeline.add(class).build();), but wanted to share the notes on the
> pipe().buildAndAdd() as well
>
>
> -M
>
>
>>
>> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <[hidden email]> wrote:
>>>
>>> Good morning everyone! Lay out your costumes from halloween and let's talk
>>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>>
>>> Passos did a great work creating a builder for Pipes and of course we can
>>> improve it more and more, it's all about software. Currently to create a
>>> Pipe we must do it:
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>>
>>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>> pipeline.add(Project.class).build();
>>>
>>> Doing just this implicitly means that the name of the pipe will be
>>> "Project" and if you need 'extras':
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>>
>>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>>
>>> What do you guys think?
>>>
>>>
>>> --
>>> "The measure of a man is what he does with power" - Plato
>>> -
>>> @abstractj
>>> -
>>> Volenti Nihil Difficile
>>>
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Summers Pittman


On 11/01/2012 09:40 AM, Marko Strukelj wrote:
> -1 to overloading build() to also add.
Yeah.  In my implementation the factory method returns an AddAuthBuilder
which has a .add() method which builds and adds (and says so in the javadoc)

> That would give no indication that a reference is kept by Pipeline in
> the background, and it's not something you normally expect from a
> factory object, to keep references to created objects around.
>
>
> On Thu, Nov 1, 2012 at 1:48 PM, Summers Pittman<[hidden email]>  wrote:
>> -1 to Pipeline.add
>> +1 to Pipline.pipe w/ buildAndAdd() (or overloading build to also add)
>>
>> I don't like pipeline.add(Class) because it implies that the adding is happening then and you don't have to do more work.  I like buildAndAdd or overloading the builder Pipeline provides because it is either more explicit or more automatic respectivly.
>>
>> ----- Original Message -----
>> From: "Matthias Wessendorf"<[hidden email]>
>> To: "AeroGear Developer Mailing List"<[hidden email]>
>> Sent: Thursday, November 1, 2012 7:49:11 AM
>> Subject: Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent
>>
>> On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos<[hidden email]>  wrote:
>>> +1 to pipeline.add(Project.class)
>> One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
>> http://BASE_URL/types<<<== note the 's' for plural ....
>>
>> Fluent API:
>> the combination of 'add()' and a followed/ending 'build()' makes sense
>> in terms of a fluent API:
>> - here you add something (->  pipe) that is created (build) at the end
>> of the statement...
>>
>> A little note aside...
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();
>>
>> Is fine for me too:
>> -pipe =>  indicates you create a pipe object;
>> -buildAndAdd =>  you build the object and add it to the pipeline.
>>
>> Not sure if the 'buildAndAdd' is a bit too verbose.
>>
>> I am fine with the suggestion from Bruno
>> (pipeline.add(class).build();), but wanted to share the notes on the
>> pipe().buildAndAdd() as well
>>
>>
>> -M
>>
>>
>>> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira<[hidden email]>  wrote:
>>>> Good morning everyone! Lay out your costumes from halloween and let's talk
>>>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>>>
>>>> Passos did a great work creating a builder for Pipes and of course we can
>>>> improve it more and more, it's all about software. Currently to create a
>>>> Pipe we must do it:
>>>>
>>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>>>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>>>
>>>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>>>
>>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>>> pipeline.add(Project.class).build();
>>>>
>>>> Doing just this implicitly means that the name of the pipe will be
>>>> "Project" and if you need 'extras':
>>>>
>>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>>>
>>>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>>>
>>>> What do you guys think?
>>>>
>>>>
>>>> --
>>>> "The measure of a man is what he does with power" - Plato
>>>> -
>>>> @abstractj
>>>> -
>>>> Volenti Nihil Difficile
>>>>
>>>> _______________________________________________
>>>> aerogear-dev mailing list
>>>> [hidden email]
>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>
>>>
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev

_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
Reply | Threaded
Open this post in threaded view
|

Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Daniel Passos-2
In reply to this post by Summers Pittman
Sorry Guys,

I did not pay attention to that. Actually when I said +1 I wanted to say +1 to pipeline.pipe(Class) and not to pipeline.add(Class) 

using pipeline.pipe(Project.class).buildAndAdd() you don't need to specify mandatory "name" and "class" to call buildAndAdd() 

The way I see, it's less effort to do, so wdyt?


On Thu, Nov 1, 2012 at 10:48 AM, Summers Pittman <[hidden email]> wrote:
-1 to Pipeline.add
+1 to Pipline.pipe w/ buildAndAdd() (or overloading build to also add)

I don't like pipeline.add(Class) because it implies that the adding is happening then and you don't have to do more work.  I like buildAndAdd or overloading the builder Pipeline provides because it is either more explicit or more automatic respectivly.

----- Original Message -----
From: "Matthias Wessendorf" <[hidden email]>
To: "AeroGear Developer Mailing List" <[hidden email]>
Sent: Thursday, November 1, 2012 7:49:11 AM
Subject: Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <[hidden email]> wrote:
> +1 to pipeline.add(Project.class)

One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
http://BASE_URL/types <<<== note the 's' for plural ....

Fluent API:
the combination of 'add()' and a followed/ending 'build()' makes sense
in terms of a fluent API:
- here you add something (-> pipe) that is created (build) at the end
of the statement...

A little note aside...

Pipeline pipeline  = new Pipeline(ROOT_URL);
pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();

Is fine for me too:
-pipe => indicates you create a pipe object;
-buildAndAdd => you build the object and add it to the pipeline.

Not sure if the 'buildAndAdd' is a bit too verbose.

I am fine with the suggestion from Bruno
(pipeline.add(class).build();), but wanted to share the notes on the
pipe().buildAndAdd() as well


-M


>
> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <[hidden email]> wrote:
>>
>> Good morning everyone! Lay out your costumes from halloween and let's talk
>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>
>> Passos did a great work creating a builder for Pipes and of course we can
>> improve it more and more, it's all about software. Currently to create a
>> Pipe we must do it:
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>
>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>> pipeline.add(Project.class).build();
>>
>> Doing just this implicitly means that the name of the pipe will be
>> "Project" and if you need 'extras':
>>
>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>
>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>
>> What do you guys think?
>>
>>
>> --
>> "The measure of a man is what he does with power" - Plato
>> -
>> @abstractj
>> -
>> Volenti Nihil Difficile
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
> _______________________________________________
> aerogear-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>



--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev


_______________________________________________
aerogear-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-dev