DEV Community

Cover image for Will a couple of line markers in IDE make your microservice code mode readable?
Yuriy Artamonov
Yuriy Artamonov

Posted on

Will a couple of line markers in IDE make your microservice code mode readable?

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 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

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

There are many interaction types supported:

Supported types

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/.

And this is a community-driven project, so all the data of marked public APIs are available on Github.

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

Please try and give us some feedback!

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!

Top comments (2)

Collapse
 
nfrankel profile image
Nicolas Fränkel

I saw this plugin mentioned in a couple of places. I'm between intrigued and puzzled.

Yes, I believe this is a good thing for code reviews that will make your microservice code mode readable!

Either I misread your post, or you didn't bring a single argument to prove your point. Please explain the problem you're trying to solve.

Collapse
 
jreznot profile image
Yuriy Artamonov

At JetBrains we do code reviews using either Space or Upsource plugin right in IntelliJ IDEA and having such a markup for APIs really help (at least me) to see how different moving parts interact.