In my workplace, the client is obsessed with line-by-line code reuse. And they use a tool that uses LoC as measure of code re-usability.Often for two modules, if the logic is same as of now, those modules call the same method. Which reduces no. of lines, but seems like a long-term manageability disaster.Are my concerns valid? Or I'm missing something here?Not a duplicate of this question, I am worried about plain LoC based measure. I understand breaking it down to smaller component, but it's not that.
How useful is line-by-line code re-use?
project management;source code;code reuse
Code reuse and Lines of Code (LoC) counting are different obsessions.Both are things to be sensitive to.  Neither should be the primary concern.Good names, readability, semantics, organization, abstraction. I'll take any one of those over these other two.Code reuse is very good to apply when you find yourself branching every possible case into it's own section of nearly identical code. Separate what varies from what stays the same. Stuff decisions into variables. Code reuse isn't so good if every time you write a line of code you're required to search the code base to be sure there isn't an identical line some where else. Code reuse is much more a conceptual thing than a mechanical thing. I would be wary of tools that tried to do this work for me.Lines of code is a bottom-of-the-barrel concern. You can do a few good things trying to keep lines of code down. You can do horrible things trying to keep them up. Again this is ignoring the experience of reading the code and focusing on a mechanical aspect. Just prefer adding features to lines of code and you should find yourself keeping methods and classes small.In short rather then run a tool, I'd much rather do a code review by grabbing a fellow coder for 5 minutes and see for myself how much of what I wrote is understandable.