4 ms·
> Boilerplate - repeated pattern - helps orient a reader. The more familiar it is, the easier it is to understand. Every layer of abstraction increases the diff
by kscaldef 17y ago
> Boilerplate - repeated pattern - helps orient a reader. The more familiar it is, the easier it is to understand. Every layer of abstraction increases the difficulty in understanding.
I really, really think that there's something about learning imperative languages that breaks our brains in some way. Because, I've heard people argue that
theSum = 0
theArray.each do |n|
theSum += n
end
is easier to read than
theSum = theArray.sum
which seems utterly crazy.
Even worse, I've had people take correct functional-style code and make it "more readable" by expanding it out into a bunch of boilerplate, and fail to notice the typos and logic errors they introduced in the process. People don't actually read boilerplate code; they do a visual pattern match on it. If the pattern is close enough, they accept the code as correct even if there's a small error that they didn't notice.
- 10ren 17y agoYes, exactly right! Have you ever read a book for the nth time, and noticed a typo for the first time? Your point makes me think that Java's boiler-plate + modern IDE's are really onto something. They automatically add the boilerplate for you, so it's there for your to pattern-match on, without having to write it correctly. This helps me understand their extreme popularity.