First generation of noob AI coders are here

Yes, I’m one of those people. I’ve written no more than 100 lines of code in my entire life, but thanks to the new generative AI features emerging everywhere, I’m diving in headfirst. Cursor was exactly what I was looking for—an excellent tool. I’m even paying for it, despite the free version being more than sufficient for a beginner like me. Thanks to Cursor, I’ve created my first app, deployed it using Inno, and now I’m sharing my .exe as if it’s the best software out there! :slight_smile:

For the past two weeks, Cursor has been my go-to tool. However, over the last few days, I’ve been struggling because “my” code has become more complex and significantly longer (around 2000 lines). Cursor is finding it difficult to help me with the new errors, and I’m having trouble finding a solution.

It’s become clear to me that I need to break up the code into smaller pieces and work on separate .py files. Is this how you experts do it? I guess it’s not the number of lines that matter but rather the complexity of what you’re trying to achieve. Will Cursor understand the connections between these files? Is that the reason we have the “CTRL + Enter” search function?

2 Likes

Your post looks very strange to me. I’ve written code in about 10 different programming languages and I do appreciate Cursor Tab, which I use mainly as a typist. It changed my way of coding in a way, since now I don’t try to minimize the number of lines of my code: I know that I can slighly modify many similar lines easily with the help of Cursor Tab. But Cursor Tab shows all the time that he doesn’t understand anything to what I’m doing. The problem of course is not the Cursor team! I simply find all AI assistants (ChatGPT, DeepSeek, Claude, …) of very little help to offer me solutions to any of my coding problems. So when I hear people say they build an entire application with the help of AI …

I’ve noticed that for longer code bases Long Context Chat works better. And only Claude 3.5 is able to offer proper help so far. Gpt-4o is awful for coding, Gemini doesn’t get things as easily and you have to over explain. Claude usually gets it and implements things that work. But one has to still understand everything in the code to not hit a snug here and there. And logic separation into multiple files or components helps I guess.

I’ve been able to mostly code by writing English for the last several days. However, debugging and figuring out the general trajectory is still on me, can’t offload this to AI yet.

1 Like

Hi @Braian ,

Yes, making your code ‘modular’ is a common approach to keeping it manageable.

Cursor allows you to provide different ‘context’ to your chat messages through the @ Symbols feature:

https://docs.cursor.com/context/@-symbols/basic

And, as you mentioned, you can also provide your entire codebase as context.

As a simple, language-agnostic, pseudo-code example, say you have an entry file named:

  • my_entry_file

You could create a folder named:

  • my_modules

And within that folder you could have files like:

  • module_a
  • module_b
  • module_c

You could import any of those ‘modules’ into your main file.

You could also import modules into other modules.

When provided with the ‘context’ of individual files, and the files they are related to, large language models can recognize the connections between them and respond to your prompts accordingly.

It is worthwhile exploring the topic of best practices for organising your application’s files and folders both through AI chat services as well as more traditional resources.

Good luck!

1 Like

Thank you that helpful. I´m going to give this a try. I downloaded “python for dummies” and the show almost the same setup. Thank you

1 Like

Sure, the app is running well, though you’d probably cringe if you saw the code. I’m not sure if the structure meets any standard, but the app works great, and I’m happy with that. I’d be glad to share it with you. I also tried the Cursor Review (Beta) function, and it gave me five suggestions. It pointed out a couple of duplicate code sections and some other issues.

1 Like

I’m excited to see AI-first coders learning their own way!

I don’t know of any research about which coding habits LLMs find easiest to work with. But I imagine AI will perform best when working with code that’s like the best examples of what it was trained on, so you may find value in organizing your code the way professional developers do.

The soul of software engineering is breaking down problems into pieces which can be understood and reasoned about individually. Your instinct about moving pieces of code into separate files is exactly right.

Figure out what the major pieces of your problem are and make a file for each important piece. AI can help you figure out what the pieces should be, and can explain to you what each section of code does.

Sections of code that are relatively self-contained are good candidates for becoming their own files. For example, if you have some code that takes an input, does a bunch of complicated logic, and then produces an output, without affecting other parts of your program in the middle, you can isolate that logic in its own file. That way when you’re not working on that part of your program, it’s not distracting you and it’s not distracting the AI.

Another important principle to keep in mind is “Don’t Repeat Yourself” (DRY). If you find yourself copy-and-pasting the same section of code multiple times in your program, it’s a good idea to move that code into a function. This has a bunch of benefits: it makes your code more compact and readable, it prevents situations where you fix a bug in one place but the bug persists in another place, and (again) it keeps irrelevant code from distracting your and the AI while you’re working on something else.

If you divide your code into clearly-labeled pieces, and you make it easy to understand how those pieces connect together, it will be much easier for both you and the AI to understand and work on. Good luck!

2 Likes

If you’re working in more than one file, you need to tell Cursor which file(s) to look at. By default, Cursor will look in whichever file you have currently open, which is what you want if your problem is isolated to that file. If you want to have the AI look in additional files, there are a few ways to do that:

  • You can drag files from the file explorer pane (including the “Open Editors” section, if you like) into the chat pane.
  • In the chat pane, type @. You’ll get a popup window where you can select files, folders, documentation from the web, or your entire codebase.

The better you are at identifying where your problem is and feeding the right bits of code to the AI, the better it will be at diagnosing problems (and the less money you’ll spend).

It’s almost frustrating reading your tips! :slight_smile: Since “I” have already made an app before, I knew almost exactly what I needed, so with the help of Cursor AI, we figured out how to modularize the code. Now, I’ve started a new project, and we’re using a checklist.md to guide us through the step-by-step process. I can easily point the AI to this checklist when things start getting overwhelming. It’s actually working really well!

However, I’m struggling with the advice that “sections of code that are relatively self-contained are good candidates for becoming their own files.” I have a feeling that my main.py isn’t fully in sync with some of the modules. It’s a bit early to tell because we’re still working on some basic features, but it’s frustrating because I know what I want to achieve. I think I’m getting pretty good at directing the AI to the correct files, @Tavi, but I lack the deep knowledge to properly control my code structure.

Right now, I’m asking the AI to help me understand different parts of the code, and it’s great—its explanations are fantastic. But when it tries to teach me how to check my modules, I get a little lost. I’m spending over three hours a day on this, and it’s super fun. Thank you, Cursor! :blush:

1 Like

Welcome to the joy and frustration of coding! :laughing:

Not completely understanding what you’re doing is normal at this stage. You may have more of it than a traditional coder, I’m not sure–AI lets you go faster and get further, potentially letting you develop a bigger pile of stuff that kinda works but which you don’t really understand. But if the AI is also good at explaining stuff, maybe that’s not a problem.

Unfortunately I don’t know much Python, so there’s not much advice I can give about Python modules. FreeCodeCamp is a great resource for newbie programmers, and they have a Python forum where you might be able to get more specific advice.

Are you using version control? Having a git repository means that if you break something you can easily go back to a version that was working. That gives you a safety net so you can experiment without fear. I’d be happy to recommend some tools and best practices if that would help. If your main.py is out of sync with your modules, I would go back to a state where they were in sync, make a git commit, and then start updating modules one at a time, committing each time you get your project into a working state.

1 Like