Martin Flower once said:
Any fool can write code that computer can understand. Good Programmers can write code that human can understand!
This is so true, I have been doing code review of my team quite often from last 3-4 years and released some good facts about ‘source code’ in general. Here are quick facts:
- I did reviewed .NET, Java, Android and iOS code and fundamentals of good code remains same despite of programming language!
- Big misconception, if your code produced less result means it is great code, it can be good but not great for sure!
- Another misconception, I have well commented code, means great code! Code is never judged based on no of comments but on ‘meaningful comments’!
- Yet another misconception! I analysed my code using static analysis tools like ‘Resharper’ no issues and my code is great; well this is again one part and does not means you are good to go!
So what’s really good code is? And what it should have to make it great?
- Which Runs without error
- Get task done
- No errors, less bugs while testing
- Getting tasks done effectively
- Commented, Indented and Documented
- Follows coding standards
- All what good code does
- Get tasks done for Now and for Future, means highly scalabile
- Highly reusable for other similar projects
- Well structured and well architect
- Follows Design Patterns
- Nicely documented so even can understand it clearly
Performance is also one of the major factor, Good code runs effectively but requires more resources but great code runs will less resources so system performance is really great.