Value of reducing code
Reducing amount of code is one of the MOST REQUIRED & IMPORTANT skill in real software development workplace, especially in team based software development.
Most of the case, reducing code is much more valuable than writing code!
Why doesn't any computer science teach this MOST important skill!
Let me point out benefits of reducing code:
- The less code makes programmer be the easy to understand project!
- The amount of code they should read is lesser!
- Fledgling developer easy to understand!
- You don't have to write much test code!
- Complexity should tend to be lower!
- Code duplication tends to be less!
- Prevent regression!
- You can only care about code which really lively works!
Put it all together, These benefits finally leads "Improve code maintainability" and "Reduce maintenance cost".
I mention just in case - reducing code doesn't mean you should merge a few "for loop" lines into single line.
My principles for reducing code are:
- Delete unused code if you think it won't be used or just leave it for reference. The code can be easily pullout if you use version control system.
- Remove duplication and extract abstraction. Too much abstraction is quite bad, so this principle cannot apply in an automatic manner.
- Remove comments unless you have time to maintain them properly. Keep proper comment costs much more than you think and obsolete or meaningless comment leads downcast of project.
Most software developer (maybe including me) show off in a patronizing way about how much they can write code.
And measure value of developer by the amount of code he or she can write.
I think this measurement is completely wrong for team based software development.
Less code makes much more quicker business action possible & reduces maintenance cost.
Return on Code (ROC)
Let me propose new measurement for business efficiency or productivity of software - Return On Code (ROC).
ROC means if lines of code is less and less, the measurement is higher and higher! i.e. your code helps business (=makes money) much more efficiently.
ROC is inspired by Return On Investment (ROI) which represents the benefit to the investor resulting from an investment of some resource.
I think writing code is investment and its artifact (software) makes money. So it's natural to calculate this kind of measurement similar to ROI.
Let's write code with a focus on business rather than just writing code unconsciously!!