• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deatiled Code Analysis

 
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

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

Thanks.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 629
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, Thanks for the reply Jesper. Debugger in IDEs, can also be used for static code analysis right?

Thanks.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic