Live data from Hacker News

Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

viva64.com

21–30 of 130 posts

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#21
post #7
post #2

no button in the IDE :)

Have you used one of the popular IDEs recently (Visual Studio, Xcode etc)? It's built into most these days. Everybody I know who actually uses static analysis does so because it's built into their IDE and very easy to use.

Also, I recommend you to try Incremental analysis mode in PVS-Studio. It corrects on its own and doesn't distract programmer. http://www.viva64.com/en/b/0305/#ID0ECLDK

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#23

Because neither an advanced type system nor static analysis could catch bugs in program logic?) The benefits of static typing (complie-time checks) are grossly exaggerated. If the claims were true, Java itself and Java projects would be much less buggy.)

This reasoning makes no sense to me. It's like:

Alice: "Doing X will prevent bugs like Y!"

Bob: "Oh, but it does nothing for bugs like Z. I just won't bother at all, then".

Why would you not want to try and remove an entire class of bugs if it were within your power to do so? Just look at all the effort companies like Facebook have poured into exactly this kind of problem with things like Hack and Flow (which make use of OCaml).

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#24

Because neither an advanced type system nor static analysis could catch bugs in program logic?) The benefits of static typing (complie-time checks) are grossly exaggerated. If the claims were true, Java itself and Java projects would be much less buggy.)

Believe it or not, there're far more advanced type systems than Java’s. And yes, they do help to catch logic bugs among other things too.

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#25
I do! For cheapness, Flawfinder, CPPCheck, and Product > Analyze in xcode (thanks clang) (the walkthroughs in xcode of how they deduced the problem are really great, blue arrows everywhere, very neat).

EDIT: Additionally, given the changes in C++11 we should be able to push all the work onto the compiler for checking type problems, remove dangerous operations, dangling pointers, naked new/delete and avoid casting where possible. It would make for bug-free software. I know someone who writes their C++ like it is late 80s C and firstly, it's horrible to read. And secondly, it does really dangerous things.

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#26

Because neither an advanced type system nor static analysis could catch bugs in program logic?) The benefits of static typing (complie-time checks) are grossly exaggerated. If the claims were true, Java itself and Java projects would be much less buggy.)

You'd be surprised. Probably at both, but I hasten to get it in the conversation that static analysis is more than just static typing. By a long shot.

To me, simple static analysis can be over sold to the point that it is worthless. I swear, I see more effort put into detecting tabs versus spaces than I do things that actually reliably cause bugs. Seriously, unless you are writing make files, I just can't bring myself to care on tabs.

However, using some of the more advanced static analysis tools that don't just show where you forgot to do a null check, but also show where you pass in a null value... That is truly impressive and fixes bugs. Even better, these are things that can be used to harden a code base without having to rewrite it.

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#27
I use IntelliJ for my java development. It has a lot of analysis built in (whilst you're writing code). I'm not sure if there are that many static analysis checks (Findbugs etc) that are missing outside of those real time checks?

I can often determine whether someone had used Eclipse or IntelliJ; there tend to be a lot fewer analysis warnings if someone has used IntelliJ (out of the box) => perhaps we need this analysis in real time?

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#28
post #12

Earlier quoted context omitted.

In Xcode at least there's a 'Build & Analyze" command (cmd-shift-b). What I like to do is to force a deep analyze on every build. Takes a little longer to build but at least I catch some bugs when I introduce them.

My compile is already 10 minutes, I don't want to add a static analysis pass to every build thanks.

Why is your compile 10 minutes? Mine is about 20 seconds for ~82000 lines of C++ (not comments), with 43000 header lines and 7669 lines of C (according to cloc), and that's on a 2008 quad-core Xeon Mac Pro.

Do you not parallel build?

Re: Why Don't Software Developers Use Static Analysis Tools to Find Bugs?

#29
post #12

Earlier quoted context omitted.

In Xcode at least there's a 'Build & Analyze" command (cmd-shift-b). What I like to do is to force a deep analyze on every build. Takes a little longer to build but at least I catch some bugs when I introduce them.

My compile is already 10 minutes, I don't want to add a static analysis pass to every build thanks.

I would like to put my two cents.

1) PVS-Studio can instead be set to run in background immediately after the edited code has been successfully compiled.

2) PVS-Studio integrates with IncrediBuild. And soon we will publish an article about it. A little spoiler. :)

Post reply on HN