Coding in the Dark

· 662 words · 4 minute read

Last week my company asked me to evaluate using AI models from Google and GitHub for coding projects; so far, I’ve been liking Claude’s ability to assist me with small programming tasks better than either one, but that’s a topic for another post. Over the weekend, I set myself a slightly different challenge:

Can I use AI coding tools to be productive in a language I don’t know?

Call me an optimist (or would it be a pessimist? Eh, probably a masochist) but I’m not convinced that AI will be able to replace programmers anytime soon; however, I do think it’s possible that we’ll be able to use AI to replace the need for detailed knowledge of syntax, and that’s what I’m trying to explore here.

I’ve had Rust on my mind for a while lately, but I haven’t had the chance to actually learn much of anything about it, so it feels like the perfect candidate to try this out on. And for a task, I’m going to download and process data from the SEC’s EDGAR database.

Setup 🔗

First, we’ll ask Claude to help us install Rust and set up a new project:

I’m using a m4 mac, and I’d like to install a recent version of rust; can you do that for me?

That worked like a charm, and at the end gave me a script to source if I wanted to start using rust in my current shell.

Next, I’ll describe my project and ask for a requirements document:

I’d like to build a rust application that, given an ETF or mutual fund symbol, can look up the symbol on the sec’s edgar database, and download a list of recent filings for that fund. I’d like to include a modular architecture for processing various types of filings that we encounter, and I’d like you to suggest a recommended data storage format. Please produce a requirements document for this project that we can refine and refer to throughout the development process. Consider best practices for rust development and include those as appropriate in the document. Format it as markup.

That gave me a decent readme doc, and some initial thoughts on the project structure. I asked for pros and cons of some of the options that were laid out (eg, “sqlx” vs “rustqlite” for a database library), selected test driven development as our programming paradigm from several that were suggested, and asked for advice on how to begin our task.

First Steps 🔗

Alright, let’s plan on test driven development; looking at the goals, the architecture, and the milestones, where do we begin?

Cursor set up a rust project for me, and created some “tests”, but seemed very invested in making sure the tests were passing well before any real functionality was added. This was a recurring theme, despite the model telling me that it was adept at TDD (as well as correctly explaining the general concept to me).

One of the first tests I asked for was to verify that the user overrode the default email address used when interacting with the SEC’s EDGAR database; in order to get a correctly functioning test (ie, one that didn’t always pass no matter what I did), I had to give the model a truth table with some examples of inputs that should pass or fail, and even then went back and forth a couple of times before getting the test behavior to indicate desired functionality.

After about two hours of back and forth over what I wanted, what the model thought the program was doing, and what it actually did, I had a bit of functionality that I was happy with: I was able to look up a symbol (for a company, not neccesarily for a fund) and get a formatted list of recent filings. That was enough for my first foray, and I decided to call it a night. I’ll pick up where I left off in another post soon.