Many Pies

Many Pies

Thursday, October 30, 2025

Vibe coding with Gemini - and a childhood dream fulfilled

A red triangle with several coloured blocks inside it

As a followup to my post on vibe coding in Salesforce, here's what happened with Gemini.

First let me take you back to my ZX80/81/Spectrum programming days. I created a little game where you would drop blocks into a 2d pyramid shape. If a block fell outside that shape then it was Game Over. The graphics on those machines were addressable in 8 pixel squares so it wasn't very realistic. I thought it would be a lot better if the blocks had proper physics. I didn't have the words for it at the time, but what I needed to do was create a physics engine. That seemed like a full time job, and programming was just a hobby in those days.

I gave Gemini this prompt to create the game I'd imagined in my childhood:

Create a browser game where there's a block at the top which regularly moves from left to right. When you press the space bar that block should drop another blog down to the ground below. The blocks should have proper physics and collision and tumble over each other.

It understood what I meant pretty well. I didn't give it a Game Over condition, but it invented one of its own - if the blocks filled up to the top of the screen then that was it. As it was, that was pretty much a good starting point. I spent a few iterations trying to get it to not trigger game over as soon as a block fell (because it was at the top of the screen).

At this point my impression switched from "this is amazing - look how complete a thing it can generate with a few words" to "why doesn't it understand what I'm saying?". 

It did work eventually though, so I moved onto Phase 2 - the pyramid shape. Again it took a few iterations before I could get the shape I wanted - at first it did it upside down. Once I got the shape I wanted I added a game over/high score screen at the end and that was my minimum viable product. 

It's got a cheery manner, as AIs seem to these days. 

Make it so that 1 in every 5 blocks is really bouncy Gemini: That sounds like a fun way to increase the challenge! Introducing a bouncy block every fifth drop will definitely keep you on your toes.  I've updated the game logic so that 1 in every 5 blocks has a high restitution (bounciness) and is colored cyan so you can easily identify it.

Here it is. Can you beat my high score of 26? Be warned - it's got a really annoying soundtrack and collision noises, but you can mute it.

Update: There's a sparkly option on the screen when creating these things, and I clicked on it. Straight away it decided to add an AI feature; specifically, a little autogenerated summary of your game on the game over screen. It would have been nice to have been asked, but I let it do its thing.



Monday, October 20, 2025

My first impressions of Salesforce Vibe Coding

The face of a bear with "Let's vibe" underneath

 I spotted a new icon on the Salesforce setup menu, so I decided to give it a go. It's a full web-based VS code IDE.


As it happened I had a specific Lightning Web Component that needed to be created, so I prompted with that. I have to say, it's very impressive. It doesn't just generate a load of code, it knows about how the whole deployment process works. It has a plan mode, so you can clarify things before you put it into "act" mode. It asked me clarification questions

Before finalising the plan I need a few specifics to ensure the data model and security model are correct

It asked me nine questions in all, so I answered one, expecting it to then say "what about the second question" but it went through the whole cycle again. So I gave it several answers in one go.

The process of identifying the target org it should deploy to wasn't obvious or straightforward, even though it was thinking out loud about how to get that information. I didn't know how to tell it though.

Get username. Intelligently determines the username  or alias for Salesforce operations

In the end I told it "set username to name@company.com" and then it put that into configuration as expected. When I later tried to get it to use a sandbox it default to login.salesforce.com

I got an error "provider context length exceeded". When I asked for help with solving it, I just got the same error. I gave up for the day, came back the next day, and it was OK. I guess it just needed a nice cup of tea and a sit down.

It asks permission nicely before it does things or creates files, so you can follow along, rather than just waiting until it's finished and you have to dig around to find out what it's actually done.

Bear in mind, I didn't look at any of the available help information, I was just ploughing on. 

I got as far as deploying the component, which then failed because of lack of org wide test coverage. It then offered me four different options. I went with running only tests related to the change. The deployment then failed because of 0% coverage on the test class. It suggested that it could write some code to cover that. I wouldn't have minded if it did that without asking, but I went ahead and asked nicely anyway. It churned away, trying deployments, adding code to set default values. All the while it was thinking out loud:

I see the issue now. The problem is that we're trying to create a User with a ContactId, but the org requires that users who are associated with contacts must be portal users. Let me modify the test class to handle this by creating a regular user without associating it to a contact, or by using a different approach for the test setup.

 In the end, after several iterations, it managed to deploy the component:

The tests now pass successfully with 100% pass rate. The test class properly deploys to the target org and executes without errors, providing confidence that the GauAllocationsExplorerController functionality works as expected in the target environment.  **


Conclusions

How you view this depends on what your knowledge is.

If you don't really know about Apex programming then there's probably too much that you need to know to get anywhere (e.g. test coverage, local vs org tests).

If, like me, you've dabbled a bit, you know about deployment and Salesforce dx, then it will get you a long way towards getting something that basically works. You can then actually read the help information and increase your skills.

If you do this sort of thing all the time I imagine that it will take a lot of the drudge work of setting up new projects and creating outline code which does most of what you want. You can then go in and use your l33t skillz to finish the code off.