Thursday, 16 October 2025

How I (vibe) code

 

1. Start with a clean codebase

Monkey see, monkey do.

I was initially dismissive of the "no broken windows" theory I came across in The Pragmatic Programmer, thinking it impractical to rigorously follow in a large codebase–but now I understand, and lean more towards the "How you do anything is how you do everything" philosophy.

In my experience, LLMs seem to be influenced much more by the surrounding code than anything you say in the prompt. They can output (at best) code at par on what they already see, and if you don't keep an eye on LLM contributions, overall code quality will only get worse over time.

If you find yourself prompting it to "write clean code, be DRY and reusable" or any other best practices–maybe you need to take a look at the rest of your codebase first. This applies to code layout, structure, documentation, type hints, and even tests. Going against the grain is inefficient–unless you're using Cursor, which manages to always output shite despite what it sees in the rest of the code (see below).

2. Fail fast

If the first attempt by the LLM is not ~80% there, I tend to discard it and start over.
Depending on how bad it did and how complicated the change is, it might be quicker to adjust your prompt or break down the problem than try and fix it iteratively.

3. Plan, then execute

For more complex changes or those that span a bigger surface area, have the LLM first plan out its approach in a markdown file–also useful for data-modeling activities.

I review and make changes (myself or using the LLM itself), then start a fresh session (with no memory of planning) asking it read the plan and start work.

4. Models gets worse, tools get better

Once upon a time, I swore by Aider, daily driving Gemini 2.5 pro before it went to shit in the 05-06 update, switched to Sonnet before making the jump to Claude Code (CC) altogether.

Tried OpenAI Codex again recently and the profanity in my chats is significantly lower than with CC. I have almost completely switched over to it, only ever using CC for when I need to have it fetch documentation from the web or for its IDE integration (in PyCharm).

It's amazing how bad CC is at not following simple instructions like "no local imports" and "no useless comments" unless you explicitly tell it to go read CLAUDE.md at the end of its run.

I've only ever used Cursor for code that I didn't care to read or run the next day, since combined with Sonnet it is especially bad at not following simple instructions (.e.g "no useless comments"). It is extremely infuriating to see code like this, despite having explicit instructions to prevent it from happening.

# Create account lookup dictionary and list of account IDs
account_lookup = {account.id: account for account in accounts}
account_ids = list(account_lookup.keys())

# Calculate date range for past 1 year ending with last day of previous month
today = timezone.now().date()

# Get the last day of the previous month
if today.month == 1:
end_date = date(today.year - 1, 12, 31)
else:
# Get last day of previous month
end_date = date(today.year, today.month, 1) - timedelta(days=1)

# Start date is one year before the end date (same day of month)
start_date = date(end_date.year - 1, end_date.month, 1)

I do not think the tool is meant for serious use, or if you have to directly deal with the code it generates.

Saturday, 22 February 2025

Hokkaido in June - Part 1

Japan is one of those few places in the world where people care, just maybe not about you specifically. They are friendly, but not really your friends.

As an outsider, you can never truly integrate, but it makes a great place to travel, especially solo. Having already visited famous places like Tokyo, Kyoto, and Osaka, I decided to check out Hokkaido to mark the end of my 30th year on the planet. It would also be my first solo endeavour.

ANA (All Nippon Airways) has frequent deals from major cities in India and is a great airline to travel with (although the leg space on the domestic flights is a bit lacking). The person at the BOM check-in counter (incorrectly) told me that I wouldn't need to collect and re-check-in my luggage at Narita, but I'm glad I double-checked online.

I had a long layover at Narita, during which I picked up a WiFi box[1] and spent most of my time in a cafe, but there are dozens of restaurants with more traditional food you can try. A nice viewport too.


The flight landed late in Sapporo and I took the airport bus to Odori park[2]. I was not prepared for how cold it was once I stepped outside the terminal.

My hotel was right next to Sapporo TV tower, which does look bigger in pictures than in real life.


As soon as I left the hotel I was greeted by an anime convention spanning the entire length of Odori Park. I really was in Japan.

I have a simple routine for vacations. After waking up—whenever that may be—the first objective is to get coffee (preferably trying out a new place each time). Then loiter until you get tired (and hungry) enough for lunch, followed by more sightseeing (to get hungry for dinner). The special Japanese addition is late-night Konbini visits for dessert (preferably trying out something new each time).

After walking around Sapporo University, I went to the JR tower observatory, one of the highest viewpoints in the city to catch the sunset, and stuck around for quite a while until dinner time. 



I took part in a bus tour on the second day, and while it was a bit rushed, there's no way I could cover as much with just public transport in a single day. The tour covered volcanic formations (some as recent as 1945!) and surrounding lakes.

The weather was less than ideal— overcast and eventually rainy, reminiscent of the previous times I've had such day trips in Japan (Hakone and Kawaguchiko, where I also ended up cancelling plans to hike Mt. Fuji due to rain)



At the end of the day, I had one of the best cold brews ever at Marumi Coffee, where I ended up going a few more times during the rest of the trip. The rest of the evening was spent around the flashy Susukino area.

