Many TeXnicians following Knuth use versions of Literate programming style. In this style the master document contains both the code and its description, and tools are used to either extract the code or typeset the documentation.
Most LaTeX authors use the variant of Literate programming based on
docstrip program. In this variant a
.dtx file contains both the code, the comments and sometimes user manual. Running
latex on this file typesets the commented code, while running
latex on the
.ins file extracts the correspongig
.sty and other LaTeX files.