Sample scripts are samples and not fit for production use.
For this reason we mark all sample scripts as "Obsolete" such that they have a big warning in editor that they are not for production use.
Sample scripts no matter who creates them are created to be verbose and instruct new programmers and developers on the use of a given tool or technology. They are not an example of efficient practical use no matter what the author may say as they are not designed for you specific project, team, code style, etc..
You should ALWAYS treat sample code as a sample that you learn from and use to write your own working, practical ,efficient and appropriate for your project version.