r/ChatGPTCoding • • Apr 22 '24

Discussion I'm still learning how to code. Should I learn how to use AI for coding now or later?

Title. I still want to learn the fundamentals to not be dependent on AI, but should I learn how to use AI as a tool for coding while learning how to code myself? Or later after I'm proficient?

I think it mainly depends on how AI is even used as a tool for coding (which I don't know). But pls lemme know your thoughts and advice :)

EDIT:

I think I should clarify: I meant learn how to prompt AI "on the side" as I learn programming. For example, I spend some time learning language X and little bit of time learning how to prompt the AI the right way in order for it to generate the code I want.

13 Upvotes

34 comments sorted by

7

u/SicilyMalta Apr 22 '24

Learn the basics. If you love to code, then learn to code.

7

u/LaughingLaura0 Apr 22 '24

Learning both simultaneously can help you develop a deeper understanding of both coding and AI, but it ultimately depends on your learning style and goals.

14

u/Just-Hedgehog-Days Apr 22 '24

You should not be using it generate code. Code generation today REQUIRES that you understand the output, because it's not 100%, and trying to build a machine with a bunch of parts milled to 90% expected tolerances won't work. You have to know how to file down the widgets or send them back.

Things you absolutely should use LLMs for when learning to program

  1. Terminology and syntax questions. Treat it like a mentor that won't do your homework for you, but answers any question you have and you can learn a lot faster.
  2. Debugging elementary errors. You get an error trying to write something dead simple like "myValue = 0" and get an error like "Cannot automatically convert from float to double" and have no idea what that means, and the LLM can quickly help you go "Oh there lots of types of decimal numbers I needed to write 0f not zero". Also just pasting whole console logs into an LLM and saying "what happened?" give great feedback and trains YOU to start making sense of console logs which is IMO harder than coding, or at least takes more practice and experience.
  3. Stubbing boring things you already know how to do, but forgot the exact details. Assuming you already get what a constructor is but you forgot for a second, you can have the machine give you the skeleton and fill it in yourself.

3

u/DarthEvader42069 Apr 23 '24

Yes, this is the best approach. It is a great tutor. It can explain new libraries or other people's code, answer syntax questions, etc. Imo it takes a lot of frustration out of learning programming.

1

u/Just-Hedgehog-Days Apr 23 '24

So true I’m deeply envious of people getting to learn with these tools

1

u/100dude Apr 23 '24

How would you custom prompt the assistant then? Cuz “you’re a world class ai programming assistant tailored for an intermediate learner” won’t make it work.

I think many will benefit from your guide

1

u/dogscatsnscience Apr 23 '24

It's not possible to use AI (LLM's) to generate code if you don't understand how to code. You'll have no way of knowing when you have gotten bad results, and trying to fix them will take too long or not be possible.

But LLM's are incredibly helpful for super-charging your learning. The challenging part is knowing when you need to research something independently, and when you can use the LLM to teach you.

  1. You have to learn the basics first. Pick your language, and look up some basic tutorials.
  2. Use an LLM to explain code to you. Ask it to add comments to your code, ask it to document what piece of code does.
  3. You can take existing programs (small ones) and put it into an LLM, then ask to explain anything you don't understand.
  4. Ask the LLM to do things like "make it more concise", "use modern conventions" (because the LLM may give you very basic-level code), and you'll start to see new patterns come out. Ask the LLM to explain those to you as well.

If at any time you can't figure out how to solve a problem, it's important to recognize that you may have to go back and find good study resources. Relying entirely on the LLM to learn and code will box you in too much, and you will probably get stuck with a very junior understanding.

Knowing what I do now, I would start using the LLM and doing tutorials side-by-side right away. LLM's are excellent teachers, BUT you have to learn enough to know when they are giving you bad information.

1

u/AsianDoraOfficial Apr 23 '24

It's not like I didn't want to learn how to code. I very much do. I was just wondering if I should start learning how to prompt AI to generate the code I want right now or later.

And yes, you are correct about using AI as a learning aid. I've found it very helpful if I have a specific question that doesn't have an answer yet online (and I do double check online for its correctness).

1

u/dogscatsnscience Apr 23 '24

Without knowing how to code, you can’t ask it to generate USEFUL code, because you wouldn’t know when it’s wrong.

And even as you learn, you’ll need to learn to what the weaknesses are in the LLM, so you can get around them.

I would start using it right away, but you have to constantly try to improve yourself so that you don’t get trapped with the LLM just putting out low quality code forever (because you don’t know what to ask for).

