a discussion on automatic programming

24
"Find a bug in a program, and fix it, and the program will work today. Show the program how to find and fix a bug, and the program will work forever." -Oliver Selfridge

Upload: techmonkey4u

Post on 18-Dec-2014

385 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: A Discussion on Automatic Programming

"Find a bug in a program, and fix it, and the program will work today. Show the program how to find and fix a bug, and the program will work forever."

-Oliver Selfridge

Page 2: A Discussion on Automatic Programming

A Discussion onAutomatic Programming

Corey A. SpitzerBarCamp Omaha

August, 2008

Page 3: A Discussion on Automatic Programming

Automatic Programming?

Page 4: A Discussion on Automatic Programming

"What would you say... you do here?"

Page 5: A Discussion on Automatic Programming

•Gather and document requirements•Design and document the solution•Code the framework, architecture, and/or scaffolding/plumbing•Set up storage, code data access layer (mundane persistence and CRUD stuff)•Code business logic•UI design and development•Refactor, refactor again, update docs•Debug, debug again•Tests (unit, integration, penetration, load, stress, usability, etc.)•Documentation•Deploy, get feedback•Monitor, support, perform maintenance

Page 6: A Discussion on Automatic Programming

Scaffolding

Page 7: A Discussion on Automatic Programming

Model Driven Architecture

Page 8: A Discussion on Automatic Programming

Documentation Generation

Page 9: A Discussion on Automatic Programming

Documentation Generation

Page 10: A Discussion on Automatic Programming

Round-trip Engineering

Page 11: A Discussion on Automatic Programming

Natural Language Programming

Page 12: A Discussion on Automatic Programming

Metafor

Page 13: A Discussion on Automatic Programming

osmosian.com's"Plain English"

To create the background:

Draw the screen's box with the white color.

Loop.

Pick a spot anywhere in the screen's box.

Pick a color between the lightest gray color and the white color.

Dab the color on the spot.

If a counter is past 80000, break.

If the counter is evenly divisible by 1000, refresh the screen.

Repeat.

Extract the background given the screen's box. \*dahd or Create the background from the screen. Or something.

To create a work given a URL:

Allocate memory for the work.

Put the URL into the work's URL.

To create some works given a buffer:

Destroy the works.

Put nil into the current work.

Slap a rider on the buffer.

Page 14: A Discussion on Automatic Programming

My Recipe

Page 15: A Discussion on Automatic Programming

public abstract class Function { handleActionFromUI(String action) {

 

  // run this function Collection returnCollection = performAction(action);

  return returnCollection; }

public abstract Collection performAction(String action);}

Page 16: A Discussion on Automatic Programming

public abstract class Function { handleActionFromUI(String action) { // create a unique test name

  // run this function Collection returnCollection = performAction(action);

  return returnCollection; }

public abstract Collection performAction(String action);}

Page 17: A Discussion on Automatic Programming

public abstract class Function { handleActionFromUI(String action) { // create a unique test name

// save the present environment and state

// run this function Collection returnCollection = performAction(action);

  return returnCollection; }

public abstract Collection performAction(String action);}

Page 18: A Discussion on Automatic Programming

public abstract class Function { handleActionFromUI(String action) { // create a unique test name

// save the present environment and state

// generate code to load the present environment and state 

  // run this function Collection returnCollection = performAction(action);

  return returnCollection; }

public abstract Collection performAction(String action);}

Page 19: A Discussion on Automatic Programming

public abstract class Function { handleActionFromUI(String action) { // create a unique test name

// save the present environment and state

// generate code to load the present environment and state  // generate code to instantiate and run this function with // current inputs  // run this function Collection returnCollection = performAction(action);

  return returnCollection; }

public abstract Collection performAction(String action);}

Page 20: A Discussion on Automatic Programming

public abstract class Function { handleActionFromUI(String action) { // create a unique test name

// save the present environment and state

// generate code to load the present environment and state  // generate code to instantiate and run this function with // current inputs  // run this function Collection returnCollection = performAction(action);

// generate code to assert the output from running the test code // will be the same output as it is now  return returnCollection; }

public abstract Collection performAction(String action);}

Page 21: A Discussion on Automatic Programming

public void testLoginController_login_cas_100{ loadState("login_cas_100.sql");

HashMap<String, String> output = runFunction("foo", "bar", 123);

assertEquals("blah", output.get("foo")); ...}

public void testMyController_doSomething_cas_100{ ...}

public void testMyController_doSomething_cas_101{ ...}

Page 22: A Discussion on Automatic Programming

But wait... There's more!

Page 23: A Discussion on Automatic Programming
Page 24: A Discussion on Automatic Programming

Sources and Useful LinksDoxygen

http://www.stack.nl/~dimitri/doxygen/

Object Management Grouphttp://www.omg.org/mda/

Code Generation Networkhttp://www.codegeneration.net

Ruby on Railshttp://www.rubyonrails.org

Djangohttp://www.djangoproject.com

Metafor Infohttp://ll4.csail.mit.edu/slides/metafor.pdf