3 ms·
This sounds so familiar. Some 6 years ago, I joined a team of engineers developing a large (1.5M LOC) classic java/spring/hibernate application for administrati
by edejong 9y ago
This sounds so familiar. Some 6 years ago, I joined a team of engineers developing a large (1.5M LOC) classic java/spring/hibernate application for administration in higher education. The software was buggy and loads of time was wasted on bug-fixing, so I introduced the Findbugs static analysis package. Result: >6000 (suspected) bugs. It took a couple of days of blunt perseverance of the whole team to clean up the mess and bring it back to normal proportions, but the result was a stable, well-functioning system.
If you have static analysis tools available and you're writing a larger application (more than 10k LOC), and intend to maintain it for longer than a couple of months, it is definitely worth the initial investment. Better than static analysis, is static typing in a language with an expressive type-system, such as Scala. You simply cannot have NPEs with Option types.
tldr; Used static analysis on 1.5M LOC codebase to reduce bugginess tremendously. Use of static analysis and statically typed languages is adviced.
- blub 9y agoThe first time we ran static analysis on the C++ code base of a specific project, it found ~20 minor issues and a couple of medium severity ones which were mitigated by other checks. However, we also used 3rd-party open source C libraries, where it found thousands of problems. I'm talking about serious issues, memory leaks, invalid memory access, etc. P.S: I hope Scala implemented optional types better than Java, where the optional types themselves are nullable :)
- pjmlp 9y agoOptional types will eventually become value types on Java, you just need to wait until Java 10 for it.
- edejong 9y agoWell, technically you could write `val opt: Option[Int] = null`, but I've never seen it used and would seriously consider sending the author back to a course Scala for Dummies. It's interesting how many bugs can be found by static analysis. The problem with C and C++ is that the domain of 'normal' operations is much larger than Java, leading to more false positives in static analysis and/or less true positives.