Bad code will do one thing well, but will be useless for a larger project.

3

u/Stock_Complaint4723 Apr 22 '24

Do both. Learn to manage between the two approaches

3

u/geepytee Apr 23 '24

This is the way

3

u/Cautious_Cry3928 Apr 23 '24

Keep learning to code, but also learn to use AI in your workflow. We're coming upon the era that Natural Language Programming has been made possible. If you know the fundamentals behind code, you can prompt AI in plain English to write code for you.

Do NOT get AI to generate all of the code for you unless you're prompting it step by step. For example you should not tell chatGPT "Write a program that does XYZ" you should carefully prompt it with instructions like,

"I want you to write an [LANGUAGE NAME] script using the namespace "XYZ". In this script I would like you to write a for each loop that iterates through five names (Bobby, Joey, Lisa, Cory, Stacy), and prints each name to the console."

You need to walk it through every step to get your desired code, or GPT will loosely generate code that requires further editing or refining. This way you are actually programming just in Natural Language. This probably isn't the best example, but it should convey the gist of it.

1

u/[deleted] May 29 '24

[removed] — view removed comment

1

u/AutoModerator May 29 '24

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 if you have any questions or concerns.

5

u/kumingaaccount Apr 22 '24

I wouldn't touch chatGpt for the first year of coding. There are some great youtube series and courses online that hand hold you enough already.

Plus even if you use chat gpt at that point you would have to understand the code it prints and you simply wouldn't. You also wouldn't know what questions to ask to begin with besides pasting the prompt and keep playing guessing games with whatever it spits out until and IF it works. And if you are doing that, I simply can't think of a bigger waste of time. Yes doing this guess and reguess method MIGHT work but in terms of efficiency, you are better off doing a quality youtube/course.

2

u/AI_is_the_rake Apr 23 '24 edited Apr 23 '24

Should you learn prompt engineering for producing code? There’s no engineering needed. If you’re working on a specific project give the AI a bit of the surrounding code for context and just ask your question. Expect AI to produce no more than small functions that follow the single responsibility principle. The only prompt “trick” worth considering is to ask the AI to “output a statement that rewrites the user’s query in your own words followed by a statement that outputs the problem that will actually give the user what they’re wanting instead of what they’re asking for, then solve the real problem”

Besides that, use AI for learning, not for coding. If you have a paid subscription, when you read a book or blog and don't understand, copy the whole page for context and start asking questions. 

I like ChatGPT Pro. You can ask it to check 5 internet sources to give it the context it needs for accurate information. It's like having a conversation with a book. This makes learning more enjoyable and interactive. 

If you don't get code, have the AI explain it. I'm an experienced developer and used this approach last night. I made the AI explain the code it generated for me. Be careful with hallucinations, though. What I needed was terminal commands and usually, —help works best. Sometimes, I copy and paste the —help output into chat because the interaction is more enjoyable.

1

u/AI_is_the_rake Apr 23 '24

Used AI to help craft a better response lol:

Integrating AI into your learning process can be beneficial even as a beginner in coding, and can significantly enhance both your understanding and efficiency. Using AI tools like code generators or assistants can help you understand coding patterns, debug issues, and see multiple approaches to solving a problem. However, it's crucial to first attempt to solve coding challenges independently to strengthen your fundamental understanding, then use AI to compare your solutions or to explore alternative solutions.

Additionally, using AI not just as a code generator but as a dynamic learning tool allows for deeper engagement with material. For instance, when reading technical content, using AI to clarify concepts or explain code can be like engaging in a dialogue where you can probe deeper and clarify doubts instantly. This interactive learning method can make the learning process more engaging and effective. When it comes to coding, while AI can help by providing code snippets or debugging help, verifying the output from AI, especially in technical tasks like programming, where precise syntax and logic are crucial, will cultivate robust understanding and critical thinking skills, essential for any programmer. 

Thus, learning to effectively prompt AI while you learn programming can indeed enhance your learning experience by providing real-time assistance and insights. This dual approach of using AI for both generating and explaining code, while always cross-checking the results, is a balanced way to accelerate your learning and achieve a deeper comprehension of coding and other technical subjects.

2

u/__ChatGPT__ Dec 19 '24

