Switching from IDE and Vim to Cursor

Previously, I used JetBrains series IDEs (PyCharm, CLion) for larger projects and vim for smaller ones. The most annoying part of developing larger projects is writing boilerplate code. Most of the time is not spent thinking about the design of functionalities or algorithms but on boilerplate code.

Cursor is an AI-assisted programming IDE similar to GitHub co-pilot, with an interface quite similar to VS Code. When Cursor was first open-sourced in 2023, I started using it, but it wasn’t particularly useful due to the limitations of the foundational model at that time. After GPT-4o was released in May this year, I started using Cursor again and found it more convenient than asking code questions in ChatGPT. Firstly, there is no need to switch windows back and forth, and secondly, Cursor has context, making queries more efficient.

In the past three months, with the more powerful coding capabilities of Claude 3.5 Sonnet, I have completely switched from PyCharm and Vim to Cursor because Cursor’s development efficiency is much higher than PyCharm with AI completion features, doubling the overall development efficiency. My GitHub has also easily stayed all green in the past three months.

GitHub has stayed all green in the past three monthsGitHub has stayed all green in the past three months

Cursor can help quickly get started with new languages and frameworks

Cursor is not only useful for improving development efficiency but also for quickly familiarizing ourselves with new programming languages, frameworks, and tech stacks. For example, writing backends in Go, frontends in React, and smart contracts in Solidity were all new to me, but with AI-assisted programming, these are not difficult. If I had such powerful AI when I was in school, I could have learned many more programming skills.

Cursor is most suitable for creating demos. Code that can be written with plain Vim can basically be completed independently by Cursor, with minimal bugs once written. Many students are already using GitHub co-pilot or Cursor to write course assignments, completing projects in one night that would take others a week.

A more challenging scenario is modifying existing large projects (commonly known as legacy code). Writing such code is difficult even with plain Vim and requires the help of an IDE due to the need for constant reference to other modules in the code repository. Cursor’s generative AI only queries code snippets based on prompts, making it difficult to write a lot of code at once for large projects, often requiring the programmer to take over.

Demonstration: Developing an AI Course Selection Assistant in 2 Hours

Since most professional programmers work on large projects, to demonstrate Cursor’s capabilities, I chose the USTC Course Review Community and developed an AI course selection assistant in a 2-hour live stream. This project has over 10,000 lines of code, mostly written 9 years ago, using the Flask + Jinja2 + SQLAlchemy + Bootstrap + jQuery tech stack. The frontend does not use frameworks like React but is written in plain HTML + CSS + JS, making it relatively difficult to implement a highly interactive AI application.

A screenshot of the demo completed with 800 lines of code in 2 hours using Cursor:

Cursor 2-hour AI course selection assistant demoCursor 2-hour AI course selection assistant demo

The AI course selection assistant I demonstrated is a RAG (Retrieval Augmented Generation) application designed to answer users’ questions about courses using reviews from the course review community. The principle is to first identify the user’s intent, generate a corresponding search index query, then input the retrieved course summaries and reviews as context into the large model, which then generates answers for the user.

The backend mainly involves RAG, dialogue management, and message history management. The frontend is a ChatGPT-like interface, including a conversation list, message list, message input box, and AI streaming output controls. The AI assistant’s output includes user intent, search results, AI answers, and time statistics.

According to traditional software development processes, the above features would require at least one frontend and one backend full-time developer for a week. But with Cursor, one programmer can complete a basic usable demo in two hours. Although there are still many bugs in the frontend, and the frontend design and backend intent recognition and RAG have much room for improvement, it would take me at least a whole day to develop this demo without AI assistance, even at full coding speed.

From the full video below, you can see that when using Cursor, I am almost not programming but communicating requirements with the AI. Only when the AI can’t handle it do I write code myself; otherwise, I just need to identify what needs to be done and let the AI modify the code.

There is a lot of time spent typing prompts and locating bugs in the video, which you can skip while watching. The first 40 minutes are spent communicating requirements and completing the first version of the code, and the remaining 80 minutes are spent fixing bugs. There are not many backend bugs; most bugs are related to the interface with the existing code in the repository, and the initial large model prompt was not very professional. There are more frontend bugs (the frontend code is twice the amount of the backend), and a lot of time was wasted debugging JSON format handling.

(Video length: 2 hours, 709 MB)

Overall Development Process with Cursor

To summarize, the overall development process with Cursor is:

  1. Think clearly about what to do and design the system architecture.
  2. Let Cursor write each module, generally starting with data structures (database table structures), then the backend, and finally the frontend. It is best to give each module a clean file when starting to write, with similar functional files around for reference, and give each module a clear prompt, just like communicating requirements with a person. Just like in real-world collaborative development, initial requirement thinking and communication are not a waste of time. Setting clear requirements at the beginning can save a lot of rework time later. The AI can write a version in about a minute, which you can review to understand the code structure and fix some obvious issues.
  3. Integrate all modules. When problems are found during integration, the programmer can locate the problematic module and directly tell Cursor the error, letting it fix it. If Cursor can’t fix it, the programmer can then locate and fix the issue themselves. If the problem originates from existing code in the repository, it generally requires manual intervention from the programmer. Do not overly rely on AI programming. During manual programming, you can still use the Tab method to improve coding efficiency and use Ctrl+K for code refactoring at any time.

Of course, using Cursor still requires solid computer programming fundamentals and engineering practice experience. Cursor is just an auxiliary programming tool and has not yet reached the level of completing entire engineering projects end-to-end. It lacks architectural design capabilities and debugging and bug locating abilities, often requiring manual intervention from programmers.

In the previous video, you can see that the AI-generated code still has many bugs, some of which are obvious, such as unprofessional large model prompts and incorrect API usage for frontend streaming. If you lack programming experience, debugging these issues may take a lot of time. During debugging, programmers need to first locate the problematic module and then let Cursor fix it. Sometimes Cursor may not fix it correctly, such as frontend layout issues, which require manual fixes.

Therefore, excellent programmers can greatly improve their efficiency with Cursor, while those with weak fundamentals may not see a significant efficiency boost. Some programmers may struggle to understand others’ code, making debugging Cursor’s auto-generated code more challenging than writing it themselves.

Every Programmer Should Learn to Use AI-Assisted Programming

A friend said that the current level of AI programming is at least equivalent to a programmer with an annual salary of 400,000 RMB, with solid programming fundamentals and good code style. (When this was said, OpenAI o1 had not yet been released. Today, the programming level of o1 surpasses most humans.)

I once again urge every programmer to learn to use AI-assisted programming. Last year’s best practice was asking ChatGPT, this year’s best practice is using AI-assisted programming tools like GitHub co-pilot or Cursor, and next year’s best practice might be end-to-end AI programming tools like OpenAI o1 or Devin. Programmers who do not use AI-assisted programming may be eliminated in a few years due to low productivity and learning efficiency.

Some may worry that if AI programming becomes better than humans, most programmers will lose their jobs. However, there is no need to worry because “deciding what to do” always requires human thought. Various programming languages, frameworks, and tools are all about reducing the time spent on trivial details, allowing more focus on creative tasks. From assembly language to C language to high-level languages like Python, programmers have not lost their jobs but have created more value. AI-assisted programming is the same.

Comments