Smarter software coding

Sunday 8th May 2016
Courtesy: www.dreamstime.com

Like invisible scaffolding, millions of lines of computer code underpin the software used daily, from the simplest smartphone apps to complex behemoths as Google’s Internet services. As software becomes more sophisticated, developers and programmers must still be able to produce high quality, error-free code — the world’s dependence on software means inefficiencies and mistakes can cost businesses billions of dollars every year. To improve the coding process Assistant Professor Jiang Lingxiao at SMU (Singapore Management University) School of Information Systems works on tools that help developers navigate the sea of existing code, as well as take full advantage of this vast repository of valuable information.

“More and more software, especially open-source software code, is being written, and there is much accumulated knowledge in the code, waiting to be extracted and reused by developers,” he explains. “The main purpose of the tools is to help developers better understand the software code created by themselves and others. This way, they are able to learn from each other, which in turn improves coding productivity and reduces code bugs.”

Enhancing a programmer’s toolbox
Professor Jiang  (right) is developing code search techniques that allow programmers to sift through large databases for code which they can then repurpose for their own needs. This is helpful and time-saving when programmers need to implement functions they might not be familiar with.

  • One such technique incorporates feedback from the user to refine and reorder search results, placing the most relevant hits at the top.
  • Another  called fault localisation, helps coders identify faults that cause failures during software execution, so they can quickly debug and repair them.
  • Professor Jiang’s most widely-used tool, known as DECKARD, detects code “clones”.

These duplicated fragments of code are common in codebases, and may arise when programmers, in a hurry to implement certain functions, simply copy and paste lines of code into their work without fully integrating them. This poor programming practice potentially introduces errors into the code, and  also makes the code longer, more complex, and so more difficult to maintain. Clone detection thus helps developers identify bugs and prune unwieldy code. 

The algorithm behind DECKARD was published in 2007 in Proceedings of the 29th International Conference on Software Engineering. “The techniques used in the tool have influenced many other tools, and many people have built further improvements on top of it,” says Jiang. 

Using contextual data to improve function 
Like most programming tools, DECKARD currently focuses on analysing the program code itself. But computer code is more than just standalone strings of letters and numbers, Professor Jiang notes. “To understand code better, write code faster, and identify bugs in code more accurately, we need to look beyond the code itself into its contexts, just like we often need to look at the contexts of a sentence in English to comprehend it properly,” he advises. 

"Contextual information may include data dependencies between the piece of code in question and the surrounding code — that is, one depends on the output data of the other. Users who run the code add further context in the form of input data, usage patterns, feedback and complaints; developers themselves may also contribute context in the form of coding and learning behaviour, project management approaches, and choice of development tools.

The absence of contextual data is all very fine for well-defined coding-related tasks, says Professor Jiang, pointing out but the data is essential for larger, more ambiguous tasks, such as code search and fault localisation problems that he works on.  And higher level contexts, including the code’s potential applications in society and its commercial and cultural impact, are much more difficult to measure.

Professor Jiang and his colleagues recently developed AutoQuery, a code search engine that uses contextual dependencies to improve search results. The research, available online in the  Automated Software Engineering, and describes that in addition to keywords, the user also enters code fragments into AutoQuery to indicate the context they are working under. The combination of keywords and data dependencies allows the search engine to pick out more relevant code samples from the database. 

Intelligent coding tools
Given the continuously increasing complexity and sophistication of computer software, Professor Jiang believes that intelligent, adaptable tools that can understand the needs of the programmer will soon become indispensable. In the long run, he wants to develop advanced, context-aware tools that would enable scenarios such as the following:

  • A developer is asked to write a new piece of software.
  • He fires up the coding tool and gives it the task requirements, written in English. 
  • The tool parses and breaks down these instructions.
  • It then queries existing code databases for relevant sample code  useful to the developer. 
  • Then it suggests possible solutions to the developer, who uses this information to design software. 
  • This process can be repeated, at finer grain, for individual software components, until the entire structure is complete.
  • The tool can also identify errors in the software, evaluate its performance, and again make correction suggestions and improvements. 
Custom Search

Scotland, Computer News in Scotland, Technology News in Scotland, Computing in Scotland, Web news in Scotland computers, Internet, Communications, advances in communications, communications in Scotland, Energy, Scottish energy, Materials, Biomedicine, Biomedicine in Scotland, articles in Biomedicine, Scottish business, business news in Scotland.

Website : beachshore