What "detailed code analysis" means exactly depends on the context. Where did you hear or read this?
JUnit is for automatic unittesting, 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.
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?
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: 622
posted
0
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: 35258
7
posted
0
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?