Home 10 Tips for Writing Quality Code

10 Tips for Writing Quality Code

James Schorr, the owner of Tech Rescue has a guest post on the Ruby Learning blog where he asks “Do You Enjoy Your Code Quality?” He makes a strong argument for treating programming as craftsmanship writing that the goal of his article is to help people improve code quality and “transform the mundane into the beautiful.”

Schorr offers a number of tips for pre- through post-development of projects, and while some of his points may be geared towards independent consultants and independent developers, they’re pretty applicable to anyone:

Pre-Development

  • Gather all the requirements from clients up front. Schorr recommends thinking of these in terms of “stories” as “it’s more in line with how the non-developer thinks.”
  • Clarify what is necessary and what’s just “nice-to-have.”
  • Refuse to reproduce lousy code. In other words, turn down work if you’re going to be asked to reproduce a poorly designed system – unless you are being given the freedom to do it right. (This begs the question, of course: How do you define “lousy code”?)
  • Reject unrealistic timelines

Development

  • Out-engineer user-error as much as possible. “In other words,” writes Schorr, “never trust that the user will do what you expect, especially when entering data.”
  • Be open to including other languages and technologies where appropriate.
  • Don’t reinvent the wheel.

Post-Development

  • Review your code for speed, stability, security, and usability.
  • Have non-technical people do real-world testing on your product.
  • Revisit old code periodically and see what you would’ve done differently.

How do you achieve quality programming? What makes a bit of code into something like Schorr describes as “craftsmanship”?

About ReadWrite’s Editorial Process

The ReadWrite Editorial policy involves closely monitoring the tech industry for major developments, new product launches, AI breakthroughs, video game releases and other newsworthy events. Editors assign relevant stories to staff writers or freelance contributors with expertise in each particular topic area. Before publication, articles go through a rigorous round of editing for accuracy, clarity, and to ensure adherence to ReadWrite's style guidelines.

Get the biggest tech headlines of the day delivered to your inbox

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.

    Tech News

    Explore the latest in tech with our Tech News. We cut through the noise for concise, relevant updates, keeping you informed about the rapidly evolving tech landscape with curated content that separates signal from noise.

    In-Depth Tech Stories

    Explore tech impact in In-Depth Stories. Narrative data journalism offers comprehensive analyses, revealing stories behind data. Understand industry trends for a deeper perspective on tech's intricate relationships with society.

    Expert Reviews

    Empower decisions with Expert Reviews, merging industry expertise and insightful analysis. Delve into tech intricacies, get the best deals, and stay ahead with our trustworthy guide to navigating the ever-changing tech market.