IntelliJ IDEA stands as one of the most popular IDEs when developing Java code. It’s pretty tedious to have accurate numbers, but we can reasonably assume that it belongs to the two top leaders with Eclipse around the world. Btw, Keep in mind that this post content also works for Eclipse. Today we cover how IntelliJ can be used to share Java best practices with your team.
Whether you code alone or in pair/mob-programming sessions, coding often implies reworking source code to perform refactoring or making it more compliant with some best practices. These practices may:
Let’s find out how to define and share some best practices with your team in IntelliJ.
First, you’ll have to install the Promyze plugin from the JetBrains Marketplace and create an account on Promyze to get your API key. Set this key into your plugin setting in your IDE. You should be ready in less than 2 minutes.
Now assume you’re coding and face an example of a best practice that has not been followed. Here is an example with a field injection in Spring Boot, since in our context we favor constructor injection instead. But consider you’ll define any practice relevant to your context.
Also, note that you can also identify positive examples if you think the practice has been followed. It’s relevant to consider both cases to enrich the documentation, it’ll be very appreciated in scenarios such as onboarding new developers.
You can also provide a correction to illustrate how, according to you, the best practice should be followed:
These asynchronous contributions happen several times a week and are pushed into the Promyze Web application for a later review. This review is called a Craft Workshop and usually occurs once every iteration in a project. This technical retrospective is dedicated to continuous improvement regarding the coding practices within a team.
Promyze is used as a support to show each contribution one by one, inviting each author to comment to the team on their point of view:
In case this is a counter-example of a best practice, you can display the correction so that anyone figures out how you suggest overcoming the issue:
After internal discussions, you’ll decide whether the practice will be validated or not, and that’s how Promyze helps you make technical decisions through collective consensus.
In case your practice has been validated, you can indicate to Promyze a regular expression pattern that will detect whether this is followed or not in the source code. We illustrate with this expression that catches the @Autowired annotation on private fields:
Once you’ve achieved that, all developers in your team will be notified by their Promyze plugin in IntelliJ in case they use this annotation on a private field:
That was a quick overview of how you can define best practices in your IntelliJ, thanks to the Promyze plugin. Think as an opportunity to remain focused on your development flow, without switching to another tool to write down some documentation about best practices.
🚀 Want to start sharing best practices with your team? Get started for free on promyze.com.
Promyze, the collaborative platform dedicated to improve developers’ skills through best practices sharing and definition.
Crafted from Bordeaux, France.