What is boilerplate code?

前端 未结 14 668
终归单人心
终归单人心 2020-12-04 04:41

A coworker had never heard of this, and I couldn\'t provide a real definition. For me, it\'s always been an instance of \'I-know-it-when-I-see-it\'.

Bonus question,

相关标签:
14条回答
  • 2020-12-04 05:12

    A boilerplate is a unit of writing that can be reused over and over without change. By extension, the idea is sometimes applied to reusable programming, as in “boilerplate code

    0 讨论(0)
  • 2020-12-04 05:16

    On the etymology the term boilerplate: from http://www.takeourword.com/Issue009.html...

    Interestingly, the term arose from the newspaper business. Columns and other pieces that were syndicated were sent out to subscribing newspapers in the form of a mat (i.e. a matrix). Once received, boiling lead was poured into this mat to create the plate used to print the piece, hence the name boilerplate. As the article printed on a boilerplate could not be altered, the term came to be used by attorneys to refer to the portions of a contract which did not change through repeated uses in different applications, and finally to language in general which did not change in any document that was used repeatedly for different occasions.

    What constitutes boilerplate in programming? As may others have pointed out, it is just a chunk of code that is copied over and over again with little or no changes made to it in the process.

    0 讨论(0)
提交回复
热议问题