Using AI to code is definitely a learned skill. You should start as soon as possible and it will also accelerate your learning. AI is an accelerator right now, and it allows you to hit the ground running with most new projects. You do have to be careful to understand the code being written though. If you don't then when you INEVITABLY need to debug an issue, you may get stuck. Of course you can always have the AI walk you through the code to understand it, but it's better for you and your learning if you just get used to doing this process with each change/addition to your codebase.

I have written several blog posts on this issue of learning with AI and how to use it more effectively. I'd love to know if you find them helpful or if I should cover any other topics that may not be mentioned.

1

u/BobFellatio Apr 22 '24

Im gonna go against the current and recommend start using it right away, but only if you use it as support with the aim of learning. Meaning: Try to think for yourself first, and when you use it, tell it to explain how the code it gave you works (if you dont understand it yourself). Combine this with Googling and reading on stack overflow.

Its a really nice tool to help you get unstuck and keep you motivated by being able to do alot of things. But as mentioned, its only good if you use it to learn.

1

u/scottix Apr 22 '24

It's like using the calculator when your learning basic arithmetic. You are not going to learn anything, if your just going to cheat. With that said, once you have mastered the concepts, then you can use it to either speed up your programming or learn new tactics. I always told people, treat it as like a friend who knows a lot but can't always trust.

1

u/[deleted] May 29 '24

[removed] — view removed comment

1

u/AutoModerator May 29 '24

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 if you have any questions or concerns.

1

u/Thinklikeachef Apr 23 '24

My approach is to get a well respected text book. Then use the AI to help you understand. Treat it as a private tutor, who won't do the work for you, but help if you are stuck.

1

u/MrDevGuyMcCoder Apr 23 '24

Later for any core logic, but do use it to help you write test cases on the code you crafted. And feel free to ask it for clarification on your code / check for any optimization, but only after initially written and you understand the process

1

u/gybemeister Apr 23 '24

There's nothing stopping you from using AI and learning to code at the same time. If you rely only on AI to code it would be like wanting to learn a language using Google Translate. It helps but you will miss a lot of the subtleties and the structure behind the language.

I understand the posts about not using AI to code if you can't code but coding today relies heavily on AI and it will only grow; the cat is out of the bag. I suspect we are entering a new era in this profession and you surely want to be up to speed on the tools.

1

u/[deleted] Apr 23 '24

I started using it right away and it helped me learn what code was incorrect/suboptimal pretty quickly. It had days where it spat out almost perfect methods and days where I could see it was incorrect.

1

u/[deleted] Apr 23 '24

I used ChatGPT to help me learn an entirely new tech stack and it was absolutely the coolest thing. You can ask it questions without fear which I think made me even more excited to learn! I would never ask it to write a full program, but little snippets will be suggested that I will sometimes use in certain circumstances, but really it’s only syntax based questions that it can help with. I have also gotten help with errors as well. It really was helpful in so many areas for me and I think it has helped me grow a lot.

1

u/FosterKittenPurrs Apr 23 '24

If you're just learning to program, there is no useful prompt learning here. You could just copy paste the textbook exercise to e.g. ChatGPT and it will just generate the full code for you.

Learning how to prompt will be more relevant once you have a program with thousands of lines of code, spanning across several files, as then you won't be able to just tell it "add X functionality" and that's that (though by the time you learn enough programming to get here, it may just be able to do that, so any prompt techniques you will have learned early on will be useless anyway)

Use it like a teacher, ask it anything you would a teacher or TA, if you thought that person had infinite time and patience.

1

u/surim0n Apr 23 '24

I have a community of people tinkering with AI for coding purposes. I 100% believe you should learn coding with AI now. Yes, learn the basics of the language as you go as well but ignoring it won't get you places. I may get downvoted - but Jensen (CEO of Nvidia) himself has said learning natural language is more important.

Take what he said as you will.

1

u/TackleInfinite1728 Apr 26 '24

use copilots to write tests

1

u/an732001 Jun 26 '24

You can try something like Athens: https://www.tryathens.com/

1

u/violet_zamboni Apr 22 '24

You really should find the upper limit of what you can handle BEFORE you even touch generative code.

That means the most complicated algorithms, the most layers of technology and tiers, the most difficult to deploy, the craziest library integrations. Learn TDD. Because you will need all of those to make generated code work!

I believe in the future where more code is generated, the lower performing programmers are going to be a lot more replaceable. Debugging generated code or figuring out exactly how to constrain a request are going to be the big skills in demand.

1

u/[deleted] Apr 22 '24

[removed] — view removed comment

1

u/AutoModerator Apr 22 '24

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 if you have any questions or concerns.