I hope this post isn't too "Fringe" - I'm sure someone will just kill it if it is :)

Three things made me want to reach out about this now:

  1. Decoupling is so in the forefront of design.
  2. TDD inspires the idea that it doesn't matter how a program comes to exist as long as it works.
  3. Seeing how often the adapter pattern is applied to achieve (1).

I'm almost sure this has been tried from a memory of reading about it around the year 2000 or so. If I had to guess, it was maybe about and earlier version of the Java Spring framework. At this time we were not so far from days when the belief was that computer programs could exhibit useful emergent behavior. I think the article said it didn't work, but it didn't say it was impossible.

I wonder if since then it has been deemed impossible or simply an illusion due to a false assumption of similarity between a brain and a CPU. I know this illusion existed because I had an internship in 1996 where I programmed neural nets that were supposedly going to exhibit "brain damage".

STILL, after all that, I'm sitting around this morning and not able to shake the idea that it should be possible to have a method of programming to allow autonomous components to find each other, attempt to collaborate and their outputs evaluated against a set desired results.

closed as too broad by GlenH7, gnat, user40980, Bart van Ingen Schenau, amon May 4 '14 at 10:29

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • The usefulness of a program is hard to define. Most of the time figuring what behavior would be useful is the main job of a programmer. Quick note: Neural networks have nothing to do with the brain. – Simon Bergot Apr 14 '12 at 21:01
  • on point 1 - i mean do they make any existing tests pass? on point 2 - i disagree but its probably just a matter of semantics - the "neurons" in neural networks are threshold functions that were conceived as a metaphor for the biological neuron (nobody really thought it was that simple, but they thought it might lead to a similarly behaving system - something that only happened in very minuscule amounts) – Aaron Anodide Apr 14 '12 at 21:07
  • Emergent behavior is different from useful behavior. Packet storms on a network and runs on a bank are emergent behaviors, but they aren't useful. I think we're still at the stage where we feel pretty clever if we can predict the onset of emergent behavior, and a long way from designing it to particular ends. – Charles E. Grant Apr 14 '12 at 21:52
  • 1
    Your question is very vague. As written it sounds like you are hopping for a genie to pop out of a bottle and grants your wishes even before you state them. Genetic algorithms, cellular automata and neural networks can all generate complex behavior, and can be used to implement sophisticated algorithms, but in order to get them to solve a particular problem they have to be carefully designed to that purpose. I don't know if it's what you intend, but as written it sounds like what you're hopping for is more mind reading than AI. – Charles E. Grant Apr 14 '12 at 22:30
  • 1
    I really am not intending to rag on you, but what constitutes a 'valid' program? It's a simple word, but it's sweeping a bunch of stuff under the rug. In the most general case it's known that there is no single algorithm that can correctly identify whether an arbitrary program and input will halt or not. In a rough sense genetic algorithms are combining compatible components to create valid programs, but it's not a magic bullet. The developer has to encode the problem into a genetic representation and come up with a 'fitness' function, which I suppose is something like your notion of 'valid. – Charles E. Grant Apr 14 '12 at 23:31

Disclaimer: I'm not a researcher, just an interested developer.

The short answer is Yes, this has been done, at least with web-services and with formulaic requirements, not tests.

I assume your question to mean, "given that several algorithms exist, and a set of tests exist, can a program attempt to combine those algorithms randomly trying to pass the tests?"

I agree with Charles E. Grant's assertion that once you start randomly creating programs you run into the Halting Problem (it's impossible to determine if there is an infinite loop in a program), so this can be a problem, but it can be overcome by methodically creating the program, not randomly.

Likewise, whenever you start asking the question, "can we automate this generally?" you very likely approach AI-complete. In other words, any sufficiently complex problem requires a human-level intelligence to solve. To get around this, you need to limit the scope of your question. For example, can a program automatically...

  1. generate code based on requirements? NASA has done extensive research in code generation, but the formal specification required is just as difficult as coding. This goes all the way back to at least 1971, called "Automatic Program Synthesis"
  2. combine existing web-services based on requirements (see "Value-Added Web Services Composition Using Automatic Program Synthesis")
  3. combine read-only web-services (see Automatic composition of information-providing web services based on query rewriting)
  4. create a program for statistical data analysis (see "AutoBayes")
  5. generalize an edit of text (see Avi Bryant at 27:01 who stole it from MIT/MassEdit)
  6. create rules for categorizing text? See below.

A simpler question in computing is "given two existing clusters of data, create a filter that can categorize new data with low error-rates." Text-categorization, such as Spam-filtering falls in this realm. This is a well-studied area and many algorithms exist for solving this problem. RIPPER is one such algorithm, which creates the smallest set of rules that categorize text accurately, much like Einstein's Constraint: "Everything should be kept as simple as possible, but no simpler."

This is all I could find/know. If someone could find something more like what this question asks, I would be very interested. I think what you will find though is that the resulting program will only be as good as your input. The amount of "Tests" you would have to write would be so large, you'd be better off just writing the program.

PS: I had a lot more links but stackexchange won't let me post them :-(

Not the answer you're looking for? Browse other questions tagged or ask your own question.