-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Too many chained references" on fluent interfaces in general #20
Comments
Could you provide more detail, please? This doesn't give me anything I can work with. |
I mean the same thing as stated in issue #15 but not only regarding to LINQ. I find nothing smelly on: |
Without an real codebase I can't provide you any refactoring hints, but your code is kind of smelly ;) IMHO this code actually should be marked as "Too many chained references". |
Dear Toni, Please refactor this code that i can see what you mean with not smelly code. var result = nhibernateSession.QueryOver() thx |
In your context your advise might be correct. Without knowing hibernate, it's still obvious to me what your code does. But the real point is, that in general such method chains lead to code which is hard to understand and to maintain. Don't think of writing code, rather think of reading it later without background knowledge! I also suspect that I've got your question wrong. If so, I'm sorry. |
"Without knowing hibernate, it's still obvious to me what your code does."
In this case i don't see it as violation of "Law of Demeter". |
This type of "violation" of the the Law of Demeter is discussed in length by Phil Haack He quotes Martin Fowler:
http://blog.robustsoftware.co.uk/2010/04/linq-and-law-of-demeter.html All these articles seem to suggest that it's not just a "dot counting exercise". This makes finding a one size fits all solution difficult to code into a CleanCode.Feature. When is the correct time to ignore warning from the Clean Code extension? Presumably when they are inappropriate. |
Fluent interfaces which don't violate the Law of Demeter are generally implemented as static extension methods. I think it would be reasonable to (optionally) exclude them. |
Not just extension methods. This is a common pattern I use and I feel does not violate LoD |
-> .List "Too many chained references"
makes no sence for me
The text was updated successfully, but these errors were encountered: