Java Share Best Coding Practice

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:

  • already exist in your team, and you consider everyone to know them
  • have not been discussed yet, but you believe they should be anchored in the project
  • target any topic of interest for you: Java, a framework like Spring, Architecture, Performance,…

Let’s find out how to define and share some best practices with your team in IntelliJ.

#1 Catch an example of best practice 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.

Intellij extension knowledge sharing

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:

Java coding standard

#2 Discuss best practices with other developers

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.

#3 Tune Promyze’s automatic algorithm

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:

Java best practice detection

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.

Leave a Comment

Promyze, the collaborative platform dedicated to improve developers’ skills through best practices sharing and definition

Features
©2022 Promyze – Legal notice