Converting Code with LLM Assistance: A Practical Approach
Technology LLMCode ConversionUnit TestingNode.jsElixir

Converting Code with LLM Assistance: A Practical Approach

8 Technology Article LLM, Code Conversion, Unit Testing, Node.js, Elixir Apr 3, 2024 1712188800000

Here’s the flow of prompts I used today to convert a code file from one language to another and provide test coverage.

The specific use case:

Converting a code file, part of a larger codebase, in a language I am unfamiliar with (Elixir) and that has no tests into a code file and unit tests in a language I am familiar with (Node).

Outcome: 50 lines of node.js codes covered by 10 tests (90+% coverage) with documented expectations. 30 min.

Caveat: Whether the file performs all the needed behavior will become more apparent as I convert other dependencies across, i.e., I still have to make sure it works!

Originally published on LinkedIn on Apr 3, 2024. Enhanced for this site with expanded insights and additional resources.