File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Agile and Other Processes and the fly likes Implementing Implementation Patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "Implementing Implementation Patterns" Watch "Implementing Implementation Patterns" New topic
Author

Implementing Implementation Patterns

Walter Bernstein
Ranch Hand

Joined: Dec 19, 2007
Posts: 57
Hi Kent,

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
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
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
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
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://aspose.com/file-tools
 
subject: Implementing Implementation Patterns