Use A Code Generator

If you need to create a bunch of code and don’t have a lot of time. One technique I use is to use a code generator to do most of the programming for you. I have used this process many times generating wire-frame HTML mock-ups or generating stubs for Struts or JSF applications.

By following the steps below you can create a code generator in any language:

  1. Create all your templates
  2. Add variables to all your templates where you want to add content
  3. Write a program to convert your templates to text files
  4. Populate your database, usually with a CSV/Excel file.
  5. Run your generator

For simple programs you will still need to create your basic template, but you can skip the database creation if you parse a CSV file, or maybe you can just pre-fill your data into arrays within your generator program.