What is the most popular programming language used by open source developers?

The answer depends on how you define popularity.

According to a new study from Black Duck, a software-license code analysis vendor, C represents more than 40 percent of all code written for open source software.

Black Duck made its determination by counting the actual lines of code. While C is the leader by that measure, PHP and JavaScript are on the rise when you look at the broader picture of how open source projects use programming languages.

"Most open source projects use more than one language," Peter Vescuso, Black Duck's executive vice president of marketing and business development told InternetNews.com. "We found that 36 percent of all the projects, with a release in the last year, had some JavaScript."

Looking at all open source releases over the past 12 months, JavaScript accounted for 7.6 percent of all lines of code. According to Black Duck, JavaScript usage has risen by 2.1 percent in terms of lines of code over the last 12 months.

So why is there a big difference in measurement?

"The total number of lines of code is one measure of usage," Vescuso said. "You are absolutely right that this would favor more verbose languages. To balance that, we also ran an analysis in which we counted the number of times that a project used a given language  allowing for projects to use multiple languages."

Using the same metric, Black Duck found that 32 percent of all open source software projects had used C in the last 12 months, placing it second behind JavaScript's 36 percent.

C++ was found in 26 percent of open source projects, and represented 13 percent of all code when counted on a line-by-line basis of releases in the last 12 months.

PHP turned up in 17 percent of open source projects, accounting for 5.2 percent of all code in the past year. PHP's 12 month code tally represents a 0.3 percent gain, according to Black Duck.

Black Duck also did an analysis to see which language would come out on top, if they only counted one language choice (the most used language) per project. In that analysis, Perl ranked first with 15 percent of all projects in the last 12 months. Java and C# tied for second place at 11 percent, and JavaScript was third at 10 percent.

"Notice how Java and Perl top this list, meaning that slightly more open source projects use these as the predominant languages," Vescuso said.

Black Duck's data does not provide any visibility into how the use of open source developer language varies from that of proprietary data, but Vescuso has some ideas.

"We only have data on open source and other downloadable code, but everyone we talk to believes that languages like COBOL, C# and Visual Basic are widely used in proprietary applications and underrepresented in the open source world," Vescuso said.