I hope you know IntellJ's inspection feature. Do you think it is possible to create inspections that check for the violation of your implementation patterns?
Thanks Walter
Kent Beck
author
Ranch Hand
Joined: Nov 07, 2003
Posts: 45
posted
0
Dear Walter,
I am not familiar with IntelliJ's inspections. Assuming they are triggered by a kind of AST matcher, some of the patterns (or their absence) should be detectable.
Regards,
Kent Beck Three Rivers Institute
Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0596007434/ref=jranch-20" target="_blank" rel="nofollow">JUnit Pocket Guide</a>
Michael Hunger
Greenhorn
Joined: Dec 17, 2007
Posts: 6
posted
0
Walter, actually there are already some inspections that handle patterns of the book. I.e. narrow scope or naming, final parameter/variable, convert field to local and many more intentions. Just take a look at the intention list in the settings and compare them with the implementation patterns.
Others are just sound OO-knowledge and available through the numerous refactorings IDEA offers. (i.e. extract Interface, Superclass, Encapsulate Fields, Replace Inheritance with Delegation, Move (instance) Method, Find Method duplicates)
It is quite difficult for an IDE to recognize smells that are in the eye of the beholder. It can't know which responsibilities you want to group together, which ones you want to extract and how they relate from the business point of view.
Michael
Kent Beck
author
Ranch Hand
Joined: Nov 07, 2003
Posts: 45
posted
0
Michael,
I think there is more to it than that. For example, I look for multiple messages to the same object in a given method as a hint that the receiving object could use more responsibility. I don't do any fancy business analysis, I just pattern match. I think an automated tool could detect this pattern, but it would have to be fairly sophisticated: for (X each : Y.Z()) { Y.W(); } for example, probably belongs in Y.
Regards,
Kent Beck Three Rivers Institute
Walter Bernstein
Ranch Hand
Joined: Dec 19, 2007
Posts: 57
posted
0
Originally posted by Kent Beck: Michael,
I think there is more to it than that. For example, I look for multiple messages to the same object in a given method as a hint that the receiving object could use more responsibility. I don't do any fancy business analysis, I just pattern match. I think an automated tool could detect this pattern, but it would have to be fairly sophisticated: for (X each : Y.Z()) { Y.W(); } for example, probably belongs in Y.
Regards,
Kent Beck Three Rivers Institute
"Feature Envy" is already detected. I will check your book to see which inspections are still missing.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.