What is good code? and what attributes do you think an ideal software developer demonstrates?

I was asked those questions recently and the following is my answer:

What is good code?

Good code has at least the following characteristics:

  • Good code has good readability, so it is easy to understand.

    • Good code is well organized, a clear and reasonable directory structure with meaningful filename is the basic element of good code.
    • Every class, method, variable has a deliberate and meaningful name. You can know the purpose of an identifier through the name at first glance.
    • Methods should be short, every method should only do one thing.
    • Good code does not use magic numbers and hard coded strings.
  • Good code has automated tests, so it is easy to maintain or change.

  • Good code has a good architecture, so its components can easily be replaced by another.

  • Good code has explicit dependencies.

  • Good code has good performance.

    • It does not do database queries or other time-consuming jobs in a loop.
  • It should use a queue for certain situations

  • It should use a full-text search engine instead of the 'LIKE' query on the database.

  • If part of the code is really complex, a carefully written comment would be helpful. By the way, do not forget to update the comment when you change the code later.

  • Good code is highly cohesive and low coupling. Components should be well defined, that is, they are self-contained with one and only one purpose. Each component should know as little as possible about another component.

  • Good code is modular. The Business logic (the controller) should be separated from the data storage layer (the model), while the view layer should be separated from the controller layer.

What attributes do you think an ideal software developer demonstrates?

  • They should always have enthusiasm for programming, which means that they programming not only at work.
  • They should know Linux or macOS well. I mean they should know the command line well.
  • They care about the user experience.
  • They are responsible and willing to do their best to meet the deadline.
  • They are knowledgeable, I mean they know not only programming, they have wide knowledge in various fields.
  • They love sharing and teaching, or mentoring. I mean they are kind to newbies.

What do you believe is the difference in behaviours and skills between a Senior Software Engineer and an Intermediate Software Engineer?

  • A senior engineer not only knows how to code or how to implement a feature but also knows how to code in a better way. They not only implement a feature, they help refine the feature. I mean they do extra work to make the feature better.
  • Senior engineers know how to plan, separate big tasks into smaller ones, and can recognize which task has the higher priority.
  • Senior engineers not only program, they help other engineers grow up. They do mentoring, tutoring, or teaching in a team.
  • Senior engineers are people beyond the bounds of skillset. They could be a potential leader, or just a leader without a title.

Comments

  1. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.