Hacker News new | ask | show | jobs
by lambda 4185 days ago
Number of lines of code can be used as a (very) rough metric for complexity; expressing the same application in more lines of code may mean that the new implementation is a bit more complex, harder to work with, more to review, etc.

Of course, this is quite a rough metric; some languages are much denser per line (like APL/J/K and others in that family), so it's definitely not an absolute rule. But it can be interesting to compare a direct port of a reasonably complicated application from one language to another, to see how the abstractions in each language hold up; just like it can be interesting to compare the speed when porting from one language to another, even though there are plenty of caveats there too.

2 comments

Lines of code is a pretty poor measure of anything except lines of code. More lines could be more clear or less clear. Unless we're talking an order of magnitude, which seems unlikely.
> Number of lines of code can be used as a (very) rough metric for complexity

When the code is a port and represents 1:1 functionally, then line of code is totally irrelevant, except for it's performance to execute (which clearly GoLang has demonstrated in this case to outperform ruby). A better "rough metric" for complexity is the number of functions or as Ruby Flog puts it - ABC metric: Assignments, Branches, Calls.[0]

[0] - http://ruby.sadi.st/Flog.html