Given there was more rain scheduled for the next day, I decided to spend it in the city. Trying out more cafes and lining up in the rain for an hour and a half at a famous ramen shop. The ramen was good, but too filling—should have skipped the rice and gotten a half portion!

On the way back, I came across a cafe run by Sho Tanaka, a barista champion of latte art, who was kind enough to entertain my attempts to converse in broken Japanese. I returned to Marumi again for more coffee. I'm sure I did something worthwhile between my coffee shop visits, but I can't remember.



More coffee to start the next day, before boarding a bus to Yoichi, home of Nikka. I had signed up for their free tour a few weeks before the trip, and it was another interesting experience marred by rainy weather. The tour was in Japanese, and although they have companion apps with english recordings, the network coverage there was not good enough to get those downloaded in time. Google's live translate helped me out a bit. I am no whisky connoisseur, but the founder's story is truly fascinating. Masataka Taketsuru learned the craft in Scotland and came back to Japan to make his mark. There's also a whole museum dedicated to his journey and the evolution of Nikka.
 

It was late evening by the time I got back to Sapporo, and I discovered a place of indulgence right next to the hotel. A black coffee was the only sugarless item in my order.



Next morning, I strategically picked a coffee shop far enough that I would also be hungry enough to eat by the time I got there. Then, was my first visit to an outlet of Japan's largest discount store, which I somehow missed completely on my last trip. After some shopping, I went to try out a Sapporo specialty, Soup Curry at Suage+. They offered varying levels of spicy-ness and I think I could have gone spicier.




After picking up FF7 Rebirth at a used game store, was a visit to the garden surrounding the Former Hokkaido Government Office. It was a serene park right in the middle of the city, serene until I was attacked and chased away by a crow. He made a few low overhead passes before I felt claws on the back of my head, — and then I ran. I felt better after having coffee from a siphon brewer (for the first time) at ONIYANMA (a recommendation from the barista champion). Better, but not good enough, and that called for more coffee and donuts.



More coffee and carbs the next day at Mermaid, which was very nice and is deserving of its outrageously high rating. The staff do come out to say goodbye to everyone, and one of them even stuck around waving until I was almost out of sight. Next up was Moerenuma Park, a huge sprawl of green, where I loitered on a bicycle for the entirety of the rental duration (returning it with just 5 minutes to spare). There was a glass house with a museum, and a small hill with a view of the city. It also served as a fitness check (if you can make it to the top without stopping to catch your breath). There was more coffee (not pictured)



The rest of the evening was spent at Kalahana and Bearfoot, where I chatted with a senior Dutch (after he shocked a local by telling him how many paid leaves he gets in a year). He had been cycling (!) throughout Japan for the last few months, camping in most places. Another was a local techie, from whom I learned about otaku culture and the underground idol scene; and gained some insight into the despair among the youth. This also (more than) fulfilled my socialising quota for the entirety of the trip.


Yosakoi Soran Festival was one of the first things I encountered the next day. An epic dance-off spread throughout the city, dancers in full attire, with roads blocked off specially for them—serious stuff. A long train ride later, I was in Otaru, a port city. I checked out the Music Box Museum and ate at LeTAO (which had a bit of wait time).





The main streets of Otaru were a bit too commercialised for my liking, so I went a bit further out, past the canal, and took a bus up to Hiyoriyama Lighthouse. I got off a stop (or two) earlier to take a walk near the fishing harbour—where I met a few chunky bois, a diamond princess, and a ship at sea. It was peaceful out here, sitting by the sea. The lighthouse was just up the road, with very few people around.



Further up the road was another observation area, and at this point I started to feel the lack of personal transport, not just because of the walk, but having to rush in order to not miss the last bus back to the city. Most people out here had cars—so they could wait a bit longer as the sun went down. I walked back down the hill with a few minutes to spare at the bus stop.



Next day was coffee, shopping for items and a duffel bag to fit all those items, lunch at a cozy restaurant, and catching a train to the next destination. I had collected a 10-day rail pass just a day or two before this journey, so that it would be also valid when I had to come back to Sapporo (for the return flight).



This was the last day in Sapporo[3], before moving on to the second part of the trip, a place in the countryside, half an hour from Asahikawa.

Hokkaido has great public transport (like most of Japan), but if you are in a group, or if you can rent a car, it opens up a lot more destinations. The rail pass let me go almost anywhere, but nothing beats a car for the last mile stuff, plus you are not bound to a timetable.
Since I didn't have a car and train frequency drops considerably as you go further from the city, I could not just wake up whenever I wanted to in the second part of the trip.


It took me almost 8 months (of procrastination) to write this out, so the second part should be out anywhere before the end of the year. Stay tuned!



1. I also returned it at the same terminal on my way back, but you can pickup and drop it across several airports). Best thing about it is that it doesn't kill your phone battery as quick if you were using mobile data.

2. Google maps may not show destination names in English for this ride, so it took me a while to figure which exact bus to take.

3. For now, we will be back to Sapporo in Part 2