geometry-api-java icon indicating copy to clipboard operation
geometry-api-java copied to clipboard

Make public void methods of Envelope2D return "this" for fluid programming

Open mraad opened this issue 9 years ago • 5 comments

val envp = new Envelope2D(....) envp.move(dx,dy).scale(0.3).reaspect(ax,ay).centerAt(cx,cy)

mraad avatar Jan 16 '16 12:01 mraad

@climbage @randallwhitman Yes/no?

stolstov avatar Jan 19 '16 18:01 stolstov

I don't have a strong opinion either way.

climbage avatar Jan 19 '16 18:01 climbage

I like chaining and use it in C++. However, in Java the method signature does not tell what the method does - creates a new object or returns this. So I am more in favor of leaving it as is.

stolstov avatar Jan 19 '16 19:01 stolstov

No strong opinion from me either.

When using Scala, can achieve the sample desired syntax via implicits to complement existing library.

randallwhitman avatar Jan 19 '16 19:01 randallwhitman

I highly advocate to return this rather than void

mraad avatar Jan 19 '16 20:01 mraad