Do fluent interfaces violate the Law of Demeter?

Posted by Jakub Šturc on Stack Overflow See other posts from Stack Overflow or by Jakub Šturc
Published on 2008-09-15T22:16:52Z Indexed on 2010/03/20 10:01 UTC
Read the original article Hit count: 495

Filed under:
|
|

The wikipedia article about Law of Demeter says:

The law can be stated simply as "use only one dot".

However a simple example of a fluent interface may look like this:

static void Main(string[] args)
{
   new ZRLabs.Yael.Pipeline("cat.jpg")
        .Rotate(90)
        .Watermark("Monkey")
        .RoundCorners(100, Color.Bisque)
        .Save("test.png");
}

So does this goes together?

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about oop