Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rndmcnlly/540f34fdbe7bd9da829d1e660c7074e8 to your computer and use it in GitHub Desktop.
Save rndmcnlly/540f34fdbe7bd9da829d1e660c7074e8 to your computer and use it in GitHub Desktop.

https://openai.com/chatgpt/use-cases/student-writing-guide/

I think most of that advice could adapted to give students guidance on computer programming with ChatGPT. Show me what this would look like.


Sure, here's how you might adapt the advice for students learning computer programming with ChatGPT:

A Student's Guide to Programming with ChatGPT

Used thoughtfully, ChatGPT can be a powerful tool to help students develop skills in problem-solving, clear thinking, and programming concepts. It can assist in debugging, structuring code, or explaining complex algorithms—but like with any tool, knowing when and how to use it is crucial. There are also ways to use ChatGPT that can be counterproductive—like having it write your code entirely. Doing so deprives you of valuable learning experiences, like figuring out how to fix errors and understanding the logic behind your program.

For students committed to becoming better programmers, here are some ways to use ChatGPT to enhance your coding skills:

1. Automate tedious coding tasks

Some coding tasks—like setting up project boilerplate, writing documentation, or configuring libraries—can be repetitive and time-consuming. ChatGPT can help you automate these tasks, so you can focus on the core problem-solving or creative side of coding projects.

Try asking:

  • Generate a boilerplate template for a Python Flask API with SQLite.
  • Write the basic documentation for this function I just wrote.
  • Set up ESLint and Prettier for my JavaScript project.

2. Quickly get up to speed on a new programming concept

ChatGPT can help bootstrap your understanding of new programming paradigms, languages, libraries, or design patterns. While you shouldn’t rely solely on its responses for expertise (always consult the official documentation), it can help introduce a new topic for further exploration.

Try asking:

  • What is the difference between synchronous and asynchronous programming?
  • Explain the concept of promises in JavaScript.
  • How does recursion work in Python vs. C?

3. Get a roadmap of relevant resources

ChatGPT can guide you toward useful programming libraries, tutorials, and learning paths. Remember, though, that while it offers a good starting point, relying on primary sources like official documentation and hands-on coding will offer the best learning experience.

Try asking:

  • I'm learning game development with Unity. What resources should I focus on starting out?
  • What are the most reputable tutorials to learn React.js in 2023?
  • Suggest some search terms to research optimization algorithms in Python for machine learning.

4. Fill in knowledge gaps by asking specific coding questions

Got a gap in your understanding of a specific algorithm, syntax, or behavior? ChatGPT can clarify tricky parts of a coding challenge that other resources don't seem to address.

Try asking:

  • Why does Python's any() function return True in this scenario?
  • Can you explain why dictionaries perform faster lookups than lists?
  • What does "event-driven architecture" mean in distributed systems?

5. Get feedback on the architecture of your code

After writing the outline or key logic for your program, ask ChatGPT for suggestions on how to improve the organization or efficiency of your design. You’ll still need to make judgments about which advice to follow, but it’s a helpful sanity check.

Try asking:

  • Take a look at this class structure. Are there any improvements I can make for readability and maintainability?
  • How can I refactor this function to follow better design principles?
  • Can you suggest improvements to the structure of this React Redux app?

6. Test for logical flow with pseudocode or step-by-step breakdowns

Before diving straight into code, it can help to talk through the logic of your solution using pseudocode or step-by-step reasoning. You can use ChatGPT to help formalize your ideas before writing actual code.

Try asking:

  • Can you help me break down the logic of how this quicksort algorithm works?
  • Please write a pseudocode outline for solving the "two sum" problem.
  • Here’s my algorithm for finding the nth Fibonacci number. Will it work, or do I have a logic gap?

7. Engage in "Socratic debugging" to find bugs in your code

Rather than just pasting your buggy code and asking for a solution, try a Socratic method—debugging your own code through guided questions. ChatGPT can help you think through your problem systematically, leading you to discover the solution for yourself.

Try asking:

  • I'm getting a KeyError in this Python dictionary lookup. Could you help me walk through what’s going wrong?
  • My recursive function in Java runs into an infinite loop. Which part of the base case should I reconsider?
  • Help me step through this code and find where the null pointer exception occurs.

8. Pressure-test your algorithm by asking for edge cases

An important part of developing software is ensuring it works not only for typical cases but edge cases. ChatGPT can help simulate trickier input situations or help you think of cases your code might fail to address.

Try asking:

  • What are some edge cases that could break a binary search algorithm?
  • In what scenarios might my current login validation logic fail?
  • Can you list ways this merge function for linked lists might not behave as expected?

9. Compare your solutions to those of experts

You can also use ChatGPT to compare your approaches with classic solutions or methods used by well-known programming experts or theorists. This helps put your problem-solving process in a broader context and tests whether a more efficient or elegant approach exists.

Try asking:

  • How does my implementation of dynamic programming for the knapsack problem compare to a famous solution like the Bellman equation?
  • Compare my bubble sort implementation to TimSort—what are the main differences in approach and efficiency?
  • How would Donald Knuth or Linus Torvalds optimize this sorting algorithm?

10. Iterate and improve your coding style with feedback

Gone are the days of writing a piece of code, submitting it, and never looking back. ChatGPT can offer multiple rounds of feedback on your code structure, naming conventions, efficiency, and clarity—helping you to continuously polish your work.

Try asking:

  • Suggest five ways I can improve the readability of my function names and variable names.
  • How can I make my code more Pythonic and follow best practices according to PEP8?
  • I've written a linked list implementation. Are there any data structures or libraries in C++ that would improve this implementation's efficiency?

11. Switch to explanations via voice (Advanced Mode)

When working on projects or reading through source code, sometimes it’s helpful to keep the troubleshooting process hands-free. ChatGPT’s Advanced Voice Mode can clarify parts of your code or API documentation as you work without needing to break focus and read.

Try asking with voice mode:

  • What does the asyncio.run() method do in Python async programming?
  • Can you explain what a “pure virtual function” in C++ is while I read these docs?
  • Explain this error traceback: what should I address first?

12. Don’t just copy-paste code—hone your problem-solving skills

Instead of using ChatGPT to write entire blocks of code for you, use it to actively sharpen your coding problem-solving skills. Ask it to present challenges or prompt ways for you to iterate on your solutions until you've internalized the principles behind the code.

Try asking:

  • Based on my previous code, can you suggest five new challenges to tackle that will help me improve my understanding of recursion?
  • Can you point out some common mistakes beginner developers make and how I can avoid them?
  • Help me identify points in my debugging process where I can improve and develop better instincts.

Be transparent — acknowledge AI’s role

Finally, when you use ChatGPT to help write code, debug, or refine your logic, remember it’s a tool for learning—not a shortcut to avoid hard work. In professional and academic settings, be clear about how you’ve used AI in your programming. Document where ChatGPT played a role and include shareable links or commentary to ensure you maintain full transparency and integrity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment