What is boilerplate code?

前端 未结 14 736
终归单人心
终归单人心 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:01

    From Wikipedia:

    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 that are considered verbose, i.e. the programmer must write a lot of code to do minimal jobs.

    So basically you can consider boilerplate code as a text that is needed by a programming language very often all around the programs you write in that language.

    Modern languages are trying to reduce it, but also the older language which has specific type-checkers (for example OCaml has a type-inferrer that allows you to avoid so many declarations that would be boilerplate code in a more verbose language like Java)

提交回复
热议问题