DEV Community

Cover image for ChatGPT as a Programming Mentor: A Test Drive
Wojciech Zawistowski
Wojciech Zawistowski

Posted on • Originally published at

ChatGPT as a Programming Mentor: A Test Drive

Nothing will accelerate your growth quite like an experienced mentor. However, finding one can be challenging, and their availability is often limited.

On the other hand, AI agents like ChatGPT are available 24/7 and seem to be quite knowledgeable as well. Could such an agent serve as a reasonable substitute for a real, human mentor?

What I'm particularly interested in is more "meta" advice - the small tips and tricks, acquired only through extensive experience, that will help you grow and mature as a developer - not merely generating or explaining code.

For example, something like my 20 Instant Tips to Rapidly Level Up as a Developer.

As someone with over 20 years of experience, who has mentored several junior developers, I'm curious how sound, comprehensive, and actionable for a beginner such ChatGPT's advice would be.

Let's take it for a quick test drive!


If you're curious about the quality of ChatGPT's advice but don't want to go through the entire discussion and my detailed step-by-step commentary, feel free to jump straight to the last section.

A short legend.

πŸ’¬ My prompts.

πŸ€– ChatGPT answers.

πŸ€” My thoughts/comments.

The setup.

πŸ’¬ Act as a seasoned, professional software developer with over 10 years of experience. Imagine that you are mentoring a younger, junior colleague, with no more than 2-3 years of experience. I'll be asking you different questions related to programming and software development career. I'll be asking them as this younger dev. Answer them in a way that will be most helpful for me to become a better developer and grow professionally.

πŸ€– Sure, I'm here to help you! Feel free to ask any questions you have about programming or your software development career, and I'll do my best to guide you based on my experience.

πŸ€” So far, so good. Let's get started!

The "Million $" question: 10 lifehacks to become a better developer.

πŸ’¬ Please share 10 lifehacks that are quick and easy to implement and will immediately help me become a better developer.

πŸ€– Of course! Here are 10 lifehacks that you can quickly implement to improve your skills as a developer:

  1. Use keyboard shortcuts: Learn and use IDE or editor-specific keyboard shortcuts to navigate and manipulate code faster. It will save you time and increase your productivity.

  2. Follow the Pomodoro Technique: Break your work into small, manageable intervals (usually 25 minutes) followed by a short break. This technique can help you stay focused and maintain a consistent work rhythm.

  3. Master version control: Get comfortable with Git or another version control system. This will help you track changes in your code, collaborate with others, and revert to previous versions when needed.

  4. Automate repetitive tasks: Use scripts or tools to automate mundane tasks like code formatting, file renaming, or project scaffolding. This will save you time and reduce the chances of human error.

  5. Read and write clean code: Adopt a clean coding style that's easy to read and understand. Follow best practices for naming conventions, indentation, and code structure. This will make your code more maintainable and reduce the time spent on debugging.

  6. Comment your code: Write meaningful comments to explain the purpose and functionality of your code. This will make it easier for others to understand your code and for you to recall your thought process when revisiting the code later.

  7. Seek code reviews: Ask your colleagues or mentors to review your code regularly. This will help you identify areas for improvement and learn from their expertise.

  8. Stay curious: Constantly explore new languages, frameworks, and tools. This will help you stay up-to-date with the latest industry trends and broaden your skillset.

  9. Break problems into smaller pieces: When faced with a complex problem, break it down into smaller, more manageable tasks. This will help you maintain focus and prevent you from getting overwhelmed.

  10. Take care of yourself: Prioritize your physical and mental well-being. Exercise regularly, get enough sleep, and take breaks when needed. A healthy mind and body will help you be more productive and focused in your work.

Remember, becoming a better developer is an ongoing process, and it takes time and dedication. But by implementing these lifehacks, you can accelerate your growth and continuously improve your skills.

πŸ€” The list seems mostly solid, though somewhat random and not particularly groundbreaking. However, I did ask ChatGPT for beginner advice, so the relatively obvious answers are understandable.

Some of these tips don't seem so quick and easy to implement (which was part of my prompt). A few others are a bit vague and require further explanation – but since ChatGPT is designed to be used iteratively, digging deeper and deeper with follow-up questions, I guess that's fine. There are a couple of points I don't fully agree with, but I view them more as a matter of opinion rather than being incorrect. Overall, not bad!

