[HN Gopher] Why do we call it "boilerplate code?" ___________________________________________________________________ Why do we call it "boilerplate code?" Author : goranmoomin Score : 317 points Date : 2022-11-15 13:29 UTC (9 hours ago) (HTM) web link (buttondown.email) (TXT) w3m dump (buttondown.email) | computomatic wrote: | Interesting history, for sure! | | That said, I can't help but feel like this one premise is | unsubstantiated. | | > But where does it get the meaning of being "uncreative" copy- | paste code? | | I've never heard of boilerplate being described in quite those | terms. | | In my experience, boilerplate is frowned upon for exactly one | reason: we tend to type it out manually despite the fact that it | never differs. That's something that coders know should be | automated, and it's a waste of energy when it's not. The exact | same problem linotype and boilerplate molds solved. | | Perhaps I'm simply missing the point and splitting hairs. | ozim wrote: | I always see boilerplate in connection with code generators or | creators that will create boilerplate code that one can adjust. | | Some people nag they write boilerplate code but for me it seems | they never found ways to automate it or simply copy paste. | Agent766 wrote: | As an aside, check out the 30 minute documentary "Farewell Etaoin | Shrdlu" (https://www.youtube.com/watch?v=1MGjFKs9bnU) about the | end of the linotype era. I'm amazed at the engineering that went | into linotype printing. | Taniwha wrote: | I worked in a hot-metal news room (with lino-types) take the | parent article with a grain of salt - it really worked like | this: | | 1) Linotype machine contains positive type molds, it assembles | them into lines and mechanically left/right justifies them | | 2) Lino machine pours liquid metal into the line of type to | make a negative image (mirror writing) | | 3) Lino operator runs in k roller over finished article's type | and prints a quick copy | | 4) Copy is sent to readers/copy holders who check the | spelling/grammar | | 5) Lino operator fixes bad lines | | 6) backwards type articles is sent to subeditors who lay out | pages (using fixed type for headlines and including photos) | | 7) a papermache-like substrate is heat pressed on to the flat | page producing a positive image | | 8) the substrate is bent into a half cylinder and a negative | version is cast in to metal | | 9) the half cylinder is bolted to the main press along with the | half cylinder for the facing page | | 10) the press rolls making positive images and collating all | the papers from the different rollers into newpapers | | So for the record | positive->negative->positive->negative->positive to make a hot | metal paper | mabbo wrote: | I was worried that this would be an article about how boilerplate | is never just boilerplate, how it's actually quite important and | we shouldn't consider it so lowly. And that's fine. That's a | good, valid opinion. | | Fortunately, we are instead blessed with an etymology post, which | is _far_ more delightful to read, in my opinion. | effnorwood wrote: | andix wrote: | Interesting post. But much more important question: Why is | boilerplate code still a thing? Either create a library or a code | generator. The difference of a code generator is, that you don't | edit the generated code, just the parameters of the generator. | Boilerplate code or scaffolding is just a nice word for ,,copy | and paste with slight modifications" | stevage wrote: | The article somehow jumps from defining boiler plate (the metal) | to its use as slang in printing. Is there a bit missing? | deafpolygon wrote: | It's the nameplate, not the actual boiler plate itself that gets | affixed to every boiler. It was eventually required by law, but | most manufacturers were already doing it. | | This is where the term comes from in printing (the boilerplate | was the required details for every page that didn't get changed). | | Then the same was used in code (we used the printing concept of | 'boilerplate'), the required element for code in order to get | started with a project. | mewse-hn wrote: | Hilarious the computer programmers in here who know the _actual_ | etymology of the term like they were around 100 years ago when | the term spread from printing presses to the legal field | v3ss0n wrote: | What a coincidence, I was just thinking about it this morning, | but too lazy to Google. NOW this shows up on HN and it's not on | Facebook. | | What trickery is that? | artificialLimbs wrote: | Hivemind is the meme terminology. | | You might look up Jung's 'sychronicity'. | dsr_ wrote: | The once-popular HTML editor HoTMetaL was named after a different | part of that process, once someone noted that the letters lined | up nicely. | Eumenes wrote: | I read a book on the American Civil War and the term | 'boilerplate' was used often to describe how the Confederate Navy | would reinforce barges and steamboats with boilerplate to convert | them into military vessels. It was also used to construct an | early submarine: | https://www.history.navy.mil/research/underwater-archaeology... | js8 wrote: | ..and later, armies of lawyers were reinforcing their contracts | with boilerplate. | millzlane wrote: | Ahhh one of those Iron-Clad Contracts. | simonh wrote: | But in that case they were literally using actual boiler plate, | it wasn't a euphemism, as in the linked article the submarine | was constructed out of boiler plate. | bell-cot wrote: | Why: Making any sort of thick, strong plate metal is | seriously non-trivial, both in terms of the manufacturing | facility required, and the metallurgical expertise to | actually do it. The CSA had very little heavy industry | compared to the Union. Boiler plate (widely used, in a steam- | powered world) would be about the only armor-ish product that | the CSA could manufacture for itself. (Similar for hull | plates for a submarine - though boiler plate is far closer to | the ideal material there.) | Eumenes wrote: | Now I'm curious how boiler plate is made. Can't find much - | its all code stuff per google search. Seems like its just | hot rolled steel plate to a certain thickness. | bell-cot wrote: | IANAM (...Not A Metallurgist), but this looks | plausible...(if extremely simplified): | | https://steelplates.in/how-to-manufacture-steel-plates- | sheet... | | From vague memory, the two huge issues for armor plate | (especially ~150 years ago) are: | | - Having the extremely heavy equipment needed to roll | very thick plates. ~Nothing except warship armor was | anything resembling that thick, for such equipment to | even have been developed previously. | | - The specialized metallurgy & treatments needed to make | "hard" armor. Iron/steel plate for other purposes | (boilers, etc.) was optimized for physical properties | which bore very little resemblance to "resistant to | penetration by high velocity cannon balls". | nine_k wrote: | Well, etymology is fun, but look, the post describes an early | mechanism for inclusion of laid-out third-party content into a | page! It's like having #include or <iframe> on a newspaper page | from 1900. | Eleison23 wrote: | Let's just put this in real-world terms we all can understand | here. If I sign up to an MMORPG and I'm outfitting my Paladin, | should I choose the "boiler plate mail"? Does a space matter? | hprotagonist wrote: | Relatedly, see the etymology for "stereotype" and "cliche": | | https://www.etymonline.com/word/stereotype | | _1798, "method of printing from a plate," from French stereotype | (adj.) "printed by means of a solid plate of type," from Greek | stereos "solid" (see stereo-) + French type "type" (see type | (n.)). Meaning "a stereotype plate" is from 1817. Meaning "image | perpetuated without change" is first recorded 1850, from the verb | in this sense._ | | https://www.etymonline.com/word/cliche | | _1825, "electrotype, stereotype," from French cliche, a | technical word in printer's jargon for "stereotype block," noun | use of past participle of clicher "to click" (18c.), supposedly | echoic of the sound of a mold striking metal (compare native | click)._ | Sharlin wrote: | Indeed it may be surprising that "stereo sound" (and later | analogues like "stereo vision") have nothing, etymologically, | to do with having two channels; it was essentially introduced | as a marketing term referring to the more "solid" or tangible | sensory quality compared to single-channel sound. | jacobsimon wrote: | I think stereo vision predates the usage in sound, and refers | more to the 3D depth perception of shapes that it allows. | Stereography was invented sometime in the mid 1800s [1]. | Stereo sound similarly is meant to give a more realistic | perception of sound in space compared to mono. | | 1. https://www.smithsonianmag.com/innovation/sterographs- | origin... | Sharlin wrote: | Oops, very good point. I forgot that stereograms were a | thing already in the 1800s (being indeed a rather obvious | application of photography). | nordsieck wrote: | I think the explanation of stereotype needs a bit of | explanation to make sense. | | In early printing, a plate would be assembled from individual | letters of type before it was used for printing. However, it | quickly became apparent that certain words or phrases were used | a lot, so typesetters would create "a solid plate of type" for | those words or phrases to speed up the typesetting process. | kragen wrote: | no, this is talking about a solid page-sized plate of type, | not phrase-sized plate of type | | before the stereotype process, you printed from the | individual letters of type, as people still do today for | flyers | | https://en.wikipedia.org/wiki/Stereotype_%28printing%29 | https://en.wikipedia.org/wiki/Letterpress_printing | alricb wrote: | Nah, I think it refers to the fact that popular printing | items, like the Bible or popular books that stayed in print | more or less indefinitely would be stereotyped, that is an | imprint of the pages would be taken, then a used as a mold to | cast a plate that could be used while the type slugs could be | re-used for something else. | | A large part of the printing business was to print fill-in- | the-blank business stationary, like orders, invoices, etc. | | So a stereotype came to mean a standard form that you could | adapt to whatever context by just changing a few details. | nicioan wrote: | nit: type actually originates from the Greek word tupos | https://en.m.wiktionary.org/wiki/tupos (Google definition's | origin based on oxford dict also confirms that). | weitzj wrote: | I had a really dumb look on my face when I realized what a | firmware is: | | hardware - firmware - software | IIAOPSW wrote: | I've been assuming it has to do with a boiler room operation. You | know. The sort of dodgy business posing as a whole team with an | office based out of a prestigious locale, but its actually just | one guy renting out the basement boiler room so he can use that | address without technically lying. He sends the same form letter | (possibly a scam) to thousands of potential "clients" per day, | changing only the name but keeping it worded as if the addressee | was the special object of consideration. | butterNaN wrote: | > Now that Twitter is on a downward spiral I'm rewriting my | favorite tweetstorms in a more permanent medium, | | This is much welcomed! Too many interesting things I missed | because they were presented in a fragmented series of thoughts on | twitter. I would just never open those links because the | experience was jarring. If twitter chaos means people joining the | article writers crowd, what a gain! | scarecrowbob wrote: | This might be an interesting sidebar: | https://en.wikipedia.org/wiki/Boilerplate_(spaceflight) | | The origin of the term in spaceflight (according to the wiki, at | least) is that they were literally constructing full-size / full- | weight mock ups of capsules from steel: | | "The term boilerplate originated from the use of boilerplate | steel[3] for the construction of test articles/mock-ups. | Historically, during the development of the Little Joe series of | 7 launch vehicles, there was only one actual boilerplate capsule | and it was called such since its conical section was made of | steel at the Norfolk Naval Shipyard. This capsule was used in a | beach abort test, and then subsequently used in the LJ1A flight. | However, the term subsequently came to be used for all the | prototype capsules (which in their own right were nearly as | complicated as the orbital capsules). This usage was technically | incorrect, as those other capsules were not made of boilerplate, | but the boilerplate term had effectively been | genericized.[citation needed]" | ecolonsmak wrote: | In the 19th century, a boilerplate referred to a plate of steel | used as a template in the construction of steam boilers. These | standardized metal plates reminded editors of the often trite and | unoriginal work that ad writers and others sometimes submitted | for publication. | Zigurd wrote: | Without further research, my impression of where that term | originated was in drafting contracts: The parts, like | confidentiality, that are standardized and a component of most | contracts, are the "boilerplate," in contrast with the parts, | like a statement of work, that are specific to a particular | contract. Did it jump from writing, in general, to legal | contract drafting? | larrik wrote: | I think "boilerplate code" came from the legal term, but the | article dives deeper to figure out where the legal system got | it in the first place. | ConnorCallahan wrote: | Why is twitter in a downward spiral? | Moctogo wrote: | It really is not. If anything, the experience has improved in | the last couple of days. There seems to be a surprisingly big | subset of the population that hates Elon Musk and thinks he can | do no good. It as if they want Twitter to fail just so they can | be vindicated. | carvking wrote: | And they keep calling him stupid. It is actually quite | entertaining. | bell-cot wrote: | My quick take - think of mid-nineteenth-century foundries and | machine shops. Generally very small-scale, ~zero automation, no | mass production. Almost every non-trivial thing (say, a little | steam engine) that they made would involve a lot of castings, | followed by a whole lot of steps where skilled machinists would | cut, turn (on a lathe), drill, polish, rivet, etc. the castings, | to make the finished product. | | In that context, making metal plates for (steam) boilers would be | one of the dullest and most repetitive work sorts of work that | they'd do. | asmithmd1 wrote: | Being a mechanical engineer by training, I always assumed it had | come from the requirement that all boilers must have a nameplate | affixed with a bunch of not really useful information about how | it was tested. The hot water heater in your house has a boiler | nameplate, and nuclear power plants have a "nameplate" rated | capacity: | | https://www.nei.org/resources/statistics/us-nuclear-plant-ow... | thescriptkiddie wrote: | I had always assumed that it referred to the practice of making | mock-ups or stand-ins out of cheap steel in the aerospace | industry. | | https://afspacemuseum.org/artifacts/apollo-boilerplate-capsu... | pvg wrote: | Regulation requiring these is newer than the term 'boilerplate' | which was used to describe the boiler-making material. | | https://www.etymonline.com/search?q=boilerplate | | And the OED on the original 'boiler plate' | | _1. Usually as two words. A plate or sheet of metal of | suitable thickness and strength to be used in constructing the | shell of a boiler. Also as mass noun: metal in the form of such | plates. Cf. boiler-iron n. at boiler n. Compounds 2. | | 1793 Star 13 Nov. (advt.) Table of the number and dimensions of | Boiler Plates and weights thereof, suitable for Boilers, from | eight to sixteen feet and a half diameter. | | 1860 D. K. Clark & Z. Colburn Recent Pract. Locomotive Engine | i. i. 1/1 The earliest recorded trials of the strength of | boiler-plate, are those of Mr. Fairbairn, made in 1838. | | 1874 J. H. Collins Princ. Metal Mining (1875) xiii. 74 The | kibble is simply an iron bucket made of boiler plates, riveted | together. | | 1915 J. Wedgwood With Machine-guns in Gallipoli i. 4 Our | mechanics..lined her bridges with boiler plate and leaky sand- | bags._ | jefftk wrote: | I don't think any of those show that the use of "boilerplate" | to mean "required verbose writing" predates boiler nameplates | though? | Smoosh wrote: | A large slab of standardised content/dimensions ? | pvg wrote: | They don't but it explains why pre-set/cast type plates | that were sent ready-made to newspapers were called 'boiler | plate' which in turn explains the origin of 'boilerplate' a | lot better than the nameplate thing. | nickpinkston wrote: | Yea, I think this is actually the real answer, and OP is just | wrong. | | Here are old and modern examples where the boilerplate is a | standardized plate that's filled out using punched | letters/numbers. | | https://lestaret.files.wordpress.com/2009/09/boiler-3a.jpg | | https://www.steephillequipment.com/wp-content/uploads/2017/0... | | (am also in the MechE space) | LordDragonfang wrote: | Merriam Webster[1] online disagrees with you and agrees with | OP. That said, etymology is often contentious. | | https://www.merriam-webster.com/dictionary/boilerplate | karmakaze wrote: | This looks much more in line with programming boilerplate | with literal fill-in-the blanks. | | I would say the article captures early etymology but this | could be why _we call it boilerplate_. | | What I'd like to learn is the earliest computer related usage | of the term. Wikipedia says[0]: | | > The term arose from the newspaper business. Columns and | other pieces that were distributed by print syndicates were | sent to subscribing newspapers in the form of prepared | printing plates. Because of their resemblance to the metal | plates used in the making of boilers, they became known as | "boiler plates", and their resulting text--"boilerplate | text". As the stories that were distributed by boiler plates | were usually "fillers" rather than "serious" news, the term | became synonymous with unoriginal, repeated text.[2][3] | | > A related term is bookkeeping code, referring to code that | is not part of the business logic but is interleaved with it | in order to keep data structures updated or handle secondary | aspects of the program. | | [0] https://en.wikipedia.org/wiki/Boilerplate_code#Origin | fumeux_fume wrote: | At a certain point, the slang term "boilerplate" branched | away from the derogatory sense in reference to newspapers | to the more neutral sense of formulaic. The first "neutral" | sense reference in the OED is from 1949: | | Navy Contract Law (U.S. Bureau Naval Personnel) ix. 212/2 | -- "This type of clause has proved so valuable that it is | presently standard 'boilerplate' not only in shipbuilding | contracts but also in almost every kind of contract." | | The first reference in the OED for it being used w/r/t | computer stuff is 1990: | | L. Wall & R. L. Schwartz Programming Perl vii. 379 -- "Like | mus itself, man2mus is not 100% effective, but can save you | a lot of time producing the initial boilerplate." | a_t48 wrote: | The actual man2mus program appears to be not accessible | to the easily searchable public internet anymore, but | there's a few references to it - "usub/man2mus A manual | page to .mus translator". It's Perl, apparently. | | Neat. | ergonaught wrote: | Assumptions are immaterial, however. Etymology of the term is | as noted in the article. It is more likely that this use (as | on water heaters and such) derives from the same typesetting | usage. | ynniv wrote: | It's always satisfying to be certain, but the meaning of | words does shift over time, and sometimes words have | multiple origins. Assuming that 70s or 80s programmers knew | anything about printing presses is tenuous. Given the long | assumption that boilerplate refers to plates on equipment | and superior fit of "fill in the blank" documents, it seems | more likely that this is the intended meaning. Perhaps the | term was heard and misunderstood early on? But the proposed | origin doesn't align with the community that's using it to | refer to source code. | pavon wrote: | > Assuming that 70s or 80s programmers knew anything | about printing presses is tenuous | | True, but as you say the meaning of words shift. It is | entirely plausible that they were exposed to the term in | its bureaucratic meaning, and continued to use it without | any connection to actual boilers - the same way we do | today. | dcminter wrote: | I remember asking my father in the 1980s what | "boilerplate" meant, having encountered the term in a | newspaper. He relayed it to me in the legal sense of the | preliminary standard matter on a contract. He was a | software developer starting in the 1960s so I have | absolutely no doubt that the bureacratic usage was well | known in those circles. | rjmunro wrote: | > Assuming that 70s or 80s programmers knew anything | about printing presses is tenuous. | | I don't think that's the case at all. Lots of work was | done computerising newsrooms in that period. | kgwgk wrote: | I find more likely that the programming "boilerplate" | comes from the legal "boilerplate". | ergonaught wrote: | The replies seem confused. | | No one ever called it "boilerplate code" for any reason | having to do with boilers or typesetting or water | heaters. | | It's a language idiom. It entered common use through | reasonably well documented avenues, and that is via | typesetting. | | We use it because that's just how language works. All | these "it makes more sense to me if it referred to such | and such" misunderstand language. | usrusr wrote: | Not a mechanical engineer, but similar assumptions. Chances are | the term wouldn't have become a fixture in software jargon | without that folk etymology. I'm genuinely surprised that it's | quite literally about copy/paste, and not about formalities at | all! | jalk wrote: | I have only ever known boiler plate code as that kind of code | that is needed to stitch things together, initialize | libraries and so on. So not exactly copy/paste, but rather | "formulaic" code that has not yet been deemed worthy of an | abstraction | stewx wrote: | Funny. Our professor told us it was called that because a boiler | plate is something you cook on, like a griddle or hot plate. You | can't cook your food until that basic element is in place. | froggertoaster wrote: | > Now that Twitter is on a downward spiral | | If you open your article with hyperbole, don't be surprised if I | take the rest of the article with a huge grain of salt. | xdennis wrote: | I don't agree that it's a hyperbole. A hyperbole is something | ridiculous like "I'm so hungry I could eat 1000 pizzas" which | is physically impossible. | | Twitter _is_ on shaky ground. Maybe it will recover and soar, | but it's not an exaggeration that it could spiral down. | aninteger wrote: | > Now that Twitter is on a downward spiral I'm rewriting my | favorite tweetstorms in a more permanent medium | | Thank you! | 6gvONxR4sf7o wrote: | > The author says that because of boilerplate, "brains have been | at a discount" and "the editorial needs have chiefly been a | strong right arm and an axe" | | It's remarkable to see a sentiment that's so common in the | internet era showing up in 1894. | | Today, you'd probably phrase it as 'we're in an attention economy | due to boilerplate' or 'the signal to noise ratio is worse due to | boilerplate' or something (with modern 'boilerplate' being | electronic rather than mechanical). | marcosdumay wrote: | > It's remarkable to see a sentiment that's so common in the | internet era showing up in 1894. | | There is a famous ancient Greek quote, that AFAIK nobody can | agree on the author with basically the same sentiment. The | written word surely destroyed our civilization. | LAC-Tech wrote: | But it's a logical fallacy to assume that just because he was | wrong about writing, that others are wrong about more modern | media. | marcosdumay wrote: | Oh, you'll need extra evidence if you want to even conclude | that Socrates (thanks, HPsquared) was wrong. | | It's just that the GGP though it was funny that the | sentiment was as old as the 19th century. I'm just pointing | that it was older. | HPsquared wrote: | Socrates on writing (verbally, as Socrates famously didn't | write anything himself): | | "For this invention will produce forgetfulness in the minds | of those who learn to use it, because they will not practice | their memory. Their trust in writing, produced by external | characters which are no part of themselves, will discourage | the use of their own memory within them. You have invented an | elixir not of memory, but of reminding; and you offer your | pupils the appearance of wisdom, not true wisdom, for they | will read many things without instruction and will therefore | seem to know many things, when they are for the most part | ignorant and hard to get along with, since they are not wise, | but only appear wise." | | It's a lot like what people say now about the internet, | Google etc. | skykooler wrote: | Reminds me of this xkcd comic: https://xkcd.com/1227 | dr-detroit wrote: | ZeroGravitas wrote: | These are sometimes referred to as "dead metaphors" when you lose | the mental connection to what originally inspired it: | | https://en.m.wikipedia.org/wiki/Dead_metaphor | AdmiralAsshat wrote: | I wonder if we could add "record scratch noise" into the dead | metaphors category, or if we'd need to make a new category for | audio relics instead of written ones. | pinusc wrote: | I'd say that metaphor not quite dead yet. A few generations | are younger than CDs, but vinyl still appears in a lot of pop | culture (in no small part thanks to nostalgia). I'd wager | most teens would know that the vinyl scratch sound is indeed | from vinyl, even though most would never have touched a vinyl | disc. Dead media, but the metaphor is still fresh enough... | pedrow wrote: | "Bootstrap" from which we get "booting up" and "reboot" is | another one[0] | | [0]: https://www.etymonline.com/search?q=bootstrap | stevage wrote: | Ah that one is only semi dead for me. Hadn't realised that | bootstraps weren't the same as bootlaces though. | jxf wrote: | What a neat little reference. I love finding out that someone, | somewhere, has taken the time to put a little sticker on | something and say "I think I'll call this idea X". | bdcp wrote: | You should name that phenomenon ___________________________________________________________________ (page generated 2022-11-15 23:00 UTC)