Expanding your language toolbox is a topic promoted all over the coder channels online and I believe it’s common knowledge that it’s beneficial but, in my experience, many don’t bother. I encounter resistance is frequently in the JVM world so much so that I should say the Java world because I have personally encountered steadfast resistance to new languages even such a small step of moving to Groovy, a JVM language.

No seriously can you imagine joining a team and starting the development of a new micro-service and you write it in Groovy. It goes live and works perfectly, I let the team a few months later to start a different project and a couple months later I hear the service was rewritten in Java simply because the other developers didn’t want to figure out the differences from Groovy. I heard the new service had serious issue in production… probably because unapproved time was devoted to rewriting… guess that’s a lesson for ya.. [cough cough]

Why being a Polyglot dev is important.

OK but I code in X language for work so what good does knowing another language do me. Well aside from the more esoteric explanations of how it make you a well rounded developer with different views of how to accomplish things… how about a little example of why having extra tools in your tool chest is important.

I am writing a service that will call another service. nothing to see here but wait, the other service doesn’t exist yet. Well I have to finish my code now! So since I already helped define our messaging, I know what I will be receiving when I make the call, I just need a server to test out integration as mocking can only do so much for me.

The Solution

I solved this problem far faster then it took me to write this blog post. Being that I am learning Node these days I have npm installed and so I set up a sample server in less then 5 minutes and that included me looking at a tutorial on how to use express.

It went like this:

  • mkdir apitest

  • npx express-generator

  • Edit the index.js to add a new route that returns a nice test data set.

  • DEBUG=* npm start

  • Use Postman to test the End Point

  • Go back to Groovy and continue my development.

That’s it, I’m back to work on the project. Next time it will probably take me 30 seconds to set up another end point. What’s really helpful is Node allowed me to do this ad-hock. And faster then if I were to try to do this in Java or even groovy as all the things said about the difficulty in getting started in Java apply to every new project.

Sure there are probably 10 different ways to do this just as quickly in Rust, Go, Python but I know know those very well yet. It doesn’t matter, if another language helps em get work done quicker.. go ahead and report me to the code purity police. I’ll be one with my work and back to Hacking on my on projects. (Yes, in a language other than my primary language.)