Live data from Hacker News

How I write code using Cursor

arguingwithalgorithms.com

171–180 of 426 posts

Re: How I write code using Cursor

#171

Earlier quoted context omitted.

What domain/type of software do you and they work on? Cursor has been quite effective for me and many others say the same. As long as one prompts it properly with sufficient context, reviews the generated code, and asks it to revise as needed, the productivity boost is significant in my experience.

Well, the context is the problem. LLMs will really become useful if they 1.) understand the WHOLE codebase AND all it's context and THEN also understand the changes over time to it (local history and git history) and finally also use context from slack - and all of that updating basically in real time. That will be scary. Until then, it's basically just a better autocomplete for any competent developer.

What you describe would be needed for a fully autonomous system. But for a copilot sort of situation, the LLM doesn't need to understand and know of _everything_. When I implement a feature into a codebase, my mental model doesn't include everything that has ever been done to that codebase, but a somewhat narrow window, just wide enough to solve the issue at hand (unless it's some massive codebase wide refactor or component integration, but even then it's usually broken down into smaller chunks with clear interfaces and abstractions).

Re: How I write code using Cursor

#172

I think AI is still nowhere near where it needs to be to provide business value in software development. As an experiment, some time ago, I tried to build a TODO app entirely with AI prompts. I used a special serverless platform on the backend to store the data so that it would persist between page refreshes. I uploaded the platform's frontend components README file to the AI as part of the input. Anyway, what happen…

do you feel like it needs a major architectural change or breakthrough leap in abstraction before it can provide business value in software development, or would far larger context window sizes be enough for it to provide substantial value already?

For me it feels like it just starts to break after a certain length, but may not require a breakthrough new architecture to provide more value. Just larger context window sizes, so it can do the same thing it does on smaller pieces of code, on larger pieces of code, too.

Re: How I write code using Cursor

#173
I recently tried again github copilot, and I was much more convinced of its use. I'm using it mainly as a better autocompletion tool, and I sometimes use the chat for discovering/understanding librairies and errors, because google is now too polluted by SEO spam.

I'm not trying to generate programs with it, I find it still far too weak for it.

However, and while I believe the current models can't really reach it, there is nothing in my eyes that prevents to create an AI good enough for that

Re: How I write code using Cursor

#174
Is Cursor still sending everything you do to their own servers? Last time I looked into it, that’s what was happening which made it an absolute no-go for corporate use.

Using Cody currently with our company enterprise API key

Re: How I write code using Cursor

#175
It's amazing how little of my colleagues don't use Cursor simply because they haven't taken the 10 minutes to set it up.

It's amazing how many naysayers there are about Cursor. There are many here and they obviously don't use Cursor. I know this because they point out pitfalls that Cursor barely runs into, and their criticism is not about Cursor, but about AI code in general.

Some examples:

"I tried to create a TODO app entirely with AI prompts" - Cursor doesn't work like that. It lets you take the wheel at any moment because it's embedded in your IDE.

"AI is only good for reformatting or boilerplate" - I copy over my boilerplate. I use Cursor for brand new features.

"Sonnet is same as old-timey google" - lol Google never generated code for you in your IDE, instantly, in the proper place (usually).

"the constantly changing suggested completions seem really distracting" - You don't need to use the suggested completions. I barely do. I mostly use the chat.

"IDEs like cursor make you feel less competent" - This is perhaps the strongest argument, since my quarrel is simply philosophical. If you're executing better, you're being more competent. But yes some muscles atrophy.

"My problem with all AI code assistants is usually the context" - In Cursor you can pass in the context or let it index/search your codebase for the context.

You all need to open your minds. I understand change is hard, but this change is WAY better.

Cursor is a tool, and like any tool you need to know how to use it. Start with the chat. Start by learning when/what context you need to pass into chat. Learn when Cmd+K is better. Learn when to use Composer.

Re: How I write code using Cursor

#176
post #141

Earlier quoted context omitted.

The AI's are to a large degree trained on tutorial code, quick examples, howto's and so on from the net. Code that really should come with a disclamer note: "Dont use in production, only example code.". This leads to your code being littered with problematic edge-cases that you still have to learn how to fix. Or in worst case you don't even notice that there are edge cases because you just copy-pasted the code and it…

Which makes me wonder, if old companies with a history of highly skilled teams would train local models, how better would they be at helping solve new complex problems.

They kinda already are - source code for highly complex open source software is already in the training datasets. The problem is that tutorials are much more descriptive (why the code is doing something, how does this particular function work etc. -down to a level of a single line of code), which probably means it’s much easier to interpret for llm-s, therefore weighted higher in responses.

