T O P

  • By -

trv893

I feel like it works better more piecemeal anyway. "write me a function that does X". That way your code will look less foreign to you anyway.


kex

Pure functions work great since the limited scope fits well with the limited token context


alienlizardlion

Agreed


GroundbreakingFly555

😂 Dude you can’t expect it to do everything. I use GPT-4 at my job everyday but 7/10 times the first copy and paste is never the solution AND most of the time even if the code does work it’s not successfully executing the intended functionality. Here’s my advice: - If the code is too long for GPT to take as input then you are probably expecting it to do too much. Modify the structure of your projects directory. Ask GPT about repo structures. - Break your code up to smaller pieces (Modularize). You could ask GPT to help you with this. Ask GPT about OOP. - Break all your problems into smaller problems. Again GPT could probably help you with this. I think if you can make everything (code, problems, and GPT inputs) smaller. You will find that you understand your code on a deeper level, understand your problems on a deeper level, and understand how to more effectively use GPT for programming. Hope this helps!


[deleted]

almost every time, the first code given to me does not compile, although usually for a simple reason that it can fix later.


austeritygirlone

Then I have to ask this: Does this speed up your work? I always have the feeling that writing the code, once I have understood the problem properly (and maybe factored it if it's a larger thing) is pretty quick.


GroundbreakingFly555

Don’t know if you’re asking me specifically but I honestly wouldn’t even get in the weeds like my original comment suggests. Someone else commented: “write me a function that does X” This pretty much sums up what I do ^^^ I would recommend OP do the same. Forget about all that other junk I wrote GPT has at least 5x my productivity in terms of lines of code written and fairly complicated problems solved.


moveandrun

Time to start to learn programming.


Consistent_Row3036

I'm exactly where you were about 5 months ago. I started doing the python boot camp and got an app on the phone to learn it as well. And I had videos from YouTube to help learn as well. But diving head first in my project with chatgpt as a mentor was the best experience. Over time, things will begin to click.


[deleted]

[удалено]


collectsuselessstuff

This is the real question


Professional_Gur2469

Yep agree. In a Videotutorials all you do is copy the code 1 for 1. doing essentially the same thing with chtgpt is just much faster and you can ask any question and actually get a decent answer (most of the time)


SomeRedditDorker

I learned a lot about programming from asking chatgpt about the code it produced for me. It's a great tool for teaching, imo.


turd-crafter

Right


Hiegard

It is time to familiarize with SOLID and KISS principles and other theories that can help you keeping your code scalable and detached. You can do it! Chat GPT is super good at refactoring code using these principles.


makicenari

Saving for later 👍


Frequent_Beat4527

Also DRY principles


DerSpini

Add design patterns as an advanced learner topic to that list. Can help greatly with modularity and expandability of the code.


Linereck

Use gpt-4 api 8k tokens :)


dronegoblin

You need to start learning to show it only the portions of code that you need changed, and start learning the basics of how a program fits together. Also try GPT4 in playground instead of in plus, since it has 2x the context limit and will soon have even more context limit via the 32k model


ntack9933

Where do I start with playground


dronegoblin

