Yuriy Tumakha's user avatar
Yuriy Tumakha's user avatar
Yuriy Tumakha's user avatar
Yuriy Tumakha
  • Member for 4 years, 8 months
  • Last seen more than a month ago
About

What Good Coding Looks Like

Correct: The code should operate correctly on all expected and unexpected inputs.

Efficient: The code should operate as efficiently as possible in terms of both time and space. This "efficiency" includes both the asymptotic (big 0) efficiency and the practical, real-life efficiency. That is, a constant factor might get dropped when you compute the big 0 time, but in real life, it can very much matter.

Simple: If you can do something in 10 lines instead of 100, you should. Code should be as quick as possible for a developer to write.

Readable: A different developer should be able to read your code and understand what it does and how it does it. Readable code has comments where necessary, but it implements things in an easily understandable way. That means that your fancy code that does a bunch of complex bit shifting is not necessarily good code.

Maintainable: Code should be reasonably adaptable to changes during the life cycle of a product and should be easy to maintain by other developers, as well as the initial developer.

Striving for these aspects requires a balancing act. For example, it's often advisable to sacrifice some degree of efficiency to make code more maintainable, and vice versa.

(c) Cracking the Coding Interview, by Gayle Laakmann McDowell

Badges
This user doesn’t have any gold badges yet.
This user doesn’t have any silver badges yet.
1
bronze badge
Posts

This user hasn’t posted yet.