The Dos and Don’ts of Coding with ChatGPT 4

Insider Engineering
Insider Engineering
6 min readFeb 7, 2024

Insights from Recent Inquiries

In the fast-evolving tech landscape, staying abreast of best practices in coding is crucial for developers. Reflecting on the questions we have asked over the last month, I’ve compiled a set of dos and don’ts that encapsulate the collective wisdom sought by and shared with peers. These guidelines can help refine your coding practices. I know that you wonder what we have asked, but you know, it’s the secret we never tell.

Do: Follow Coding Standards and Conventions

  • Do adhere to language-specific conventions. Consistency in coding style enhances readability and maintainability. Whether it’s JavaScript’s camelCase or Python’s PEP 8, sticking to these conventions makes your code more approachable to others in the community.
  • Do comment on your code judiciously. Effective commenting explains the “why” behind the code, not just the “how.” It’s particularly important for complex algorithms or where the code’s purpose might not be immediately apparent.

Don’t: Neglect the Basics

  • Don’t reinvent the wheel. Before implementing a custom solution, explore existing libraries and frameworks. Many common problems have well-tested solutions that can save you time and effort.
  • Don’t ignore error handling. Graceful error handling is not just about catching exceptions but also about foreseeing potential failures and mitigating their impact on the user experience.

Do: Embrace Best Practices for Debugging and Testing

  • Do use version control systems. Tools like Git not only facilitate code sharing and collaboration but also serve as a safety net, allowing you to revert to earlier versions if something goes wrong.
  • Do write tests. Automated tests, be they unit, integration, or end-to-end, are invaluable for ensuring your code behaves as expected and for catching regressions early in the development cycle.

Don’t: Overlook Performance and Security

  • Don’t ignore performance implications. Optimize for efficiency, but avoid premature optimization. Focus on readable and maintainable code first, then optimize bottlenecks as they become evident.
  • Don’t skimp on security. Security considerations should be integral to the coding process. Validate inputs, sanitize outputs, and follow secure coding practices to protect against common vulnerabilities like SQL injection or cross-site scripting (XSS).

Do: Prioritize Readability and Maintainability

  • Do refactor for clarity. Refactoring isn’t just about improving performance or fixing bugs. It’s also about making your code cleaner and more understandable. If a piece of code is becoming too complex, consider breaking it down into more manageable functions or modules.

Don’t: Forget the Human Element

  • Don’t work in isolation. Coding is often a collaborative effort. Engage with the community, seek feedback, and be open to constructive criticism. Pair programming, code reviews, and mentorship are just a few ways to learn from others and improve your craft.
  • Don’t neglect soft skills. Effective communication, empathy, building trust, and problem-solving are just as important as technical prowess. They enable you to work effectively in teams, understand user needs, and contribute to a positive work environment.

A Constructive Guide Based on Common Inquiries

In the realm of software development, certain questions and challenges frequently arise. Reflecting on these recurring themes provides valuable insights into best practices to adopt and pitfalls to avoid. Here’s a comprehensive guide derived from the types of questions developers commonly ask.

Do: Pay Attention to Code Quality

  • Do write clean and readable code. Prioritize clarity and simplicity. Use meaningful variable names, follow your language’s style guide, and implement clear and concise logic.
  • Do refactor your code when necessary. Keep your codebase maintainable by regularly refactoring to improve readability, reduce complexity, and enhance performance.

Don’t: Ignore Debugging and Testing

  • Don’t underestimate the importance of debugging. Develop a systematic approach to debugging that allows you to efficiently identify and resolve issues.
  • Don’t skip on testing. Implement a comprehensive testing strategy, including unit, integration, and end-to-end tests, to ensure your application works as intended.

Do: Embrace Modern Development Practices

  • Do use version control systems like Git. Track changes, collaborate with others, and manage your code effectively.
  • Do automate your workflows. Utilize continuous integration and continuous deployment (CI/CD) pipelines to automate testing and deployment, improving efficiency and reliability.
  • Do keep learning. The tech field is constantly changing, with new languages, tools, and best practices emerging all the time. Stay curious and open to learning to keep your skills sharp and relevant.

