-
First Things First – Getting Started
Need help figuring out where to start? Check out the getting started page. 💚 Read more…
-
Learning from Other’s Mistakes! The OWASP Top 10
The Open Worldwide Application Security Project (OWASP) foundation compiles a list of the top 10 web application security issues, updated every few years, to help developers understand potential pitfalls in programming. This ‘OWASP Top-10’ is an essential resource for both novice and experienced developers. As well as detailing each issue, it also provides prevention tips… Read more…
-
Reading the Tea Leaves! Understanding Java Stack Traces for Exception Troubleshooting
Understanding a Java stack trace is often useful while troubleshooting issues. Stack traces contain both information about the exception thrown and the incomplete method call(s) to reach the line of code where the exception was thrown. Exception handling can also cause changes to the stack trace. Read more…
-
Avoid Reinventing the Wheel! Java Method References
This article discusses how Java method references can replace lambda expressions in certain situations, simplifying the code and increasing its clarity. Method references, indicated by a double colon (::), can be used for constructors, static methods, or instance methods and are particularly useful in Java stream pipelines. However, their usage and consumption may vary depending… Read more…
-
A Trickle or a Flood! Java Stream Basics
Java streams, which is a feature for processing arrays, collections, or ranges of objects. Streams don’t store data and are recreated for each computation or pipeline. This guide covers multiple operations including creating basic streams, lazy intermediate operations, stateless/stateful operations, side effects, filtering, reducing to a single item, and mapping. Read more…
-
Inline, Unnamed Methods! Lambda Expressions
Java’s lambda expressions, introduced in Java 8, are unnamed functions defined in-line within code. They have explicit inputs often sourced from Java streams and implicit inputs from variables within the scope, which must be final or effectively final. They contribute to separate, unnamed functions in JaCoCo code coverage reports. These expressions require varying syntax based… Read more…
-
Building As We Go! Java’s StringBuffer for Multi-Threaded Use Cases
When your use case requires multiple threads to be able to construct a String in parallel, then Java’s StringBuffer may be what you need. However, additional synchronization logic may still be needed in the calling code. Read more…
-
Building As I Go! Using Java’s String Builder for Single Threads
When building Java Strings, we can significantly improve performance by using a StringBuilder for single threaded use cases. Read more…
-
The Immutable Java String! Constructing a String When All Variables Known
Although we touched upon this in a prior post, talking about how Java Strings are immutable (unchanging) and why using concatenation can lead to performance and garbage collection issues, as well as an alternative approach if all values are known at the time of String construction. Read more…
-
Troubleshooting Tip! Looking with Fresh Eyes
Powering through may not be the best way to make forward progress when you feel stuck while troubleshooting an issue. Instead, you may benefit from trying to find a way to look with fresh eyes, either your own or those of a teammate. Read more…
-
Automating Parts of the Peer Review – Part 2! Adding Maven PMD Plugin
Different static code analysis plugins will catch different issues. As long as we are now slowing down the build too much, we may still benefit from also adding the maven-pmd-plugin to the build as an additional quality gate. Read more…
-
Automating Parts of the Peer Review – Part 1! Adding SpotBugs Maven Plugin for Static Code Analysis
A static code analysis tool, like spotbugs-maven-plugin will not replace an actual peer review, but it may help reduce the load that peer reviewers carry in the analysis. Anyone can make a mistake and it may help engineers write better code in the future. Read more…
-
Show Me the Source! Java Sources Cross Referencing Reports
By generating Java Cross Reference (JXR) reports in our Maven site, we enable deep links in other reports, such as static code analysis plugin reports. Read more…
-
Isn’t Unit Testing Enough? A Testing Pyramid Intro – The Build Steps
Delivering high-quality, reliable code as quickly as possible requires a layered testing strategy. We want to find issues as early as possible, so they are cheaper and faster to fix. Let’s discuss the build’s testing efforts and quality gates as we move a few layers up the microService (mS) testing pyramid. Read more…
-
Regular Expressions Basics
Regular expressions can help validate or parse String based inputs. Read more…
-
Adding JaCoCo Quality Gate to an existing code base
We can add a unit test code coverage quality gate to an existing Java project’s Maven build, but we have a few extra steps to ensure that the build does not break. Read more…
-
Skipping A Flaky or Broken Test! JUnit’s Disabled Annotation
JUnit tests can be disabled one-at-a-time or class-by-class if the need arises. That way, we don’t lose the existing code base, but we can skip them during test executions if they cause build failures. Comments and/or documentation in the annotation itself can aid us in the investigation to re-enable. Read more…
-
Project Reports! Generating a Simple Maven Site in the Build
By adding the site goal to our Maven build command, we can quickly start generating basic project reports. Read more…
-
Maven Dependency Scopes
Maven build dependencies usage can be controlled using the scope element, whether that dependency should be used in compilation, test, runtime or as a transitive dependency. Read more…
-
Global State of the Server! Java Environment Variables
Environment variables are good for storing global state information about a server that should be shared with all processes on that server, can be easily represented as simple String values, and are not sensitive. Read more…
-
Carriage Returns, Line Feeds, and New Lines, Oh My! Java System Properties
Using Java’s system properties, we can often avoid operating system (OS) specific logic in backend Java code. Read more…