What is Boilerplate code?

Boilerplate code refers to sections of code that have to be included in many places with little or no alteration. It is often used when referring to languages that are considered verbose, i.e. the programmer must write a lot of code to do minimal jobs.
注:冗余而又不得不写的代码。

处理方法:

  • metaprogramming (which has the computer automatically write the needed boilerplate code or insert it at compile time)
  • convention over configuration (which provides good default values, reducing the need to specify program details in every project). Eg. Spring Auto Configuration.
  • model-driven engineering (which uses models and model-to-code generators, eliminating the need for boilerplate manual code)

猜你喜欢

转载自blog.csdn.net/sinat_34763749/article/details/80586043