Skip links

Define your coding standards for Java

Coding standards for Java are essential if you work on a Java project in your company, and you’re not working alone. Indeed, you need to deal with every team’s challenge: discuss, align and decide what your coding standards should be in your context. Not only Java besides, but all conventions related to naming, architecture, security, performance, or a framework. For instance, you may want to define conventions for frameworks such as Spring or Hibernate.

Defining your best practices as a team is an excellent knowledge-sharing exercise, which will positively impact the quality of source code.

Create your coding standards for Java

In this post, we’ll see:

  • how to start creating your team’s repository of Java best practices
  • how to decide together your practices
  • how to make this documentation executable
  • how to find new Java best practices

The Packmind platform and its plugins suite cover all of these scenarios. You’ll need an account on Packmind Cloud of Self-Hosted to follow this tutorial.

With Packmind, the creation process of best practices is as follows:

  • Each developer can contribute to Packmind by identifying examples and counter-examples of best practices
  • Developers meet and review contributions and discuss them to validate them or not.

Catch coding standards in your IDE

An IDE is probably where, as a developer, you spend most of your time writing and reading source code. So it looks like a great place to catch best practices, right?

If you develop Java, you’re likely to use JetBrains or Eclipse; those two are among the list of supported IDEs by Promyze. Btw, we’ve dedicated an entire post on how to use IntelliJ to share your best coding practice, and the concepts are very similar for Eclipse. Once the Packmind plugin has been set up on IntelliJ, you can get your API Key in Packmind and add it to the plugin configuration.

We’re ready to create our first Java best practice!

Let’s see how to achieve that with a Spring boot example:

Coding Standard for Java

Please be aware that you can also use our code review plugins to create best practices. These Web browser extensions integrate with GitLab, GitHub, Azure DevOps & Bitbucket.

Validate your best practices with your team

Imagine every developer in your team can achieve that operation a few times per week or months as soon as they have a discussion topic related to a coding standard for Java, or any other topic. This asynchronous contribution process is the entry point for a synchronous workshop called Craft Workshops in Packmind. That’s a technical meeting where you use Packmind as a support to review contributions and decide which one to keep or not. It helps developers make technical decisions regarding best coding practices in their context.

Knowledge sharing session

This meeting happens typically monthly or twice, depending on your contribution rhythm. You can run a Workshop whenever you want with Packmind.

Get and share practices for Java with other teams

This retrieval and sharing can be achieved at two levels:

  1. Organization-level: During a Craft Workshop, Packmind has a module that displays all the new best coding practices. Imagine that every team in your organization builds a repository of practices, the same as you do. For a capitalization purpose, you have visibility and transparency on best practices you can reuse in your context. Consider this as an InnerSource model.
  2. Inter-organizations level: If you want to open your mind and explore new coding standards from developers outside your company, you can browse our public Hub of practices. Each organization using Packmind can decide to contribute with a list of practices, and each user can download and import them into their Packmind account.

Go further with coding standards sharing

If you start to build your repository of practices and coding standards, it’s a significant first step achieved! But you can go further with Packmind to make this knowledge executable:

  • Configure automatic suggestions to create patterns that will recognize when the practice is followed or not. These suggestions will come in your IDE or your Web browser during a code review.
  • Suggest a new onboarding experience for developers joining your team thanks to Discovery Workshops, which are interactive challenges that aim at localizing best practices in pieces of code. This is very easy to create as Packmind will reuse your existing documentation.

Also, all your practices will be available in a dedicated tab in IntelliJ or Eclipse, so you don’t have to switch contexts.

Ready to create your coding standards for Java with your team?