AI/LLM usage in the software development

 Here's my 2 cents on this.

AIs are a tool. They are like a can opener - sure, you can open the can with a knife, a screwdriver or even with your teeth if you're brave enough. But if you use a convinient tool, it can be faster and safer.

But don't get me wrong. You can cut your fingers with the can opener, too. Or it can leave some metal shards in your meal, if you're not careful enough. So like with everything else, you can't blindly trust it. You need to:

  1. know what you're doing
  2. never trust it blindly
  3. always assume it's wrong
  4. question its decisions
Here's how I use these tools:

First, I like writing code. I feel a joy after spending lots of (sleepless) hours, and finally getting the thing to work as I want it to. I don't want anything or anyone to take away this joy from me. So I try to not let it do it. Unless...

Unless I hit a wall and don't have a better idea on how to do something. Then I ask for help, the same way I'd ask another developer, mailing list or an IRC channel. But there's a difference - the AI's time is cheap. Humans' time is an expensive resource. So I don't feel guilty engaging an AI in my coding issues. Plus, I get a fast answer since it's a machine. I don't assume the answer to be correct. I extract some keyword from it, look at the links it referenced and try to make sense of the explanation last. I immediately check it with an objective source, like the rest of the code, a datasheet, a reverse-engineering writeup or with someone else's blog post.

AIs have a large context window. A REALLY large ones, more than the humans. I try to use this to my advantage. They are good at quickly analyzing a lot of content. So I sometimes use them as a search engine, and it mostly works fine. I don't trust their generated output, but look at the links they used as a source.

AIs are good at writing text that looks correct. They are very deceptive on this, as they have been learning from us. Also, the human brain likes to see things that are correct, and if the first few sentences earn its trust, then the confirmation bias kicks in. Reading AI generated text is an excersise of not triggering the confirmation bias to the reader.

I never give it access to my files. I don't trust it. I use the web-based chat interfaces, copy/paste the code I need help with and explain what I'm looking for. I instruct it to show me just the changes that need to be made, and to not rewrite the whole file, as I lose track of what's going on and I don't want to spend time re-reading the new version until I understand all unrelated changes.

They are good at code review, too. It's enough to just paste a source file in the chat box with no explanations - AIs like spotting mistakes (just like some people), and explaining how to fix them. This kind of "thinking outside of the box" is what helps me get unstuck at some point, and be able to fix a stupid issue myself.

Another use is creating a boilerplate for something, e.g. a device driver. I intentionally don't give the AI enough context to write the code accurately referencing the situation - I give it generic info (e.g. 32-bit ARM CPU that has access to 32MiB of SDRAM). The more info you give it, it gets sidetracked and instead of doing what it has been told, it tries to invent new things. Or makes the code look so correct that my confirmation bias start to kick in. Sometimes it's a good thing, but most of the time it picks up some random forum/reddit posts, and outputs 💩.

I disable the "memory" option, so every session is its own research. Sometimes I see it goes in the wrong direction and use the Branch chat option, so I can go back to a checkpoint up to which everything was still going in the direction I intended.

I don't pay for this. I use the free versions. When I hit the limit, I wait for it to reset. This way I can focus on doing the work myself most of the time, and resorting to external help only when I really need it. Otherwise I'd get addicted to it, and it's an expensive addiction.

I don't consider this type of usage as vibecoding, but feel free to prove me wrong in the commets.

Comments

Popular posts from this blog

Current projects

39c3