I feel like C#/C++/C are unfairly penalized by this metric Most style guides put the opening and closing curly braces on new lines. That is a pretty hefty amount of the number of lines, but hard...
I feel like C#/C++/C are unfairly penalized by this metric
My first query was to find out what is the uniqueness percentage across all languages. Uniqueness being take all the lines in a file, throw away anything thats a duplicate with the sum that remains being the unique count.
Most style guides put the opening and closing curly braces on new lines. That is a pretty hefty amount of the number of lines, but hard to call "boilerplate" at least as I use the term.
I've really come to dislike the term "boilerplate code". I honestly have come to believe that most of the people who talk about it are greenhorns that don't know why it exists and write terribly...
I've really come to dislike the term "boilerplate code". I honestly have come to believe that most of the people who talk about it are greenhorns that don't know why it exists and write terribly buggy code that someone else has to fix.
To be clear though, I don't get that impression from this author. Now that I think about it, since I got off of reddit and the cesspool that was /r/programming I haven't really seen anyone use the term pejoratively....
I don't think unique lines of code is great for measuring boiler plate. Often boilerplate includes the name of the function, or class, or similar, making it not unique, but still almost copy...
I don't think unique lines of code is great for measuring boiler plate. Often boilerplate includes the name of the function, or class, or similar, making it not unique, but still almost copy paste. Also, is e.g. the try: statement in a try-catch boilerplate? I would say no, but it will be counted by this metric.
Right? I feel like #include <stdio.h> could be considered boilerplate but return(true) should not be. Also some javascript weirdos like to do: if (true) { doSomeFunction(); } That's 75%...
Right? I feel like #include <stdio.h> could be considered boilerplate but return(true) should not be. Also some javascript weirdos like to do:
if (true)
{
doSomeFunction();
}
That's 75% "boilerplate" when it's functionally one unique line so long as doSomeFunction is a unique name.
Judging this based on percentage of LoC is a terrible metric, and I'm not even sure ML tools are capable of knowing the difference.
I feel like C#/C++/C are unfairly penalized by this metric
Most style guides put the opening and closing curly braces on new lines. That is a pretty hefty amount of the number of lines, but hard to call "boilerplate" at least as I use the term.
They explicitly mention not counting closing braces, so maybe...
I've really come to dislike the term "boilerplate code". I honestly have come to believe that most of the people who talk about it are greenhorns that don't know why it exists and write terribly buggy code that someone else has to fix.
To be clear though, I don't get that impression from this author. Now that I think about it, since I got off of reddit and the cesspool that was /r/programming I haven't really seen anyone use the term pejoratively....
I don't think unique lines of code is great for measuring boiler plate. Often boilerplate includes the name of the function, or class, or similar, making it not unique, but still almost copy paste. Also, is e.g. the try: statement in a try-catch boilerplate? I would say no, but it will be counted by this metric.
Right? I feel like
#include <stdio.h>could be considered boilerplate butreturn(true)should not be. Also some javascript weirdos like to do:if (true) { doSomeFunction(); }That's 75% "boilerplate" when it's functionally one unique line so long as
doSomeFunctionis a unique name.Judging this based on percentage of LoC is a terrible metric, and I'm not even sure ML tools are capable of knowing the difference.