Let's dive a bit deeper into each suggestion:

  1. Use keyboard shortcuts: Solid advice. Fast and easy to implement, and it will undoubtedly boost your productivity. One thing that surprises me is why only simple keyboard shortcuts? Utilizing more advanced features like code intelligence, snippets, autoformatters, code generators, and AI assistants like GitHub Copilot (or ChatGPT itself, duh) would be equally easy to start using and provide a much bigger boost.

  2. Follow the Pomodoro Technique: Good advice. You should definitely try it. If you have never heard of Pomodoro before, you may have to google it or ask ChatGPT a follow-up question, but it's otherwise pretty straightforward and self-explanatory.

  3. Master version control: Good advice, but definitely not a lifehack. Even the word "master" clearly shows that it's not a quick and easy fix. I'd also argue that version control is an integral part of your primary tech stack, similar to your programming language, main framework, or database, rather than a "hack" to improve your productivity. But otherwise, the advice is correct.

  4. Automate repetitive tasks: Solid advice, but again, it needs further exploration. It's too high-level to implement immediately.

  5. Read and write clean code: Reading a lot of clean code (or code in general) is fantastic advice – and easy to implement. The only tricky part is how to know, as a beginner, which code is clean and where to find it. This again requires deeper inquiry. Writing clean code, however, is a completely different matter. It's part of a lifelong mastery of your craft, and entire books are written on the topic. You should absolutely study it, but just like with mastering version control, it's very far from a lifehack.

  6. Comment your code: This is the first tip that I find debatable (though, as I said earlier, not because it's obviously wrong but because of personal preferences). There are two stances regarding comments: commenting heavily vs making code so self-explanatory that you don't need comments (unless you need to explain the business purpose behind your code). I'm strongly in the second camp, so ChatGPT's very authoritative "write comments" doesn't resonate with me. On the other hand, it also says to write meaningful comments and to explain the purpose of your code, which I very much agree with. But it also says to explain the functionality of your code, which I consider a bad practice and a waste of time. So, I have mixed feelings on this one.

  7. Seek code reviews: This advice is as solid and easily applicable as it can get. You should absolutely seek code reviews as much as possible, especially as a beginner.

  8. Stay curious: This is the second piece of advice that I find somewhat arguable. Exploring new languages, frameworks, and tools is overall good advice (though I'd argue about "constantly" - it smells like buzzword-driven development), but it may not be the best strategy for a beginner with only a year or two of experience. As a junior, you should focus more on building a solid foundation of best practices and principles and learning them in-depth, which is easier when you focus on mastering a single stack for a while. But, frankly, I'm nitpicking here, and I wouldn't call this piece of advice wrong.

  9. Break problems into smaller pieces: Solid advice, but again, it's too high-level. Breaking down problems effectively is not trivial. To actually implement this in practice, some further drill-down would be required.

  10. Take care of yourself: Very good and applicable advice. It's actually nice that ChatGPT included advice like this, which isn't directly related to hard tech skills.

Alright, we went through all the tips. Not bad, not bad at all. However, not all of them are immediately applicable. Let's drill down into a few to see how close we can get to the core

Keyboard shortcuts - digging deeper.

πŸ’¬ Let's dig deeper into the "Use keyboard shortcuts" tip. Can you elaborate a bit if I should learn all possible shortcuts, or if there are any particular categories of shortcuts I should focus on?

πŸ€– Certainly! When it comes to keyboard shortcuts, the key is to focus on learning the ones that will have the most significant impact on your productivity and efficiency. You don't need to learn every single shortcut available, but rather prioritize the ones that will save you the most time and help streamline your workflow.

Here are some categories of keyboard shortcuts to focus on:

  1. Navigation shortcuts: These shortcuts help you quickly navigate through your code, jump between files or tabs, and find specific symbols or instances of a keyword. Examples include "Go to Definition," "Go to Line," and "Find All References."

  2. Editing shortcuts: These shortcuts assist you in manipulating code by cutting, copying, pasting, and formatting text. Examples include "Duplicate Line," "Move Line Up/Down," and "Toggle Comment."

  3. Refactoring shortcuts: Refactoring is an essential part of maintaining clean and efficient code. Shortcuts that help you refactor code quickly can save you a lot of time. Examples include "Rename Symbol," "Extract Method," and "Change Signature."

  4. Debugging shortcuts: Debugging is a crucial part of the development process. Shortcuts that help you manage breakpoints, step through code, and inspect variables can streamline your debugging sessions. Examples include "Toggle Breakpoint," "Step Over," and "Step Into."

  5. IDE-specific shortcuts: Your IDE or code editor might have unique features or tools that can be accessed through shortcuts. Familiarize yourself with these shortcuts to make the most of your chosen development environment.

Keep in mind that the actual key combinations for these shortcuts may vary depending on the IDE or code editor you're using. Refer to your editor's documentation or settings to discover and customize these shortcuts to your preference.

When learning shortcuts, start by focusing on a few at a time. As you become more comfortable with them, gradually incorporate more shortcuts into your daily workflow. Over time, using these shortcuts will become second nature, and you'll notice a significant improvement in your productivity and efficiency.

πŸ€” That's a great categorization! I'm impressed. I also like the concrete examples for each category. This level of advice is already actionable – you can easily look for "Navigation shortcuts" or "Go to Definition" in your IDE's documentation. Moreover, the categories are well-chosen. They are truly the ones that will give your productivity a significant boost.

There's just one thing I'm still missing: the more substantial productivity boosters, like auto-completion or code snippets. I don't want to ask about them explicitly, as I'm pretending not to know they exist. However, let's bend the rules a bit:

πŸ’¬ You said that I should learn shortcuts "to navigate and manipulate code faster", that "the key is to focus on learning the ones that will have the most significant impact on your productivity and efficiency", and to "prioritize the ones that will save you the most time and help streamline your workflow". Are there any other tools or IDE features, apart from keyboard shortcuts, that could help me achieve these goals?

πŸ€– Absolutely! Apart from keyboard shortcuts, there are many other tools and IDE features that can help boost your productivity and efficiency. Here are some of them:

  1. Code snippets and templates: Many IDEs and editors support code snippets or templates that can generate commonly used code structures or boilerplate code with just a few keystrokes. These can save you time and help maintain consistency in your code.

  2. Auto-completion and IntelliSense: Modern IDEs and code editors often provide intelligent code completion, which suggests completions for variables, methods, or keywords based on the current context. This can speed up your coding process and reduce the chance of typos or syntax errors.

  3. Integrated debugging: Debugging tools integrated into your IDE allow you to set breakpoints, step through your code, and inspect variables without leaving your development environment. This seamless debugging experience can help you find and fix issues more efficiently.

  4. Version control integration: Many IDEs offer built-in support for version control systems like Git. This integration can simplify common version control tasks, like committing changes, creating branches, and resolving conflicts, all within your IDE.

  5. Code analysis and linting: Real-time code analysis and linting tools can help you identify potential issues, such as syntax errors, unused variables, or code style violations, as you write your code. This can save you time on debugging and ensure your code adheres to best practices.

  6. Refactoring tools: Some IDEs have built-in tools that can automatically refactor your code, such as extracting methods, renaming variables, or changing method signatures. These tools can help you maintain clean and efficient code without manual effort.

  7. Task and project management: Many IDEs and editors have features that allow you to manage tasks, create to-do lists, and track progress within your projects. This can help you stay organized and prioritize your work more effectively.

  8. Customization: Most IDEs and editors offer a high level of customization, including themes, plugins, and configuration options. Tailoring your development environment to your preferences can help you work more comfortably and efficiently.

  9. Integrated terminal: Having an integrated terminal within your IDE can save you time by allowing you to run commands, build your project, or interact with version control without switching between windows.

These tools and features can significantly improve your coding experience, making you more efficient and productive. Take the time to explore your IDE or code editor's capabilities, and don't hesitate to try new tools or plugins that can enhance your workflow.

πŸ€” Now we're talking! The list is not entirely exhaustive (for example, it misses code auto-formatters, and it surprisingly still misses AI assistants – isn't ChatGPT aware of its own capabilities? Or is it just too humble?) but it's solid and broad enough to be genuinely useful for a beginner dev. Plus, now that you're aware of the richness of modern developer tools, you can gradually dig even deeper.

Version control - getting down to more actionable, bite-sized tips.

πŸ’¬ One of the tips you gave me was "Master version control". But is it really a quick and easy lifehack? It seems to me like a long process to fully master version control. Are there any version control-related quick tips, that could be implemented right away?

πŸ€– You're correct that mastering version control can be a longer process, but there are some quick tips and best practices you can implement right away to make more effective use of version control systems like Git. Here are a few:

  1. Commit frequently and in small units: Make small, focused commits that contain a single, logical change. This makes it easier to understand the history of the project, locate issues, and revert changes if necessary.

  2. Write descriptive commit messages: When you commit changes, write clear and concise commit messages that describe the changes and their purpose. This helps you and your team understand the project history and makes it easier to find specific changes later.

  3. Use branches: Create branches for new features, bug fixes, or experiments. This keeps your main branch stable and allows you to work on multiple tasks in parallel without affecting the main codebase.

  4. Merge regularly: Merge changes from the main branch into your feature branches regularly to keep them up-to-date and minimize merge conflicts when it's time to integrate your changes.

  5. Pull before you push: Before pushing your changes to the remote repository, always pull the latest changes from the remote to ensure your local repository is up-to-date. This can help prevent conflicts and ensure a smoother collaboration experience.

  6. Embrace .gitignore: Use a .gitignore file to exclude files that don't need to be tracked, like temporary files, build artifacts, or IDE-specific files. This keeps your repository clean and focused on the essential code.

These quick tips can help you make more effective use of version control systems and streamline your workflow. While they may not make you a version control master overnight, they can serve as a solid foundation for you to build upon as you continue to learn and refine your skills.

πŸ€” Pretty slick. Although these tips won't lead you to full version control mastery, they are now more actionable – and overall, they're pretty decent, considering it's advice for beginners.

Some points remain a bit vague, for example, "Use branches". Version control branching strategies is a broad, complex topic, and this particular point isn't very actionable without further exploration. However, it's a single outlier and at least provides a clear starting point for more in-depth research.

Overall, not bad!

Reading clean code - cutting through ambiguity.

πŸ’¬ You gave me a tip to "Read clean code". But how will I know, as a beginner, which code is clean? How to recognize it? And where to find such code to read?

πŸ€– As a beginner, it might be challenging to recognize clean code at first glance. However, with practice and exposure to well-written code, you'll start to develop an understanding of what constitutes clean code. Here are some general guidelines and characteristics of clean code:

  1. Readability: Clean code is easy to read and understand. It has a clear structure, meaningful variable and function names, and proper indentation. It also follows consistent naming conventions and style guidelines.

  2. Modularity: Clean code is organized into small, focused functions or methods that perform a single task. Each module should have a single responsibility, and the code should be divided into logical components.

  3. Maintainability: Clean code is easy to modify, extend, and refactor. It avoids duplicating code (DRY principle) and follows best practices to minimize the chances of introducing bugs when changes are made.

  4. Documentation and comments: Clean code is well-documented with comments that explain the purpose and functionality of the code. Comments should be concise and only provide information that is not immediately apparent from reading the code itself.

  5. Efficiency: Clean code is efficient in terms of performance and resource usage. It avoids unnecessary complexity, and the algorithms and data structures used are well-suited for the problem at hand.

To find clean code to read and learn from, consider the following sources:

  1. Popular open-source projects: Many popular open-source projects on platforms like GitHub have high-quality code that has been reviewed and refined by multiple contributors. Explore projects in the language or framework you're working with to find examples of clean code.

  2. Coding best practices: Look for articles, books, or courses on coding best practices for the programming language you're working with. These resources often provide examples of clean code and guidelines on how to write it.

  3. Code reviews: Participate in code reviews within your team or seek feedback from experienced developers or mentors. Observing their feedback and suggestions can help you learn to recognize clean code and improve your own coding style.

  4. Coding challenges: Websites like LeetCode, HackerRank, or Codewars offer coding challenges along with solutions submitted by other users. Reviewing these solutions can help you learn different approaches to problem-solving and expose you to clean code examples.

Remember, recognizing and writing clean code is a skill that develops over time. As you read and write more code, you'll become more adept at identifying clean code and adopting best practices in your own work.

πŸ€” This time, the result is meh at best.

The first part of the answer essentially states that you can recognize clean code by the fact that it adheres to very high-level and vague principles of being clean code (some of which, like comments and efficiency, are even debatable – for instance, does code really need to be efficient to be clean and readable?).

The second part is also hit-or-miss. Participating in code reviews is good advice (although it could be more emphasized that you should not only have your code reviewed but also do as many reviews as you can yourself, to learn from the code of more senior developers). Reading books and articles on coding best practices is sound advice but rather obvious, not adding much value. Learning from open-source projects and coding challenge websites is potentially fantastic advice, but these sources often contain bad code as well, and it still doesn't solve the conundrum of how a beginner can recognize which is which.

Let's try to dig a bit deeper:

πŸ’¬ You said that to find clean code to read and learn from I can look at popular open-source projects, as many of them have high-quality code. But many of open-source projects have low-quality code as well. How can I recognize which open-source project is high-quality and which is not?

πŸ€– You're right that not all open-source projects have high-quality code. To identify high-quality open-source projects, you can consider the following factors:

  1. Popularity: Projects with a large number of stars, forks, or watchers on platforms like GitHub usually indicate that the project is well-regarded by the community. While popularity isn't a guarantee of code quality, it can be a helpful indicator.

  2. Active maintainers and contributors: High-quality projects tend to have active maintainers and a diverse group of contributors. Look for projects with a history of regular commits, updates, and bug fixes. A healthy number of contributors and an active community can be a sign that the codebase is continuously improved and refined.

  3. Clear documentation: Well-documented projects are often a sign of a well-maintained and high-quality codebase. Look for projects with comprehensive README files, API documentation, and usage guides.

  4. Code reviews and discussions: Check the project's pull requests and issue discussions. A healthy project will have thorough code reviews, constructive feedback, and active discussions around improvements and bug fixes.

  5. Adherence to coding standards: High-quality projects usually follow coding standards and best practices for the programming language or framework they use. Look for consistent formatting, naming conventions, and code organization.

  6. Automated testing: Projects with a robust suite of automated tests indicate that the maintainers care about code quality and ensuring the software works as expected. Look for projects with a high test coverage and a continuous integration (CI) pipeline that runs tests on every commit or pull request.

  7. Dependencies and licensing: High-quality projects should have a clear list of dependencies, along with their corresponding licenses. This shows that the maintainers pay attention to the project's legal and operational aspects.

To begin your search for high-quality open-source projects, you can explore curated lists or collections, like Awesome Lists on GitHub, which aggregate popular and well-regarded projects in various domains. You can also check out projects maintained by reputable organizations or developers who are well-known in the industry.

Remember that even high-quality projects may have areas that could be improved. As you gain more experience, you'll develop a better understanding of clean code and be better equipped to assess the quality of various open-source projects.

πŸ€” This answer is decent once again. While factors like project popularity or good documentation don't necessarily guarantee clean code, all of them combined are a decent proxy – probably as good as you can get, since there are never hard guarantees. And the advice to look at curated lists, although they're more of an indicator of popularity rather than necessarily quality, provides a reasonable starting point. It's not exhaustive, as GitHub search, for example, is also a great way to find popular and active open-source projects. But considering that recognizing clean code is a very subjective and difficult topic, this answer is quite ok. We could try to dig even deeper - but I need to keep the length of this post under control...

Commenting your code - clarifying the questionable aspects.

πŸ’¬ One of the lifehacks you gave me was to write meaningful comments to explain the purpose and functionality of my code. Can you elaborate on this? What comments do you consider meaningful? Should I always write comments for all of my code? Is there any good heuristic on when and how to write comments?

πŸ€– Writing meaningful comments is an important aspect of writing clean and maintainable code. Meaningful comments should provide additional insight and context that's not immediately apparent from reading the code itself. Here are some guidelines on when and how to write comments:

  1. Explain complex or non-obvious code: If a piece of code is complex or might be difficult to understand for someone unfamiliar with the project, a comment can help explain the reasoning behind the implementation or provide a high-level overview of the algorithm.

  2. Document assumptions and limitations: If your code relies on specific assumptions or has limitations, it's important to document them in comments. This helps prevent future issues or misunderstandings when someone else (or even you) modifies the code later.

  3. Clarify the purpose of functions and classes: While function and class names should be descriptive, a brief comment can provide additional context on the purpose and expected behavior of a function or class.

  4. Explain workarounds or hacks: If you had to implement a workaround or hack to address a specific issue or limitation, document the reasoning and any potential side effects in a comment. This helps future maintainers understand the purpose of the workaround and consider potential improvements.

  5. Reference external resources: If your code is based on a specific resource, like a research paper, algorithm, or third-party library, include a comment with a reference to that resource. This helps provide context and background information for others working on the project.

Here are some tips on how to write effective comments:

  1. Be concise: Comments should be short and to the point. Avoid writing long paragraphs or repeating information that's already clear from the code.

  2. Keep comments up-to-date: Ensure that your comments stay relevant as your code evolves. Update comments when you modify the code, so they accurately reflect the current state of the code.

  3. Avoid stating the obvious: Refrain from writing comments that simply restate what the code does. Focus on providing context, rationale, or explanations that aren't immediately obvious from the code itself.

You don't need to write comments for every single line or block of code. Instead, focus on commenting where it adds value and helps improve the understanding of the code. Keep in mind that well-written code should be mostly self-explanatory, so prioritize writing clear and expressive code, using comments to supplement when necessary.

πŸ€” This is a really good answer. While the initial tip was ambiguous and left room for interpretation that could potentially lead to over-commenting, this elaboration clarifies it well and is 100% on point. That's exactly how I'd advise approaching writing comments.


There were a few small missteps here and there, but overall the results are surprisingly good.

Some answers were too obvious, some were a matter of opinion, but none of them were plainly wrong and many of them were really good and actionable. I also liked the breadth and variety of advice - it even included a point about taking care of your health!

The initial answers are shallow - they don't bring much value without going at least a few levels deeper through follow-up questions. But if you get used to this flow, it goes quite smoothly. You don't get overwhelmed with loads of information upfront but instead can explore gradually, diving deeper into only the topics you are interested in or don't understand. I'd even say that it resembles working with a real, human mentor more than, for example, reading a book or watching a course.

There's a bit more burden on you when working with ChatGPT compared to a real human mentor. A human can pick up on more cues from your tone of voice, facial expressions, and body language, and can steer the discussion more proactively in response to your behavior. When working with ChatGPT, however, the only cues it can pick up are your direct questions – so the quality of the experience depends solely on your ability to formulate clear questions, not on your mentor's experience or emotional intelligence. That being said, learning how to ask proper questions isn't too difficult, and if you do, you can still get plenty of value from your interaction.

For a beginner, the trickier part may be figuring out what exactly to ask about in order to move from shallow to deeper answers. If you don't have in-depth expertise in a given area, it's often far from obvious. However, this can be mitigated by learning to ask more general "drill-down" questions, like "Why have you chosen this answer?", "Can you elaborate further?", "Is this answer really the best one?", "Is this the only good answer?", "What are the pros and cons?", "What would be the alternatives?", "Are there more similar techniques?", and so on. Getting good at asking questions like these will also benefit you in your day-to-day job: when clarifying requirements, brainstorming with your teammates, or even when working with a real human mentor – so it's a worthwhile training in itself.

To sum it up, from what I can observe from such a limited test, I'd certainly recommend it.

It's not a complete substitute for a real human mentor, but if you don't have access to one, you should definitely try ChatGPT. And even if you do have a mentor, it's still worth leveraging both, as ChatGPT is much more readily available. You can start with ChatGPT (and use it more frequently) and then ask your real mentor to evaluate its answers, expand on them, or delve deeper into trickier areas while sticking to ChatGPT for the more straightforward cases.

It may also be beneficial to start with a high-level overview of what there is to learn in a given area, to understand the overall lay of the land - and then use ChatGPT to dig deeper into selected topics. There are many good resources that provide such an overview, like or my "Definitive Guide to Succeeding as a Professional Dev".

To immediately improve your game, check out also my free PDF: πŸ“– 20 Instant Tips to Rapidly Level Up as a Developer

Top comments (0)