Posts

Showing posts with the label Software Development

String Concatenation vs StringBuilder Performance Benchmark

Image
This single Java class benchmark, shows impressively that the penalty for using StringBuilder instead of regular String concatenation can be around 5x ! Many static code analyzers like PMD / SonarQube deceptively claim the opposite. This assumption might be a vestige from the pre Java 5 era. Indeed some developers even concatenate compile time constants ( static final ) using StringBuilder. Although be warned , when it comes to using effectively non-final variables inside the concatenation, StringBuilder will drastically outperform the regular String concatenation by several orders of magnitude. Effectively non-final variables are references that are not fixed. On the other hand effectively final values do not necessarily need be prefixed with the " final " keyword but they could be , which differentiates them from effectively non-final variables, that cannot be prefixed with the " final " keyword without causing a compilation error. To state it clear ...

Difference Between a Parameter & Argument

Image
A parameter is part of a method's signature declaration and is used as a receiving container for an argument . An argument is an actual value literal that is passed to a method that performs operations based on and an arguments value. This graphic illustrates the difference:

Code Quality Assurance Using SonarQube

Here is how you enable SonarQube in your Maven based project. Just put this into your pom.xml : <build> <plugins> <plugin> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar-maven-plugin</artifactId> <version>4.3</version> </plugin> </plugins> </build> <profiles> <profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.profile>Your Profile</sonar.profile> <sonar.branch>master</sonar.branch> <sonar.projectDescription>Your Description</sonar.projectDescription> <sonar.buildbreaker.skip>false</sonar.buildbreaker.skip> <sonar.jdbc.url>jdbc:mysql:// sonar.example.com :3306/sonar</sonar.jdbc.url> <sonar.login>sonar</sonar.l...

Profilers for Java & Java8 w/ Very Low Overhead

Both are part of the official JDK8 package and don't need any further plugins to get started. Java Mission Control (jmc) is a production system ready profiler from Oracle that has an overhead of <1% and is suitable for profiling production systems Location: $JAVA_HOME/bin/jmc JVisualVM (jvisualvm) is a profiler for Oracle that is good enough for resolution of most issues that required a profiler, a nice profiler for getting started  Location: $JAVA_HOME/bin/jvisualvm

How to Assure Code Quality & Standards

Image
Code quality is an essential part of reliable high quality software where malfunctions — once they occur — can be detected and resolved quickly. To achieve a high level of software quality, certain conditions must be established to make quality not only a result of high effort and engineering passion but the result of an explicit systemic rule set.  There are several ways for  automated  code quality assessment and validation. For JVM (Java Virtual Machine) languages there are two ways to facilitate automated code analysis: Using  static byte code based analyzers like  FindBugs , that look for (anti-) patterns in the compiled JVM language code. The advantage of this tool is that it is suitable for polyglot environments and is JVM language agnostic. On the one hand it can detect issues other kind of tools cannot (e.g.  UCF_USELESS_CONTROL_FLOW ), on the other hand it  depends on a specific class file format  that is different in every major J...

The Weird Relationship Between Management and Engineers

Image
The reason why some engineers feel not be taken seriously, could not be better shown as in the foreword of  The Clean Coder - A Code of Conduct for Professional Programmers - R. Martin (Pearson, 2011) : It all starts a short time ago in a place not too far away. Cue the curtain, lights and camera, Charley .... Several years ago I was working at a medium-sized corporation selling highly regulated products. You know the type; we sat in a cubicle farm in a three-story building, directors and up had private offices, and getting everyone you needed into the same room for a meeting took a week or so. We were operating in a very competitive market when the government opened up a new product. Suddenly we had an entirely new set of potential customers; all we had to do was to get them to buy our product. That meant we had to file by a certain deadline with the federal government, pass an assessment audit by another date, and go to market on a third date. xiii ...