Boilerplate (text)

Boilerplate (text)

Boilerplate is any text that is or can be reused in new contexts or applications without being changed much from the original. Many computer programmers often use the term boilerplate code. A legal boilerplate is a standard provision in a contract.

The term dates back to the early 1900s, referring to the thick, tough steel sheets used to build steam boilers. From the 1890s onwards, printing plates of text for widespread reproduction such as advertisements or syndicated columns were cast or stamped in steel (instead of the much softer and less durable lead alloys used otherwise) ready for the printing press and distributed to newspapers around the United States. They came to be known as 'boilerplates'. Until the 1950s, thousands of newspapers received and used this kind of boilerplate from the nation's largest supplier, the Western Newspaper Union.

Some companies also sent out press releases as boilerplate so that they had to be printed as written. The modern equivalent is the press release boilerplate, or "boiler," a paragraph or two that describes the company and its products.

The word has also come into use for pre-created form letters on the Internet for things such as issues to be broached by a politician based on an issue ad, requesting a cable network be added to a system by a cable or satellite operator, or a pre-written complaint about something such as a program, book, or video game opposed by a group which created the letter, along with online petitions. Usually the greeting and the body of the letter have been pre-written, requiring the person requesting the action to only type or sign their name at the end.

Boilerplate language

The term boilerplate is adopted by lawyers to describe those parts of a contract that are considered "standard language", although it is good practice to always read the boilerplates in any contract.

Boilerplate code

In computer programming, boilerplate is the term used to describe sections of code that have to be included in many places with little or no alteration. It is more often used when referring to languages which are considered "verbose", i.e. the programmer must write a lot of code to do minimal jobs. The need for boilerplate can be reduced through high-level mechanisms such as Metaprogramming (which has the computer automatically write the needed boilerplate text) and Convention over Configuration (which provides good defaults values, reducing the need to specify program details in every project).

The following Perl example demonstrates boilerplate. It consists of a shebang and two pragmas mandated by good programming style at the beginning of a source file. These lines aren't part of the program logic but convey information for the execution environment.


#!/usr/bin/perluse warnings;use strict;

A frequent source of boilerplate comes from the need to prepare the use of a general library having a low level of abstraction. An example is the strcat function in C to append two strings. Since there is no String type in the C language, strings are represented as an array of characters that ends with the NULL value. The code needed to call strcat to create a new string by appending two strings called first and second would be:

char *result; /* Allocate memory for the size of the two strings, plus 1 for the terminating NULL character. */result = malloc(strlen(first) + strlen(second) + 1); /* Copy the contents of 'first' to 'result'. */strcpy(result, first); /* Append the contents of 'second'. */strcat(result, second);

...

/* Deallocate the reserved memory when finished */free(result);

The variable declaration, malloc and free statements are the boilerplate needed to prepare for the actual work performed by the two function calls.

ee also

* Library (computer science).


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Boilerplate — may refer to: * Boilerplate, a relatively thick sheet of high quality steel, suitable for building boilers * Boilerplate (text), text (or program code) that can be used in a variety of situations * Boilerplate (robot), a fictional combat robot *… …   Wikipedia

  • boilerplate — boil·er·plate / bȯi lər ˌplāt/ n: standardized text in documents (as contracts) Merriam Webster’s Dictionary of Law. Merriam Webster. 1996. boilerplate …   Law dictionary

  • boilerplate — 1. adjective a) Describing text of a standard or routine nature. The contract contained all the usual boilerplate clauses. b) Used to describe a non functional spacecraft used to test configuration and procedures. A boilerplate spacecraft was… …   Wiktionary

  • boilerplate — noun Date: 1897 1. syndicated material supplied especially to weekly newspapers in matrix or plate form 2. a. standardized text b. formulaic or hackneyed language < bureaucratic boilerplate > 3. tigh …   New Collegiate Dictionary

  • boilerplate — /boy leuhr playt /, n. 1. plating of iron or steel for making the shells of boilers, covering the hulls of ships, etc. 2. Journalism. a. syndicated or ready to print copy, used esp. by weekly newspapers. b. trite, hackneyed writing. 3. the… …   Universalium

  • boilerplate — n. shell of thick metal plating on hot water boilers; standard text, copy that is ready to print (newspapers) …   English contemporary dictionary

  • boilerplate — noun 1》 rolled steel plates for making boilers. 2》 (boilerplates) Climbing smooth, overlapping slabs of rock. 3》 chiefly N. Amer. stereotyped or clichéd writing.     ↘standardized pieces of text for use as clauses in contracts or as part of a… …   English new terms dictionary

  • Wikipedia:Glossary — Welcome to Wikipedia, which anyone can edit. Help index: Ask questions · Learn wikicode · View FAQ · Read Glossary · Live Wikipedia editing related help via web chat  …   Wikipedia

  • Wikipedia:Pages needing translation into English — Resources for maintenance and collaboration Cleanup …   Wikipedia

  • XML — Infobox file format name = Extensible Markup Language icon = logo = extension = .xml mime = application/xml, text/xml (deprecated) type code = uniform type = public.xml magic = owner = World Wide Web Consortium genre = Markup language container… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”