Will a couple of line markers in IDE make your microservice code mode readable?
Tags: ide, programming, microservices, java
Published: 2022-01-13 07:17:34

Writing microservices has never been easy and does not become easier with growing codebases. All the complexity strives from tons of interactions between the moving parts of your applications.

And then we had this year's holidays and I had enough free time to think about it. Many complex measures can be used to make the code of microservices more readable, numerous expressive APIs, modern languages, we already use all of these, but the situation does not get better.

Finally, I've found a stupid simple approach to simplify the reading of code — just show a couple of icons for the most dangerous places where services interact with file systems, networks, make database queries, etc. And wow! It finally makes the code easier to read for me; I clearly see those important interaction points where things may go wrong.

Please welcome, the result of my Christmas holidays: [Microservices Annotator](https://plugins.jetbrains.com/plugin/18361-microservices-annotator) plugin for IntelliJ IDEA. Because what else do developers from the IntelliJ IDEA team do on holidays — of course, they do plugins for IntelliJ IDEA!

In a nutshell, it just shows line markers for method calls in Java and Kotlin code where you call some well-known API methods, such as Spring Data or Spring Feign Client calls.

![Line markers in editor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o8xru6zdnoejia7k5r3i.png)

But that is just the tip of the iceberg. I know for sure, people use tons of custom APIs and not only OSS things like Spring Framework. That's why this plugin also enables you to mark any method in your codebase as some meaningful interaction point.

![Intention menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1shlsd9n4s6ox6og9hv.png)

There are many interaction types supported: 

![Supported types](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p69zqf56uospm2abr52d.png)

Then the plugin just remembers your method signature in the project settings and you will be able to share the `.idea/microserviceCalls.xml` file with your colleagues. Also, if you try to annotate some API from a known public library, such as code inside org.springframework package, this usage will be reported to our server so this setting can be distributed to all users of the plugin after moderation. You can check APIs that have been recently approved on [https://msa.strangeway.org/](https://msa.strangeway.org/).

And this is a community-driven project, so all the data of marked public APIs are available on [Github](https://github.com/strangeway-org/microservices-annotator-db). 

Finally, it is just that simple for you: Hit `Alt-Enter` on a method cal and Choose `Mark microservice interaction method`.

![Using intention in IDE](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34uu4e7j0ng9u0m74y7j.gif)

Please try and [give us some feedback](https://github.com/strangeway-org/microservices-annotator-db/issues)!

Would be great to hear not only positive feedback but also some criticism of this approach, maybe some better options exist. What do you think?

And answering the original question from the title: Yes, I believe this is a good thing for code reviews that will make your microservice code mode readable!