Are there tools for detecting architectural and design patterns in code?

Our team does reverse engineering in an application with virtually nonexistent documentation. We want to determine if there is a use of architectural or design patterns. You can understand that this application is great, so watching manually does not make sense to us.

This application is written in Java, and we use Eclipse for the IDE, so it can be a plugin for Eclipse.

We found several tools, such as Design Patterns detections Similarity Scoring, but it doesn’t work very well.

So, do such tools exist?

+3
source share
4 answers

If you have the source code for the application, you are most likely reengineering it, not reverse engineering. (The latter means recovering some higher-level code from machine or byte code).

Anyway, you want to understand the application, i.e. create a mental model in your mind. I am afraid that automatic tools do not help much in this. What good is it for you to get a list of suggested patterns in your code? Would it help you better understand what the code actually does and why? Especially taking into account the high chances of using templates in legacy code: - (

In the end, you still need to read the code. But here is another similar thread , which, I hope, will help to capture an outdated application in a difficult task.

+4
source

I do not think that such tools exist, because it will be quite difficult. Another approach might be to create something like a UML diagram. This should lead to an abstraction of code that can help you define a design pattern.

+1
source

I doubt there are tools for detecting patterns or constructs in code

Code Bubbles can dramatically help reverse engineering when it finally comes out!

Recently, it has been very useful for me to use code coverage tools to identify which parts of the code are invoked when a specific user / system action is initiated. This is not what the tools were intended for, but more and more effective than other approaches. (You can post a link to the details here if there is a demand for it)

The next best approach is to use a tool like MaintainJ to track code execution. This link of documents that are suitable (when the author talks about aspects) and various other approaches, and having tried all of them, coverage is what I decided for.

0
source

Have you tried running code-based javadoc? This would give you an idea of ​​the structure (or lack thereof) of the code. If you're really lucky, design patterns can be mentioned in the comments.

There are many other tools for detecting class hierarchies - ClassCycle, Macker, JDepend, etc.

Automatically detecting design patterns would be quite complicated, I think, because the design pattern has a lot of room for change.

-1
source

All Articles