Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My main responsibility is developing and maintaining a microservice written in Java.

However, one thing I've found invaluable over the years is developing operational tools to support my deployed code, in a language with a built in REPL.

At different times, I have used Clojure and Jython for this (high level way to call my Java libraries, or to invoke APIs over the network), and most recently Ruby (has been easy to deploy and run scripts or ad hoc commands over irb for operational tasks, in the same environments where my service runs).

This allows me to build up code over time that I can use to

* Quickly make calls to my service to triage or debug production issues.

* Write scripts to quickly validate a new install.

* Script operational tasks at a high level that doesn't make sense to build into the service itself (can allow the service to be more stateless, for example).

* Bypass layers and make calls to the underlying database (can be more powerful than the command line tools dedicated to a specific database).

* Can be more powerful and composable than curl or Postman for making web calls.

* Have used it to analyze the state of messages in a Kafka topic (with a custom gem).

So I highly recommend building a tool set around a language with a good REPL for anyone responsible for a service with a REST API, or any other kind of API available over a network.



Have you tried Groovy? Sounds kind of ideal if your main work is with Java. I have a BeakerX (JupyterLab+Groovy) notebook open pretty much continuously next to my IDE while I code so that I can validate all my assumptions as I code. A nice workflow is that you start with a snippet of experimental code, which you tidy up in the REPL, then it splits into the actual function and test code, one part going to the unit test and the other to the real code.


Yes, this is extremely useful, thank you for sharing.

I also often use the REPL as a "tool" rather than just a editor feature.

For example this week I'm working on a data integration. This is a very specific one-time task, so there is currently no need to write accessible production code. I can just use the REPL to do the "ETL" and leave the code as-is.

There is merit in keeping it and find functionality to extract, abstractions/compositions in the future, but the point is that the integrated (Clojure) REPL itself is already sufficient, powerful and very ergonomic tool.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: