Howdy folks! Sloan, DEV Moderator and mascot, coming back at ya with another question submitted by a DEV community member. 🦥
For those unfamiliar with the series, this is another installment of Sloan's Inbox. You all send in your questions, I ask them on your behalf anonymously, and the community leaves comments to offer advice. Whether it's career development, office politics, industry trends, or improving technical skills, we cover all sorts of topics here. If you want to send in a question or talking point to be shared anonymously via Sloan, that'd be great; just scroll down to the bottom of the post for details on how.
Let's see what we have this week...
Today's question is:
I'm still a beginner dev and trying to learn the basics, but I'm already getting tempted to use AI to help me write code. On one hand, I feel like I should resist, but on the other, it feels like I should experiment with whatever tools are available to me. Does anyone have any guidance on how to approach this?
Share your thoughts and let's help a fellow DEV member out! Remember to keep kind and stay classy. 💚
Want to submit a question for discussion or ask for advice? Visit Sloan's Inbox! You can choose to remain anonymous.
Top comments (10)
I've made it through Udacity's iOS Developer course, and they provide a "Udacity GPT" AI chat window in their online classroom. I used it a lot, and found it very helpful, sometimes... First of all, know that ChatGPT always wants to please. It will act as if it knows the answers, even when it doesn't. So take whatever it says with a grain of salt and verify with some other source. Having said that, here are some ways I've used it that were helpful:
These are some seriously helpful prompts.
Professional Software Engineer for 7 years here. This is the way you should use it IMO.
Don't rely blatantly on generated code. First of all, understand what is generated but use AI to get a better understanding. Use it to brainstorm and further your horizon. Generate different approaches, learn from their pros and cons and decide for yourself the best approach.
Critical thinking will be the differentiating factor between you and an AI code generator.
I just started on a new project trying to refactor and optimise an older codebase. The original authors have left so I feel like a junior again trying to understand the way they implemented it. Asking the questions you are asking on this code base has increased my progress a lot more compared to 5 years ago when I had a similar use case.
A thing I'm doing now to take it a bit further is to make a wiki and write a lot of notes along the way. I'm feeding these as a knowledge base to a GPT chatbot for colleagues but also for the business owners. It lowers the amount of queries we get along the way.
I'm a beginner and I'm not using AI because I need to go through the process of learning. There's nothing like finding that simple mistake somewhere and that code runs as intended.
For me there was nothing like finding out how to use a language's API Docs... At first I would go to sites like Dream in Code (I love DIC) lol, but when I foun JAVA's API docs I was in heaven! Our teacher had shown us the page in class but I had forgotten about it. Once I saw it's usefullness I never forgot again
Generally speaking, you should use whatever tools you have at your disposal to complete your tasks in a time efficient and quality manner. However, as a beginner, I would recommend caution with using AI for a few key reasons:
Personally I use them for learning but rarely for automation or quick snippets.
Given that they feed on content across the internet, the more basic/fundamental your questions are, the more rich and consistent the AI's answers will be. For example I've asked it for things like JWTs, common attacks and vulnerabilities, SSR and how it handles subsequent requests, and even asking the details on how content is delivered to the users from the moment they enter the URL.
I'd be cautious on using it to write code however, the first thing to worry about is if it actually wrote good code, again it depends on the prompt but if you don't understand what it spit out maybe don't use it until you do. I wouldn't even compare it to copying code from StackOverflow because in that case we could rely on the author's real-world knowledge and the community to tell us if its a good solution or not.
Also probably the main downside as a beginner is you don't really learn/practice code if you use it excessively, it's true that you could still understand and learn from the code it generates, but you weren't the one to come up with the solution, so that problem-solving muscle in your brain doesn't get a full work-out. I wouldn't say not to use it at all though, but maybe just sparingly.
With all that said, it seems you understand the risks in using it so I think you'd have a good sense on whether or not you're using it appropriately, so I say go for it kek
Just a quick tip on questions though, probably avoid asking questions that are framework-related, maybe the big ones like react is fine but you should probably read their documentation instead. A lot of the problems has to do with API changes, changes in strategies/patterns, and a lack of content to feed on, which all lead to confusing and low-quality answers from the AI.
I recommend no. The best time for using AI in coding as a beginner is to come up with ideas to challenge yourself. It's not a great thing for debugging, because you won't learn to find your own errors. It's also not a very good thing for writing code, because you'll have no clue what it spit out and how to read/understand it.
@stefanmoore said something similar, although they are a beginner too, so check out their answer as well.
AI is a great tool for beginners if they can understand how to use it correctly. Some warnings for beginners:
But as for programming, it's a much more efficient machine since it has been trained on all the data from all the programming courses, Dev sites (like this one), textbooks... so aside from some small mistakes it makes (which can be avoide through some prompt engineering) it's a great tool. Here are some of the ways AI can help you... just for fun I had the AI give you the following response :)
AI can be instrumental in creating personalized programming courses, leveraging its capacity for customization and adaptability to cater to individual learning needs and styles. Here's how AI can design a programming course tailored to your requirements:
Initial Skill Assessment: AI starts by evaluating your current programming skills. This could involve a questionnaire, practical coding tasks, or problem-solving exercises. The assessment helps determine your proficiency level and identify specific areas where you need improvement or further learning.
**Customized Learning Path: **Based on your skill assessment, AI develops a personalized course outline. For beginners, this might include fundamental concepts like variables, loops, and data structures. For more experienced learners, the focus might shift to advanced topics like algorithm optimization, design patterns, or specific programming languages and frameworks.
**Interactive Coding Exercises: **AI can generate a range of coding exercises tailored to your learning stage. These exercises can adapt in complexity as you improve, ensuring you're always challenged but not overwhelmed.
Real-time Feedback and Debugging: While you code, AI can provide instant feedback. It can point out syntax errors, suggest optimizations, and offer tips to enhance your coding style. This immediate feedback is crucial for learning and correcting mistakes early.
Project-Based Learning: AI can suggest and guide you through hands-on projects relevant to your learning goals. For instance, if you're interested in web development, it might propose building a website using HTML, CSS, and JavaScript, providing step-by-step guidance and resources.
Adaptive Learning Pace: AI adjusts the course's pace based on your progress and understanding. If you master a concept quickly, it moves on to more challenging topics. If you struggle with a topic, it provides additional resources and exercises to reinforce learning.
Language and Framework Recommendations: Based on your interests and industry trends, AI can recommend programming languages and frameworks to learn. For example, if you're interested in data science, it might suggest Python and introduce libraries like Pandas and NumPy.
Integration with Real-World Tools: AI can incorporate lessons on using essential development tools and environments, such as Git for version control, various IDEs, and debugging tools.
Gamification and Motivation: To keep you engaged, AI can include gamification elements in the course, like earning badges for completing modules or building streaks for consistent daily practice.
Community and Peer Learning: AI might also connect you with online forums or coding communities where you can discuss concepts, share code, and get feedback from other learners.
Continuous Progress Tracking: AI monitors your progress, providing insights into your strengths and areas that need more focus. This continuous evaluation helps in tweaking the course content to best suit your evolving needs.
In summary, AI can create a highly effective and personalized programming course by continuously adapting to your learning style, progress, and interests. This approach ensures that the learning experience is efficient, engaging, and closely aligned with your personal or professional goals in programming.