Don’t: Neglect Security and Performance

  • Don’t overlook security best practices. Implement secure coding practices to protect your applications from vulnerabilities and attacks.
  • Don’t ignore performance optimization. Optimize your code for performance from the start, but also avoid premature optimization. Focus on bottlenecks and critical paths that impact your application’s efficiency.

Do: Stay Informed and Continuously Learn

  • Do keep up with new technologies and methodologies. The tech field is constantly evolving. Staying informed about the latest trends and best practices can inspire innovative solutions and improve your skills.
  • Do invest time in learning and professional development. Whether through formal education, online courses, or practical projects, continuous learning is key to advancing your career.

Don’t: Work in Isolation

  • Don’t hesitate to ask for help or feedback. Collaborate with peers, participate in code reviews, and engage in community discussions to gain new perspectives and insights.
  • Don’t ignore the value of soft skills. Communication, teamwork, building trust and problem-solving are crucial for successful software development projects. Focus on developing these skills alongside your technical abilities.

Leveraging Collective Wisdom

Building on the foundational dos and don’ts, let’s delve deeper into practices that foster excellence in software development. These insights, while generalized, are inspired by typical inquiries and discussions within the coding community.

Do: Optimize Your Development Environment

  • Do tailor your IDE (Integrated Development Environment) to your needs. A well-configured IDE can significantly boost your productivity. Utilize plugins and shortcuts that align with your workflow and the languages you use.
  • Do embrace the power of linters and formatters. These tools enforce coding standards and styles automatically, helping you avoid common errors and maintain consistency across your codebase.

Don’t: Disregard the Importance of Project Structure

  • Don’t overlook project structure. A clear, logical structure is crucial for scalable and maintainable projects. It ensures that your codebase is organized and that individual components are easily navigable and understandable.
  • Don’t clutter your repository. Keep your project repository clean and organized. Use .gitignore to exclude temporary files, dependencies, or build artifacts that don’t need to be version controlled. Use online or IDE tools to quickly create .gitignore files tailored to your needs.

Do: Prioritize User Experience and Accessibility

  • Do design with the end-user in mind. User experience (UX) should guide your development process, from the UI design to the system’s responsiveness and error messaging.
  • Do make accessibility a priority. Ensure that your applications are accessible to users with disabilities. This not only expands your user base but also aligns with inclusive design principles.

Don’t: Underestimate the Value of Documentation

  • Don’t leave your code undocumented. Comprehensive documentation, including READMEs, API docs, and inline comments, is invaluable for both your future self and others who may work on the code.
  • Don’t write documentation as an afterthought. Integrate documentation into your development process. Well-documented code is easier to debug, extend, and use.

Do: Foster a Culture of Collaboration and Feedback

  • Do participate in code reviews. Code reviews are not just for catching bugs; they’re also opportunities for learning and sharing knowledge. Approach them with an open mind and a constructive attitude.
  • Do embrace continuous integration/continuous deployment (CI/CD). Automate your testing and deployment processes to reduce manual errors, streamline your workflows, and ensure that your product is always in a deployable state.

Don’t: Stop Learning and Experimenting

  • Don’t become complacent with your current knowledge. Technology evolves rapidly, and staying informed about new tools, languages, and methodologies is crucial for your development as a coder.
  • Don’t be afraid to experiment. Trying out new technologies or approaches can lead to innovative solutions and personal growth. Use side projects as a safe space for experimentation and learning.

Closure or Conclusion

I can almost hear you saying, “What is this? S/he keeps repeating the same things. This is nonsense. Why did I read this far?”. The best way to learn is to repeat. If I can make you repeat similar things in different ways and get you to the end of this article, it means you have learned something. As we end, here is what you have learned from this article in a nutshell;

  • Embrace Best Practices
  • Leverage Existing Solutions
  • Prioritize Security and Performance
  • Adopt a Testing Mindset
  • Continuously Learn and Adapt
  • Foster Collaboration
  • Document Thoroughly

— — — — — — — — — — — — — — — — — — — — — — — — — — — — -

Hope you liked this article. If you have any questions, feel free to ask away in the comments. You can also follow our Insider Engineering Blog and Insider Engineering Twitter for more about us, where we share our engineering teams' updates and processes. Here is a starter for you to check out!

My CheatSheet I Derived While Preparing for the AWS Solution Architect Associate Exam — Part I written by Aziza Kasenova.

--

--