DEV Community

Discussion on: How would you define high quality code?

Collapse
 
jeikabu profile image
jeikabu

Definition:

  • More theoretical ideal; perfection is not attainable
  • "Good" implies partially subjective
  • Not binary.; there are many states in-between
  • Not absolute; varies over time

Attributes:

  • Well designed without being over-engineered
  • State of the art, but not obscure or overtly clever
  • Documented, but no superfluous comments
  • Reviewed and refactored within time-constraints
  • Optimal in time and space while avoiding premature optimization
  • Meets business/technical requirements and common sense
  • Leverages tools of the trade (testing, static analysis, etc.) if/when appropriate
  • Maintainable and extendable in accord to its purpose

It's like art vs obscenity; I know it when I see it.

Collapse
 
juliatorrejon profile image
Julia Torrejón
  • Reviewed and refactored within time-constraints

So, what would be the optimal time? Or is it somehow subjective depending on the circumstances?

Collapse
 
jeikabu profile image
jeikabu • Edited

It's subjective and variable depending on the circumstances:

  • Skill and experience of the author (I tend to gloss over PRs by people that do consistently good work)
  • Difficulty/importance of changes
  • ROI for additional time spent etc.

There's an implicit assumption that you can't spend "forever" on a piece of code; at some point it's got to be "good enough" so you can move on. It's also subject to diminishing returns.