aspose file tools*
The moose likes Beginning Java and the fly likes Deatiled Code Analysis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Deatiled Code Analysis" Watch "Deatiled Code Analysis" New topic
Author

Deatiled Code Analysis

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi All,

What does detailed code analysis mean? Can we do code analysis using JUnit?

Thanks.

Be Humble... Be Nice.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

What "detailed code analysis" means exactly depends on the context. Where did you hear or read this?

JUnit is for automatic unit testing, not for code analysis. There are a number of tools that do static code analysis - such a tool reads your source code and analyses it using a number of rules, and warns you about potential bugs in your code. See, for example FindBugs and PMD.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Jesper Young wrote:What "detailed code analysis" means exactly depends on the context. Where did you hear or read this?

JUnit is for automatic unit testing, not for code analysis. There are a number of tools that do static code analysis - such a tool reads your source code and analyses it using a number of rules, and warns you about potential bugs in your code. See, for example FindBugs and PMD.



I was asked this question in an inteview and I said Junit. I wanted to confirm with you guys and looks like I am wrong anyways Jesper, I have few more questions.

1).Can't we do the analysis without any tools and if we can, do people follow this approach?

2).Does dynamic analysis come under the code analysis too?

3).Does white and black box testing methods come under the code analysis too?

Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13884
    
  10

Ofcourse you could do it also without any tools, but tools save time and make less mistakes than people. On the other hand, tools cannot check everything. I guess that code reviews are a common thing, especially when there are high quality standards.

Dynamic analysis: It depends exactly on what you mean by that. I would not call things like profiling and testing (including white or black box testing) "code analysis". In my opinion, "code analysis" means looking at the source code to determine if it is correct. With things like profiling and testing, you are not directly looking at the source code.
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Ok, Thanks for the reply Jesper. Debugger in IDEs, can also be used for static code analysis right?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
Debuggers are used at runtime, so that rules out that they'd do static analysis (which is done with classes, not objects).

But even at runtime, what kind of analysis do you expect from a debugger?


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deatiled Code Analysis
 
Similar Threads
Profiling tool in WSAD
object serialization
Analysing the Syntax of a sentence
Application mining tools
Method Arguments