Patent attributes
The disclosure presents methods and apparatus that can be used to generate a software source code according to a user-provided specification based on example snippets searched from the Internet or a local database, comprising: providing a user-defined specification of the target program including input data, output data, a function or algorithm, and other parameters; decomposing the function into sub-functions if necessary; searching a list of related programming example codes and snippets of each sub-function; analyzing and ranking the search results; selecting and extracting the best snippet source codes; refactoring and reformatting the codes; gluing and testing the generated codes. The final source codes are supposed to be compiled successfully and implement the desired function and meet the performance requirements. Even the final compilation success is not guaranteed the described method and apparatus can help on a best-effort basis and reduce a great effort in programming.