Boilerplate

Boilerplate (also boilerplate or English for original boiler plate, hot plate, transferred default text, text block) denotes a uniform block of text usually at the end of the text. In connection with e -mail, the term is also used in connection with the signature. The term is used both in media work and the printing industry as well as in programming.

Public relations

Boilerplate or Backgrounder is a term from the PR and media relations. It involves a passage at the end of a press release. It contains the most important general information on the organization, which is behind the media release ( eg number of employees of the company, sales, locations, industry sectors, foundation ).

The boilerplate is thus a constant over a longer period block of text with no direct link to the current event, which is content in the center of the media release. The Boilerplate offers journalists the opportunity to capture the activity profile of an organization or a company at a glance.

Programming

In programming, the term boilerplate code snippets that are needed in many places in more or less unchanged form. This is more common in programming languages ​​, which are considered more " talkative " ( verbose), that is, squeeze some programmers even for the smallest of tasks a lot of encoding. The need for boilerplate code, by use of high-level mechanisms such as metaprogramming ( the system the required boilerplate code is generated automatically ) and method blocks " good " Default values ​​are provided as convention over configuration (which so many implementation details not must be explicitly specified in each project ) can be reduced.

The following Perlzeilen show examples of boilerplate code. They consist of a shebang and two pragmas ( the good programming style requires ) at the beginning of a source file. These lines are not part of the program logic, but also contain information for the runtime environment.

#! / usr / bin / perl use warnings; use strict; Boilerplate code is often needed to prepare for the use of functions from libraries with a low level of abstraction. An example of this is the strcat function in C for joining two strings. Because C does not have a string data type, strings are represented as null-terminated character arrays. The code that you need to (at least in a way ) to concatenate two strings with strcat called first and second reads in detail annotated version, but without the need for error handling:

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 declarations and instructions malloc and free are the boilerplate code, which must be provided as a framework for the actual work of both function calls and thus additionally written.

22628
de