"Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they’re sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head."
And the more the merrier, for their perceived status, too. As a consultant, I've literally come across project managers, at least in India, who measure their "prestige" by the number of devs "under" them.
It's goes deeper than it should Cars usually ship with small patches of carpet. From Java 8 until 15, Java shipped with a JS interpreter. It was actually the only JSON parser I know of that shipped with Java.
The point of the analogy is that both metrics are, fundamentally, useless. A 787 (unloaded) weighs about 175 tons. Does this mean that putting 175 tons of material at the end of the assembly line corresponds to the complete and proper assembly of a 787? Nope. There are other far more useful measures: does it look right, is it fitted correctly, does it pass QA (testing), is it composed of the correct pieces or just things that resemble them?
In software, LOC is, itself, a useless measure for progress for the same reason: It indicates nothing of value. I have inherited programs in the 10s and 100s of thousands of lines of code that I was able to reduce to less than 20% of their initial size without loss of capability, and generally with improved performance, stability, and maintainability. The right measures are around functionality and the other meaningful qualities (stability, security, testability, etc.).
I thought the Kernighan quote went more along the lines of "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
Anyone have a source on this one way or the other?
It seems yours is the more widely-known phrasing of it, which however was not the original. According to [1], it comes from "The Elements of Programming Style", where it was worded the way it's quoted in the article.
Hmm, I haven't read that book this millennium, but I had thought I first encountered the quote in The Practice of Programming. Which, I mean, I also haven't read this millennium, but when I did read it it was after The Elements of Programming Style. I guess I should check...
It turns out that it is in The Elements of Programming Style, on the second page of Chapter 2, "Expression", in the second edition:
Suppose that you were trying to teach a novice programmer how to count the blanks in a string. How would you do it? Surely not by this elegant but mystifying method [omitted] — instead you would say “Look at each character, and if it's a blank, count it.” Or, in PL/I,
DECLARE TEXT CHARACTER(200) VARYING;
GET LIST (TEXT);
N = 0;
DO I = 1 TO LENGTH(TEXT);
IF SUBSTR(TEXT, I, 1) = ’ ’ THEN
N = N + 1;
END;
PUT LIST (N);
This too uses the built-in functions PL/I provides, but it uses them in a way that clarifies the method of solution, rather than obscuring it. Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?
I think this is, if anything, truer now than it was in 01978 when the book was published, even if not many of us have to deal with PL/I nowadays—thanks, in significant part, to Kernighan's efforts. And it's probably thanks in part to reading this book that today I would more likely write that as
sum(1 if c == ' ' else 0 for c in text)
or
sum(1 for c in text if c == ' ')
or
(loop for c across text if (eq c #\space) sum 1)
rather than
sum(c == ' ' for c in text)
which also works.
Being too clever is what almost always trips me up in Forth. It's not so much the stack-effect bugs or the type
errors themselves, although of course those require more
care to avoid than in C; it's the constant temptation to
bum the code down to something smaller and simpler by, for example, keeping more crap on the stack.
Kernighan probably never said the version with "by definition"; he tends to be pretty careful not to misuse logical terminology in order to add rhetorical punch to a point.
writing code as cleverly as possible doesn't imply it's at the developers limit of understanding--just that the code cannot be expressed more cleverly.
Asking the question, how will you ever debug it, causes the developer pause and hopefully realize there will be a learning curve when maintenance dues come.
I guess I disagree with the conclusion of your flavor of the quote.
Clicked the link expecting to see something by Larry Wall, was not disappointed.
One of the things I loved about learning Perl was his many quips of humor and wisdom sprinkled throughout the “camel” books, particularly The Perl Cookbook, which is still on my bookshelf to this day.
His humor was unbeatable in quality, quantity (sometimes multiple jokes per page) and sometimes even subtlety, not to mention unexpectedness (which is a key criterion of a joke being funny).
Sample: From a Perl FAQ, IIRC (there are many):
Q: Is Perl (ANSI) certified?
Larry: A: I'll be certified before Perl is!
"Mostly, when you see programmers, they aren't doing anything. One of the attractive things about programmers is that you cannot tell whether or not they are working simply by looking at them. Very often they’re sitting there seemingly drinking coffee and gossiping, or just staring into space. What the programmer is trying to do is get a handle on all the individual and unrelated ideas that are scampering around in his head."
-- Charles M Strauss
And the more the merrier, for their perceived status, too. As a consultant, I've literally come across project managers, at least in India, who measure their "prestige" by the number of devs "under" them.
I'll show it to her and see if it helps
-- Stan Kelly-Bootle
https://github.com/travisjungroth/Compromise
Introduced in this short 2016 talk https://youtu.be/yC9m2GInXqU?t=337
It's goes deeper than it should Cars usually ship with small patches of carpet. From Java 8 until 15, Java shipped with a JS interpreter. It was actually the only JSON parser I know of that shipped with Java.
Liked your feed. Followed.
"Software ended up saving the Defense Aerospace industry. It was the only way of adding cost that didn't also add weight."
In software, LOC is, itself, a useless measure for progress for the same reason: It indicates nothing of value. I have inherited programs in the 10s and 100s of thousands of lines of code that I was able to reduce to less than 20% of their initial size without loss of capability, and generally with improved performance, stability, and maintainability. The right measures are around functionality and the other meaningful qualities (stability, security, testability, etc.).
I heard it as the much funnier "LSD and BSD."
Anyone have a source on this one way or the other?
[1]: <https://github.com/dwmkerr/hacker-laws#kernighans-law>
It turns out that it is in The Elements of Programming Style, on the second page of Chapter 2, "Expression", in the second edition:
Suppose that you were trying to teach a novice programmer how to count the blanks in a string. How would you do it? Surely not by this elegant but mystifying method [omitted] — instead you would say “Look at each character, and if it's a blank, count it.” Or, in PL/I,
This too uses the built-in functions PL/I provides, but it uses them in a way that clarifies the method of solution, rather than obscuring it. Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?I think this is, if anything, truer now than it was in 01978 when the book was published, even if not many of us have to deal with PL/I nowadays—thanks, in significant part, to Kernighan's efforts. And it's probably thanks in part to reading this book that today I would more likely write that as
or or rather than which also works.Being too clever is what almost always trips me up in Forth. It's not so much the stack-effect bugs or the type errors themselves, although of course those require more care to avoid than in C; it's the constant temptation to bum the code down to something smaller and simpler by, for example, keeping more crap on the stack.
I think I did manage to use Forth effectively and avoid being so clever in, for example, https://dercuano.github.io/notes/forth-assembling.html#addto....
Asking the question, how will you ever debug it, causes the developer pause and hopefully realize there will be a learning curve when maintenance dues come.
I guess I disagree with the conclusion of your flavor of the quote.
One of the things I loved about learning Perl was his many quips of humor and wisdom sprinkled throughout the “camel” books, particularly The Perl Cookbook, which is still on my bookshelf to this day.
His humor was unbeatable in quality, quantity (sometimes multiple jokes per page) and sometimes even subtlety, not to mention unexpectedness (which is a key criterion of a joke being funny).
Sample: From a Perl FAQ, IIRC (there are many):
Q: Is Perl (ANSI) certified? Larry: A: I'll be certified before Perl is!