Open GoogleCodeExporter opened 8 years ago
I agree fluent API could don't violate Demeter Law. Still many people uses
DEEP_STUBS in such case, which is wrong, I prefer to have the javadoc saying
it's wrong instead of having to go to some guide, blog or wiki.
However, it is possible to add that fluent API could not fall under this
category. For reference I'd like to see the paper that says that fluent
interfaces don't violate the Law of Demeter.
Thx for reporting the javadoc issue.
Brice
Original comment by brice.du...@gmail.com
on 14 Mar 2013 at 7:41
Well, I just searched google for fluent api law of demeter and found a few
useful pages, like:
http://haacked.com/archive/2009/07/13/law-of-demeter-dot-counting.aspx
and
http://mvdms.com/wp-content/uploads/2013/01/Martijn-van-der-Maas_Fluent-or-Law-o
f-Demeter.pdf
Fluent APIs are useful for a DSL-like interface. They are a different design
approach, with different priorities, and coupling should still be kept to a
minimum to achieve it. Martin Fowler prefers to call it the "Occasionally
Useful Law of Demeter". It is a rule of thumb, not a hard and fast rule.
Original comment by mpharri...@gmail.com
on 15 Mar 2013 at 9:45
Cool thanks for links, I actually remember this saying of Martin Fowler. I
personally like fluent APIs design, still I've never actually read solid papers
on them. Never actually took the time to search though.
I think it's fair to mention a fluent api is a reasonable usage for the
RETURNS_DEEP_STUBS usage, but still keeps the warning regarding the Law of
Demeter.
Cheers,
Brice
Original comment by brice.du...@gmail.com
on 15 Mar 2013 at 10:44
Original comment by brice.du...@gmail.com
on 29 Apr 2013 at 4:04
Original issue reported on code.google.com by
mpharri...@gmail.com
on 1 Mar 2013 at 8:39