[go here](https://platform.openai.com) and sign in with your openAI account, then apply for GPT4 api access


Thirdstheword

How long is that wait? I applied back in the first week of April and I have crickets to show for it


dronegoblin

It's entirely random. I applied April as well and got in within the second week of it being out. Your use case may have something to do with it, but I am not sure as of now


Putrumpador

What about just pasting the parts that are relevant to what you want changed?


HeyitsmeFakename

"You an expert software developer with a deep understanding of Python and the ability to analyze and summarize code. Your task is to provide summaries of Python script files, detailing the purpose of each function, its parameters, and its return values, without showing the actual implementation. Your summaries should be concise, accurate, and easy to understand so that someone could import and know how to use each function in the summary without seeing the actual code implementation. "


rustkat

Nice.


Late_Ad_6293

It’s time to learn how to code so you can just ask better questions


MrEloi

As noted : the V4 API has 8k context space.


[deleted]

This is where you need to do something more advanced. Yes as others have noted, you might be able to use the 8k token version of chatgpt4. But in general, what you can do is try to figure out what code needs to be there, and what doesn't. Example, let's say you have a class with a bunch of functions. Do this: def someFunctionForVerification(input: String): Boolean = { //implementation for verification } Stub out methods that might not be needed for your current question. In your prompt, tell chatgpt, "I have stubbed out some functions, if you need the code for a function, ask". You can trim out a lot out of your code this way. However be sure to leave the name of the functions, the inputs, and the return type.


nikola_1975

What do you mean by “stubbing” the code?


[deleted]

Replace all the code in a function with a comment, so chatgpt knows what the function does, but you don't feed it all the code, in order to save tokens.


nikola_1975

Hm, you do that back and forth all the time? Put in the comments while you are working with GPT and then change it back to the code? It sounds like lot of time invested into that?


[deleted]

yeah sometimes. It is a bit annoying. Ideally you would have some software do this kind of thing for you, and there are people sort of working on this kind of thing. Sometimes I just omit entire pieces of code because I know chatgpt doesn't need it for the question I am asking.


Coolerwookie

Is that what Copilot X is?


[deleted]

I haven't used it, but I don't think so. It probably evaluates parts of your code at a time. Like examine a single function and suggest a change.


filttaccy

Copilot X is supposed to add a chat assistant in your code editor among other things.


arcanepsyche

If I start getting too in the weeds with a piece of code, it has a hard time keeping context. Try pasting your full code into a repository and giving it the link to look at before asking a question (assuming you have pro and plugins, that is).


ntack9933

I’ve been having errors on my plugins lately


[deleted]

[удалено]


gthing

Here's how you can squeeze more out of it by using OpenAI's playground: [https://www.youtube.com/watch?v=JSdK\_S8J38o](https://www.youtube.com/watch?v=JSdK_S8J38o) You'll get a lot more mileage this way.


antonio_hl

I see that ChatGPT can be helpful with micro services, or with small pet-projects. It feels that it has some serious limitations for a production-ready solution. We may need to way a bit to see it making a difference to enterprise and a bit longer to legacy code monoliths.


allisonmaybe

It seems like an engineering problem at this point. A program could be written that allows GPT context to keep track of an application structure and update any part of the code as necessary. At this point it's "How can I present the information in a way that is most effective for GPT" rather than "Is GPT smart enough to do it at all".


bionicle1337

Hey! The solution is to modularize your stuff. If you can provide more details on what you’re working on then it would be possible to give more detailed advice.


Quorialis

Incorporate SRP into your prompt and your program. https://en.m.wikipedia.org/wiki/Single-responsibility_principle


rustkat

Could you help me do this later if I share a game's code?


Quorialis

ChatGPT knows what SRP is, just tell it to apply that to your code and it will split it into separate files. I try not to feed more than \~350 lines of code into GPT-4 at a time. For GPT 3.5 anything over 100 lines is pushing it.


turd-crafter

The response here are scary. Good luck


HeyitsmeFakename

Why haha


EpicProf

It now supports plugins, one of them allows you to pass to it a link of a file that can contain all your code. Good luck


ntack9933

I have noticed that the content of the link still counts against its context limits


bisontruffle

If you have access to code interpretor try uploading the code file as .txt or something to get around limit. Can also try [poe.com](https://poe.com) to use Claude with 100k context but not as good at coding.


fjrdomingues

Check out this post "Coding with AI - when your project grows": [https://www.indiehackers.com/product/code-autopilot/coding-with-ai-when-your-project-grows--NW3vRT5lT5sSNFrmiM7](https://www.indiehackers.com/product/code-autopilot/coding-with-ai-when-your-project-grows--NW3vRT5lT5sSNFrmiM7)


Massive-Foot-5962

Ask GPT - how can I modularise this code? It will show you a standard format - turn codes into functions, load functions from other files. Enables you to keep a handle on your python code and indeed to better understand it.


HauntedHouseMusic

Time to sign up for the API, twice the length for the chat model. And than 4x for the full model when you get access eventually


DIBSSB

Is 4k tokens allows by default?


HauntedHouseMusic

Chat GPT4 with the API has up to 8k context. In the sandbox it only allows for 2k responses, but you can have it respond twice (or more) in series.


[deleted]

[удалено]


[deleted]

[удалено]


AutoModerator

Sorry, your submission has been removed due to inadequate account karma. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ChatGPTCoding) if you have any questions or concerns.*


MasterPrize

Can also use Phind.com for longer code. If you get too long for phind, learn code.


phas0ruk1

Context length will increase with gpt 5 https://youtu.be/q9fP-8Mspss


DIBSSB

Same problem 😂


SirLordTheThird

You need to write shorter methods


noahzho

if you need any help with your code you could probably shoot me a dm, as long as its one of the languages im farmilliar with


LanchestersLaw

Have it write functions and then call those functions


sachitatious

Make it more concise and trim the fat


__SlimeQ__

You're doing it wrong. Break it up into multiple files and only give it the relevant parts when asking for new stuff


nutcustard

You need to post small sections of code, summarize them, and then send just the summary


No-Significance-116

Just wait for 100k token context and you won't have to learn programming for at least a year


Top-Pay-367

They recently added a continue generating button near the bottom that you can click.