Templated Project Maker

Fri, Nov 27, 2020 4-minute read

What is TPL

Tpl is a tool that creates boilerplate code for projects. I know there are other tools out there that can do this sort of thing, but they always seem huge and overly complicated; I just need to create a few files for a project so I can get moving. This also allows me to keep a library of templates that can be used to build projects that I can then build on top of, instead of always starting from scratch each time.

The tool, tpl, can be installed by just cloning the github repo into ~/.tpl and then creating a link from ~/.tpl/tpl to /usr/local/bin/tpl. After that, you can just run tpl from any directory and have it create content (tpl list to see what kind of content it knows about).

Ways of storing information

The other motivation for making this tool was to explore the idea of making things you learn more usable. When you learn something new, there are multiple ways you can store what you learn; some are useful and some are not:

  1. Bookmarks: you have a link to a page that has the information you want to be able to recall at a later time. When that time comes, you’ll need to first remember what that bookmark was called, and second hope the site is still there, and has the information you were looking for. Not the best system, -1.
  2. Personal Wiki/Evernote: This is better; as you are learning new things, you are updating your personal information store, and when you need to reference it again, you just search your notes. Assuming you have added the correct information to the entry, you can hopefully find the information you wrote down about it. This is better, and even more so if you stored the information in a usable format (not just copy/paste from the source material).
  3. Making a tool: This (I think) is the best solution. As you learn new things, you build tools that implement the things you learn. Now when it comes times to use this information, instead of searching for it, parsing it, and converting it to a format you can use, you just use the tool you created.

A simple example:

A child is learning to add:

  1. As the child learns to add, they could link to the resources they are using to learn with. When they get suck in the future, they can search through all of these resources for help.
  2. As the child learns to add, they could keep their own notes in a personal information store, Converting ideas to their own words and putting the data in themselves will make the data more accessible later when they need to come back and find it.
  3. As the child learns to add, they could write a calculator application. Now when they get stuck in the future, they can use the calculate to solve the problem (or to just check their work along the way to make sure they are doing things correctly.)

In this example, you can see the tool that implements what the child learned is the fastest and most useful way to store knowledge, and as the child learns new concepts (subtraction, division, multiplication …etc) the tool can be updated to include all of this.

A tool for Boilerplate code

Extending the previous idea, when you want to create boilerplate code you could:

  1. find a link to the website that has the example code you want, and tweak it to what you need. Every time you do this, you need to go through these steps, and possible find different version each time.
  2. you could keep these snippets of code in your personal information store, and when it comes time to use them, you just search for your store, and paste what you need. This kind of works, but if the projects need multiple files, or directories this could get tedious and might introduce errors.
  3. you could write a tool that capture how to create different types of projects, and then when you need to create a new project, all you need to do is run the tool and get a consistent project created. And as you learn, you can update the tool for new projects, or you can update existing templates with new knowledge, instead of starting from scratch each time.