This is a tutorial that provides programmers with a tasty morsel of information straight from the mind of BD. It explains how repititious code can be easily created, with much lower cost of developer resources.

Yes, I'm referring to programs that write programs...

As I sit here this evening a few things have crossed my mind. One of which is a programming problem that is all to frequent and easily fixed. When writing applications we frequently have to write repititious code. For example you are working on an application that takes advantage of beans to store data during a session of the application. A lot of small similar programs are required to fully complete the task at hand for example you may have the following:

Code:
public class Foo {
    protected int foo;
    protected String bar;
    protected double quux;

    public foo() {
         //do some stuff
    }
    
     public void setFoo(int foo) {
         this.foo = foo;
     }
 
     public int getFoo() {
         return foo;
     }

     ...
and each of the classes (or objects) you have to create is very similar to this. There is an easier way to do this than writing each one of the classes.
Create a code generator.
This makes your life much easier because instead of writing several (extremely) repitiitous programs, you can just write one. It should look something like the following:

Code:
public class BeanMaker {

      protected String filePath = "/path/to/some/directory/";
      protected String fileExtension = ".java";
      protected String fileName = "";
      protected PrintWriter out;
      
      public BeanMaker(String fileName) {
          this.fileName = fileName;
          try {
              out = new PrintWriter(new FileWriter(new File(filePath+fileName+fileExtension)));
              out.println("package  foo.bar;");
              out.println("import some.packages.*;"); 
              out.println("/**this object generated on "+new Date()+" by BigDick*/");
              out.println("public class "+fileName+" {");
          } catch (IOException e) {
              e.printStackTrace();
          }
      }

      public  void generateAccessor(String fieldType, String fieldName) {
          try {
              out.println("\tpublic void get"+fieldName+"("+fieldType+" value) {");
              out.println("\t\t this."+fieldName+" = value");
              out.println("\t}");
         } catch (IOException e) {
             e.printStackTrace();
         }
      }

      public void generateMutator(String fieldName, String fieldType) {
          try {
              out.println("\tpublic "+fieldType+" get"+fieldName+"() {");
              out.println("\t\treturn this."+fieldName+";");
              out.println("\t}");
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
 
      public void closeObject() {
          try {
              out.println("}");
              out.close();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
}
then all you have to do is create a main that gets the necessary information (can be from a flat file or a database, db can be much easier because of the metadata held by the system) and calls each of the methods/functions for each object that needs to be created. Then you can go in and hand code any additional methods that are necessary (or create in this program one that does so for you) but include involved logic.

I said in the topic that this is how to win friends and influence people, I don't know about the friends part, but it certainly can influence a co-worker/boss/professor when your productivity has sky rocketted. As I come up with more advanced methodologies of implementing an idea such as this, I'll keep the tutorial updated and I welcome any questions, comments, etc.

Also of note: the example here is Java, but this can be done with whatever language you need it for or in.

Okay, fixed the errors in the code sample.