Re: How I write code using Cursor

#177
Using ChatGPT and AI assistants over the past year, here are my best use cases:

- Generating wrappers and simple CRUD APIs on top of database tables, provided only with a DDL of the tables.

- Optimizing SQL queries and schemas, especially for less familiar SQL dialects—extremely effective.

- Generating Swagger comments for API methods. Joyness

- Re-creating classes or components based on similar classes, especially with Next.js, where the component mechanics often make this necessary.

- Creating utility methods for data conversion or mapping between different formats or structures.

- Assisting with CSS and the intricacies of HTML for styling.

- GPT4 o1 is significantly better at handling more complex scenarios in creation and refactoring.

Current challenges based on my experience:

- LLM lacks critical thinking; they tend to accommodate the user’s input even if the question is flawed or lacks a valid answer.

- There’s a substantial lack of context in most cases. LLMs should integrate deeper with data sampling capabilities or, ideally, support real-time debugging context.

- Challenging to use in large projects due to limited awareness of project structure and dependencies.

Re: How I write code using Cursor

#178
Cursor has been an enabler for unfamiliar corners of development. Mind you, it's not a foolproof tool that writes correct code on the first try or anything close to that.

I've been in compilers, storage, and data backends for 15ish years, and had to do a little project that required recording audio clips in a browser and sending them over a websocket. Cursor helped me do it in about 5 minutes, while it would've taken at least 30 min of googling to find the relevant keywords like MediaStream and MediaRecorder, learn enough to whip something up, fail, then try to fix it until it worked.

Then I had to switch to streaming audio in near-realtime... here it wasn't as good: it tried sending segments of MediaRecorder audio which are not suitable for streaming (because of media file headers and stuff). But a bit of Googling, finding out about Web Audio APIs and Audio Worklet, and a bit of prompting, and it basically wrote something that almost worked. Sure it had some concurrency bugs like reading from the same buffer that it's overwriting in another thread. But that's why we're checking the generated code, right?

Re: How I write code using Cursor

#179

I've been using AI to solve isolated problems, mainly as a replacement of search engine specifically for programming. I'm still not convinced of these "write whole block of code for me" type of use case. Here's my arguments against the videos from the article. 1. Snake case to camelCase. Even without AI we can already complete these tasks easily. VSCode itself has command of "Transform to Camel Case" for selection. I…

I started like this. Then I came around and can’t imagine going back.

It’s kinda like having a really smart new grad, who works instantly, and has memorized all the docs. Yes I have to code review and guide it. That’s an easy trade off to make for typing 1000 tokens/s, never losing focus, and double checking every detail in realtime.

First: it really does save a ton of time for tedious tasks. My best example is test cases. I can write a method in 3 minutes, but Sonnet will write the 8 best test cases in 4 seconds, which would have taken me 10 mins of switching back and forth, looking at branches/errors, and mocking. I can code review and run these in 30s. Often it finds a bug. It’s definitely more patient than me in writing detailed tests.

Instant and pretty great code review: it can understand what you are trying to do, find issues, and fix them quickly. Just ask it to review and fix issues.

Writing new code: it’s actually pretty great at this. I needed a util class for config that had fallbacks to config files, env vars and defaults. And I wanted type checking to work on the accessors. Nothing hard, but it would have taken time to look at docs for yaml parsing, how to find the home directory, which env vars api returns null vs error on blank, typing, etc. All easy, but takes time. Instead I described it in about 20 seconds and it wrote it (with tests) in a few seconds.

It’s moved well past the stage “it can answer questions on stack overflow”. If it has been a while (a while=6 months in ML), try again with new sonnet 3.5.

Re: How I write code using Cursor

#180
post #141

Earlier quoted context omitted.

I agree. I replaced SO with cGPT and it’s the only good case I found. Finding an answer I build onto. But outsourcing my reflexion ? That’s a dangerous path. I tried on small projects to do that, building a project from scratch with cursor just to test it. Sometimes it’s right on spot but in many instances it misses completely some cases and edge cases. Impossible to trust blindly. And if I do so and not take proper…

The AI's are to a large degree trained on tutorial code, quick examples, howto's and so on from the net. Code that really should come with a disclamer note: "Dont use in production, only example code.". This leads to your code being littered with problematic edge-cases that you still have to learn how to fix. Or in worst case you don't even notice that there are edge cases because you just copy-pasted the code and it…

AI is trained on all open source code. I’m pretty sure that’s a much larger source of training data than web tutorials.
Post reply on HN