Vibe Coding 101
I downloaded Cursor two weeks ago, and the first thing I used it was for a non-work project. Some notes from that exercise
Two weeks ago, I reluctantly sat down with my cofounder Manu about some AWS infrastructure issues that I’d been infinitely putting off. In the middle of the conversation, he happened to show me his screen where he had Cursor running, and using it to write what I had thought was a rather laborious bit of code (some refactoring).
This was finally my cue to download Cursor, the new hot '“vibe coding” tool. As it happened, the first thing I used it for was some non-work stuff.
I told you I did a quiz last weekend. It was Only Connect style. For that, I needed to take questions and answers off a Google Sheet, and format it into a nice powerpoint. My last year’s code (painstakingly handcrafted in R) couldn’t be reused since that resulted in a PDF output, and this time we had an audio question, and the easiest way to embed those was in a powerpoint.
So, given that I didn’t know how to produce powerpoint and had to write the code from scratch, and that I had downloaded Cursor the day before, this seemed like an ideal project for some “vibe coding”. Here are some pertinent observations from the exercise:
The code has been written and executed and its purpose has been served. I may not use it for another year. Till date I haven’t seen the code from end to end. I don’t know what the function structure is like. I don’t know how it works. All I know is it’s in Python. And I’ve been a coder for 27 years.
I’ve looked at the code 1-2 times and the thing that struck me was that it is insanely verbose. I know Python is verbose compared to R, but I like to think it could have been written more efficiently and readably. However, since it was “use and throw code”, I didn’t bother with that.
I started coding in a chat window in Cursor. Where I kept giving instructions (in English) on what I wanted the program to do. Within ten minutes I had a version that was executing (though I had to download the GSheet to Excel for it to work - Google Suite integration with Python seems rather painful, and not as easy as the googlesheets4 package I’m used to in R).
Within 30 minutes of starting to “code”, the program had run several times, and each time I had modified it using natural language only. This was proper black box programming, where I was just looking at the input and output and had no clue what was in the middle.
And then Cursor crashed! I have no clue what happened there, and that left me utterly lost. This was the first time I had to actually open the file (I didn’t even know what it was called). and then slowly figured out how to chat with Cursor to get it to modify it.
There was a bug in the code and I found it impossible to fix. There was no way for me to precisely communicate to Cursor what I wanted to exactly do - this is one well documented downside of vibe coding - natural language is fundamentally imprecise compared to a programming language. I think I “resolved” it by asking Cursor to undo some changes wholesale, and then starting over again.
There was the “50 first dates” problem - I would’ve given some context and then found that the context was lost in subsequent chats. I needed to say the same thing again and again and again. It got a bit tiring.
In terms of the number of characters typed, I’m sure all chats put together I would’ve typed more characters in natural language than the program that got produced. So the effort in terms of pure typing wasn’t really less. The saved effort was in that I could use imprecise natural language text and get a program that did what I wanted it to do.
One reason I normally don’t use Python is that I just can’t wrap my head around things like virtual environments. Cursor handled it well for me and made sure I didn’t have to worry about it at all (and after the quiz was done, this was my first use case for Cursor at work - to manage things like virtual environments and github).
I also asked it to set up github and push my code there but it encountered some issues and I abandoned the effort.
vibe coding is a one way street. Once a program has been vibe coded, it is so verbose and unreadable that it is impossible for a human to edit it or change it. The only way to deal with this further is to further vibe code it. You need to keep this in mind while you make the decision on whether to vibe code or not.
Basically, treat vibe coding as a black box and you will be good. The code will not look like what you might write. It will not look like what you think is good code. It will basically do the job, though. If you want control over your code, write the first version by yourself and then get Cursor to make small changes for you (making sure you edit them into your style while accepting them).
And I can’t imagine vibe coding if I didn’t know how to code at all. The moment it would make a mistake I would be completely lost and not know what to do with it. So beware of vibe coding, and use it only if you have some idea on how to retrieve things if they go south!
For you to use a copilot, you need to fundamentally have the skills to be a pilot in the first place
After the basic structure of the powerpoint had been produced with the final list of questions, I got bored of vibe coding and did the last bit manually - like adding the audios, changing the theme of the presentation, and things like that.
Helpful description!
1. Does it not have multimodal input so you can provide spoken instruction rather than written?
2. I’m told it has the capability to integrate with all projects on your machine, and use that as context. Would it mimic your coding style in that case?